Quantcast
Channel: SCN : Document List - ABAP Development
Viewing all articles
Browse latest Browse all 935

BAPI_PO_CHANGE - Change SLFDT variable

$
0
0

Hello,attachedan example tochange the datestatisticsof distributions (variable SLFDT ), you just have topassthe parametersandcall the routine.

 

EXAMPLE:

 

FORM CHANGE_SLFDTUSING EBELN EBELP ETENR STAT_DATE.

   DATA: ERROR TYPE SY-SUBRC.
   DATA: POSCHEDULE LIKE  BAPIMEPOSCHEDULE OCCURS 0 WITH HEADER LINE.
   DATA: POSCHEDULEX LIKE  BAPIMEPOSCHEDULX OCCURS 0 WITH HEADER LINE.

   DATA : l_msgty      TYPE c,
          l_msgid(2)   TYPE c,
          l_msgno(3)   TYPE c,
          l_msgtx(100) TYPE c,
          l_errflag    TYPE c.

   CONSTANTS: c_x              TYPE  c         VALUE 'X',
            c_hyp            TYPE  c         VALUE '-',
            c_err            TYPE  bdc_mart  VALUE 'E'.
   DATA : BEGIN OF t_bapireturn OCCURS 0.
         INCLUDE STRUCTURE bapiret2.
   DATA : END OF t_bapireturn.
   DATA: WA_EKPO LIKE EKPO.
   DATA: ELIKZ_AUX LIKE EKPO-ELIKZ.
   DATA: EKPO_MSG TYPE STRING.
   DATA: i_return TYPE bapiret2 OCCURS 0 WITH HEADER LINE,
       wa_message TYPE c LENGTH 100.

      CLEAR: t_bapireturn.
      REFRESH: t_bapireturn.
      CLEAR POSCHEDULE.
      REFRESH POSCHEDULE.
      CLEAR POSCHEDULEX.
      REFRESH POSCHEDULEX.


* Load  PARAMETERS


     CLEAR POSCHEDULE.
     POSCHEDULE-PO_ITEM = EBELP.
     POSCHEDULE-SCHED_LINE = ETENR.
     POSCHEDULE-STAT_DATE = STAT_DATE.
     APPEND POSCHEDULE.
     CLEAR POSCHEDULEX.
     POSCHEDULEX-PO_ITEM = EBELP.
     POSCHEDULEX-SCHED_LINE = ETENR.
     POSCHEDULEX-STAT_DATE = 'X'.
     APPEND POSCHEDULEX.


*Call BAPI


     CALL FUNCTION 'BAPI_PO_CHANGE'
     exporting
     purchaseorder = EBELN
     TESTRUN = ''
     TABLES
     RETURN = t_bapireturn
     POSCHEDULE = POSCHEDULE
     POSCHEDULEX = POSCHEDULEX.

     READ TABLE t_bapireturn WITH KEY type = c_err TRANSPORTING NO FIELDS.

      IF sy-subrc NE 0.
        CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
          EXPORTING
            wait = c_x.

     ELSE.

        CLEAR EKPO_MSG.
        LOOP AT t_bapireturn WHERE TYPE = C_ERR.
          CONCATENATE EKPO_MSG 'ERROR //' t_bapireturn-type t_bapireturn-id t_bapireturn-number  t_bapireturn-message INTO EKPO_MSG SEPARATED BY SPACE.
        ENDLOOP.
    

      ENDIF.


ENDFORM.

 

 

Regards.


Viewing all articles
Browse latest Browse all 935

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>