WS_DELIVERY_UPDATE - Update Delivery

BAPI for updating the delivery document 

WS_DELIVERY_UPDATE - for picking the outbound delivery

The sample code:

WA_VBKOK-VBELN_VL = <del_nbr>.
WA_VBKOK-VBELN = VBFA-VBELV.
LOOP AT TAB_VBPOK.
TAB_VBPOK-VBELN_VL = WA_VBKOK-VBELN_VL.

Get delivery line item data. 
TAB_VBPOK-VBELN = SY-DATUM.
TAB_VBPOK-POSNN = SY-UZEIT.
TAB_VBPOK-VBTYP_N = VBFA-VBTYP_N.
SELECT * INTO TABLE TVBFA FROM VBFA
WHERE VBELV = WA_VBKOK-VBELN_VL.

SORT TVBFA DESCENDING.
CLEAR TVBFA.
READ TABLE TVBFA WITH KEY VBELV = TAB_VBPOK-VBELN_VL
POSNV = TAB_VBPOK-POSNR_VL
VBTYP_N = 'Q'
TAQUI = ' '.
IF SY-SUBRC EQ 0.
V_PIKMG = TAB_VBPOK-PIKMG + TVBFA-RFMNG. " Picking quantity
CLEAR TVBFA.
READ TABLE TVBFA WITH KEY VBELV = TAB_VBPOK-VBELN_VL
POSNV = TAB_VBPOK-POSNR_VL
VBTYP_N = 'Q'
TAQUI = 'X'.
IF SY-SUBRC EQ 0.
V_PIKMG = V_PIKMG + TVBFA-RFMNG. " Total Picking quantity

*****Error Message: Picked quantity is larger than the quantity to be delivered.
IF LIPS-LFIMG LT V_PIKMG.
PERFORM GET_RETURN USING 'E' 'VL' '019' SPACE SPACE SPACE SPACE
RETURN.
V_EXIT = 'Y'.
EXIT. " EXIT THE RFC.
ENDIF.
ENDIF.
ENDIF.

TAB_VBPOK-KZNTG = 'X'. " Confirmation of net weight
TAB_VBPOK-KZBRG = 'X'. " Confirmation of gross weight
TAB_VBPOK-KZVOL = 'X'. " Confirmation of volume
MODIFY TAB_VBPOK.
ENDLOOP.

CALL FUNCTION 'WS_DELIVERY_UPDATE_2'
EXPORTING
VBKOK_WA = WA_VBKOK
SYNCHRON = 'X'
DELIVERY = WA_VBKOK-VBELN_VL
NICHT_SPERREN_1 = 'X'
IF_ERROR_MESSAGES_SEND = 'X'
IT_PARTNER_UPDATE = IS_PARTNER
TABLES
PROT = I_PROTT.
IF NOT I_PROTT IS INITIAL.
RETURN-TYPE = 'E'.
RETURN-MESSAGE = 'Goods Issue Failed!'.
EXIT. "EXIT THE RFC
ELSE.
COMMIT WORK AND WAIT.
ENDIF.

ABAP Tips

Get help for your ABAP problems
Do you have a ABAP Question?

ABAP Books
ABAP Certification, BAPI, Java, Web Programming, Smart Forms, Sapscripts Reference Books

More ABAP Tips

Best regards,
SAP Basis, ABAP Programming and Other IMG Stuff
http://www.erpgreat.com

All the site contents are Copyright © www.erpgreat.com and the content authors. All rights reserved.
All product names are trademarks of their respective companies.  The site www.erpgreat.com is in no way affiliated with SAP AG. 
Every effort is made to ensure the content integrity.  Information used on this site is at your own risk. 
 The content on this site may not be reproduced or redistributed without the express written permission of 
www.erpgreat.com or the content authors.