Registration

Dear SAP Community Member,
In order to fully benefit from what the SAP Community has to offer, please register at:
http://scn.sap.com
Thank you,
The SAP Community team.
Skip to end of metadata
Go to start of metadata

Reverse Goods Movement (VL09)
For reversing goods movement pass LIKP-VBELN (delivery) to the function module, don't forget to use commit after the function module. To check the functionality of the function module, go to ME23N transaction and pass the purchase order. One line item will be added under goods receipt  and goods issue.

 *---declaration for functional module

   DATA: it_mesg LIKE mesg OCCURS 0 WITH HEADER LINE.
   DATA: it_likp type table of likp.
   DATA: d_vbeln LIKE likp-vbeln,
         d_vbtyp LIKE likp-vbtyp.

  LOOP AT it_likp.
     CLEAR : d_vbeln , d_vbtyp .
     d_vbeln = it_likp-vbeln.
     d_vbtyp = it_likp-vbtyp.

*---Reversing goods movement document (Transaction VL09)
     CALL FUNCTION 'WS_REVERSE_GOODS_ISSUE'
       EXPORTING
         i_vbeln                   = d_vbeln
         i_budat                   = sy-datlo
         i_tcode                   = c_vl09
         i_vbtyp                   = d_vbtyp
       TABLES
         t_mesg                    = it_mesg
       EXCEPTIONS
         error_reverse_goods_issue = 1
         OTHERS                    = 2.

If sy-subrc = 0.
*---commit
       CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
         EXPORTING
           wait = 'X'.
Else.
Endif.

Endloop.
 

1 Comment

  1. Guest

    Krishna, Marko:
    I'm using FM: WS_REVERSE_GOODS_ISSUE in background. There is in the same routine a call to the BAPI_SALESORDER_CHANGE.   
    Both FM woks fine unless when they are serialized. The BAPI cannot find the sales document.
    It's seems to me that there is a bug in WS_REVERSE_GOODS_ISSUE
    What do you think?
    Best regards