Hi All,
I'm trying with BAPI_SALESORDER_CHANGE to update a custom field in header level but sometime it successfully updating and sometime its not with the same data.
Please suggest.
Here is my code:
*-----Populating structures for 'Valuepart1'
wa_bape_vbak-vbeln = v_salesdocumentin. " Order Number
wa_bape_vbak-zzkkber = wa_upload-zzkkber. "' TEST'.
wa_bape_vbakx-vbeln = v_salesdocumentin.
wa_bape_vbakx-zzkkber = 'X'.
wa_bapi_extn-structure = c_bapi_struc. " c_bapi_struc->'BAPE_VBAK'.
wa_bapix_extn-structure = c_bapi_strucx. " c_bapi_struc->'BAPE_VBAKX'.
wa_bapi_extn-valuepart1 = wa_bape_vbak. "#EC
wa_bapix_extn-valuepart1 = wa_bape_vbakx. "#EC
*-----Appending I_EXTN.
APPEND wa_bapi_extn TO it_extn.
APPEND wa_bapix_extn TO it_extn.
*-----Populating structure K_HEADERX
wa_headerx-updateflag = 'U'. " c_updt->'U'
*-----Calling BAPI to update Sales Order
CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
EXPORTING
salesdocument = v_salesdocumentin
* order_header_in = wa_header
order_header_inx = wa_headerx
TABLES
return = it_return_ch
extensionin = it_extn.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.