‎2007 Jun 05 5:24 AM
How to add a Z field (Custom field) in BAPI_SALESORDER_CHANGE? I already added this field in the following structure: BAPE_VBAP, BAPE_VBAPX, VBAPKOM and VBAPKOMX.
Requirement is for the Table : VBAP , there is one custom field(zz_cd_embal) appended by structure. Using Bapi
I have to update this Custom field.
Using Bapi : BAPI_SALESORDER_CHANGE , but unable to update the field.
This custom field (zz_cd_embal) has added to structure BAPE_VBAP, BAPE_VBAPX, VBAPKOM and VBAPKOMX
please kindly let me know how to pass the parameter, so that I can update the field.
Here is the code pasted below. Please correct me if I am wrong.
REPORT ztestaas_orderchange .
TABLES: vbak, vbap.
PARAMETERS: p_vbeln LIKE vbak-vbeln.
PARAMETERS: p_posnr LIKE vbap-posnr.
DATA : str_header_in TYPE bapisdh1,
str_header_inx TYPE bapisdh1x,
str_extension TYPE bapiparex,
str_bape_vbap TYPE bape_vbap,
str_bape_vbapx TYPE bape_vbapx,
str_return TYPE bapiret2,
itb_return TYPE STANDARD TABLE OF bapiret2,
itb_extension TYPE STANDARD TABLE OF bapiparex.
DATA: itb_order_item_in TYPE TABLE OF bapisditm WITH HEADER LINE,
itb_order_item_inx TYPE TABLE OF bapisditmx WITH HEADER LINE.
START-OF-SELECTION.
str_header_inx-updateflag = 'U'.
itb_order_item_in-itm_number = p_posnr.
APPEND itb_order_item_in.
itb_order_item_inx-itm_number = p_posnr.
itb_order_item_inx-updateflag = 'U'.
APPEND itb_order_item_inx.
str_extension = 'BAPE_VBAP'.
str_bape_vbap-vbeln = p_vbeln.
str_bape_vbap-posnr = p_posnr.
str_bape_vbap-zz_cd_embal = '2C'.
str_extension+30 = str_bape_vbap.
APPEND str_extension TO itb_extension.
CLEAR str_extension.
str_extension = 'BAPE_VBAPX'.
str_bape_vbapx-vbeln = p_vbeln.
str_bape_vbapx-posnr = p_posnr.
str_bape_vbapx-zz_cd_embal = 'X'.
str_extension+30 = str_bape_vbapx.
APPEND str_extension TO itb_extension.
CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
EXPORTING
salesdocument = p_vbeln
order_header_in = str_header_in
order_header_inx = str_header_inx
SIMULATION = 'X'
BEHAVE_WHEN_ERROR = ' '
INT_NUMBER_ASSIGNMENT = ' '
LOGIC_SWITCH =
TABLES
return = itb_return
order_item_in = itb_order_item_in
order_item_inx = itb_order_item_inx
PARTNERS =
PARTNERCHANGES =
PARTNERADDRESSES =
ORDER_CFGS_REF =
ORDER_CFGS_INST =
ORDER_CFGS_PART_OF =
ORDER_CFGS_VALUE =
ORDER_CFGS_BLOB =
ORDER_CFGS_VK =
ORDER_CFGS_REFINST =
SCHEDULE_LINES =
SCHEDULE_LINESX =
ORDER_TEXT =
ORDER_KEYS =
CONDITIONS_IN =
CONDITIONS_INX =
extensionin = itb_extension .
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'
IMPORTING
RETURN = itb_return
.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
LOOP AT itb_return INTO str_return.
WRITE:/ str_return.
ENDLOOP.
Thanks,
Nowsath
‎2007 Jun 05 5:30 AM
Hi,
The code looks fine..
What exactly are you getting in the return internal table..
Thanks,
Naren
‎2007 Jun 05 9:17 AM
Hi Naren,
Thanks for your reply....
Please find the message in return internal table:
SV4 233ORDER_HEADER_IN has been processed successfully
SV4 233ITEM_IN has been processed successfully
SV1 311=S= Standard Order 7227447 has been saved
Thanks and Regards,
Nowsath
‎2007 Jun 05 3:59 PM
Hi,
Looks like the field is updated..Are you not able to see the value in the VBAP table??
Thanks,
Naren
‎2013 Aug 07 10:07 AM
Hi,
I had the same thing and figured out that I hat to append the same customer fields to communication structrures VBAPKOZ and VBAPKOZX.
Regards
Clemens