Skip to Content

About the Author

Vijay Agarwal is SAP Certified with vast Experience in ABAP &  HCM area .He is continuously improving his skill in abap and HCM arena.

Abstract 

To update Delivery document header with BAPI_OUTB_DELIVERY_CHANGE

Through enhancement for those fields which are not available to pass into BAPI parameter

About the Domain

SAP ABAP/SD module can use this document. This will help them to update Delivery

Header information through BAPI’s Enhancement.

 

         

 
 

Introduction

This document will cover basic steps to enhance BAPI_OUTB_DELIVERY_CHANGE to update Delivery document header table LIKP.

As there are some fields e.g. billing block LIKP-FAKSK is not available in BAPI ‘s Parameter to pass and system need to update Delivery document with these fields.

In that case with Enhancement, BAPI can be used to update delivery document although fields were not available in BAPI’s parameter for passing.

For example – There is need to update Delivery Billing block(LIKP-FAKSK) field based on certain condition through program instead of VL02N Tcode.

As LIKP-FAKSK is not available in BAPI’s parameter and instead of using direct modify statement which may cause of inconsistency between tables, BAPI will be used to update document consistently.


The Deployment Logic

  Dep.jpg

Steps involved

The step that needs to be followed is as below.

  1. Go to Se 38 , Create a Custom Program like ZDELIVERY_UPDATE .

  Define in data definition. 

DATA : ls_bapiobdlvhdrchg TYPE bapiobdlvhdrchg, 
   ls_bapiobdlvhdrctrlchg TYPE bapiobdlvhdrctrlchg,
lt_bapireturn type STANDARD TABLE OF bapiret2,
  
      lv_FAKSK type FAKSK ,
     FLG_BAPI_ERROR type Flag .      

  1. Define Selection screen with delivery number and bill block(field FAKSK – To be update through BAPI)
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME.
PARAMETERS: p_VBELN type VBELN_NACH,
                          p_FAKSK TYPE FAKSK .
SELECTION-SCREEN END OF BLOCK b1..             

  1. Export memory ID

            lv_FAKSK = p_FAKSK.

export lv_FAKSK to memory id 'ZLIKP'.

 

  1. Call BAPI ‘BAPI_OUTB_DELIVERY_CHANGE’ to update header billing block

With Required parameter Delivery number as Billing block(FAKSK) field is not available in any parameter of BAPI that why exported to memory id in previous step.

ls_bapiobdlvhdrchg-DELIV_NUMB = p_VBELN .
ls_bapiobdlvhdrctrlchg-DELIV_NUMB = p_VBELN .
CALL FUNCTION 'BAPI_OUTB_DELIVERY_CHANGE'
EXPORTING
header_data                   = ls_bapiobdlvhdrchg
header_control                = ls_bapiobdlvhdrctrlchg
delivery                      = p_VBELN
tables
return                        = lt_bapireturn .   
      if lt_bapireturn[] is not initial.
call function 'BAPI_TRANSACTION_COMMIT'
exporting
wait = 'X'.
ENDIF.


  1. Go to Include MV50AFZ1 under  FORM “USEREXIT_SAVE_DOCUMENT_PREPARE” which call before updating Delivery document either from BAPI or from Screen.

Write code here either directly in form or with implicit Enhancement in the form.

Import Memroy ID and then just update internal Table XLIKP with corresponding field value which will used to update DB Table LIKP.

FORM USEREXIT_SAVE_DOCUMENT_PREPARE.
DATA : lv_FAKSK type FAKSK.
if ( xlikp-vbtyp = 'J' OR xlikp-vbtyp = 'T' )  and  t180-trtyp = 'V'. 
CLEAR   lv_FAKSK.
import lv_FAKSK from MEMORY ID 'ZLIKP'.
  if sy-subrc is initial  and not lv_FAKSK is initial .
 LOOP AT xlikp.
     xlikp-FAKSK = lv_FAKSK.
       MODIFY xlikp transporting FAKSK .
ENDLOOP.
free MEMORY ID 'ZLIKP'.
Endif.
Endif.
ENDFORM.  

Output

Delivery document will be successfully updated.

Go to Se16 and check for LIKP table with your document number and check field value is updated with new value.

   

Conclusion

This code could be used to update Delivery document with BAPI whenever some fields are not available in BAPI’s Passing parameter.

Objective of this white paper 

Standard process to be followed during updating of Delivery document.Which will update corresponding tables with required checks.

Re-usability of efforts is key to deliver more in short time to reduce the turn around time in Project management.


References

  1. Scn.sap.com

To report this post you need to login first.

1 Comment

You must be Logged on to comment or reply to a post.

Leave a Reply