Current Position:Home > Update Zfield information on Devlivery header

Update Zfield information on Devlivery header

Update:11-30Source: network consolidation
Advertisement
Hi,
Does anyone please suggest  how to use BAPI_OUTB_DELIVERY_CHANGE with the extension fields populated. I used below code but no updates happening on custom field  in Delivery header table (LIKP).
data : ls_ext1 type BAPIEXTC,
        lt_ext1 type table of BAPIEXTC,
        ls_ext2 type BAPIEXT,
        lt_ext2 type table of BAPIEXT,
        header type BAPIOBDLVHDRCHG,
        HEADER_CONTROL type BAPIOBDLVHDRCTRLCHG,
        return type table of BAPIRET2.
  refresh : lt_ext1,lt_ext2.
        header-DELIV_NUMB = likp-vbeln.
        HEADER_CONTROL-DELIV_NUMB = likp-vbeln.
        ls_ext1-FIELD1 = 'ZZCARRIER'.
        append ls_ext1 to lt_ext1.
        ls_ext2-param     = 'LIKP'.
*       ls_ext2-row       = wa_lips-posnr.
        ls_ext2-field     = 'ZZCARRIER'.           "Z FIELD 2
        ls_ext2-value     = carriertype.
        ls_ext2-type = 'CHAR'.
        ls_ext2-length = '30'.
        append ls_ext2 to lt_ext2.
call function 'BAPI_OUTB_DELIVERY_CHANGE'
   exporting
     HEADER_DATA                   =  header
     HEADER_CONTROL                = HEADER_CONTROL
     DELIVERY                      = likp-vbeln
   tables
    EXTENSION1                    = lt_ext1
    EXTENSION2                    = lt_ext2
     RETURN                        = return
call function 'BAPI_TRANSACTION_COMMIT'
Thanks,
Ashok.

The Best Answer

Advertisement
Hey Ashok,
  why can't you try this one, this could resolve your problem as i hope:
Export your custom field value to a memory id
export ZFIELD to memory id 'ZLIKP'.
ls_bapiobdlvhdrchg-DELIV_NUMB = PASS  (DELIVERY DOC NUMBER ).
ls_bapiobdlvhdrctrlchg-DELIV_NUMB = PASS (DELIVERY DOC NUMBER ).
CALL FUNCTION 'BAPI_OUTB_DELIVERY_CHANGE'
EXPORTING
header_data                   = ls_bapiobdlvhdrchg
header_control                = ls_bapiobdlvhdrctrlchg
delivery                      = DELIVERY DOC NUMBER
tables
return                        = lt_bapireturn .   
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.
Once let me know after your attempt
Thanks,
Vamsi