Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Custom fields update using BAPI: BAPI_SALESORDER_CHANGE

Former Member
0 Kudos

Hi,

I have append one field into VBAP Table, and i want to update that filed value by using BAPI_SALESORDER_CHANGE FM. I have done all the coding but still its not updating the table. I have checked with SAP fields like order quantity, its upadating the database but the custom fileds are not upadting.

steps i have done: Append field to : VBAP,BAPE_VBAP,VBAPKOZ

Append Check field to : BAPE_VBAPX,VBAPKOZX

Here is the code : plz check and add ur comments

DATA : l_wa_bapiparex TYPE bapiparex,

l_wa_ord_header TYPE bapisdh1x,

l_itab_bapiparex TYPE STANDARD TABLE OF bapiparex INITIAL SIZE 0,

l_itab_return TYPE STANDARD TABLE OF bapiret2 INITIAL SIZE 0,

l_wa_item TYPE bapisditm,

l_itab_item TYPE STANDARD TABLE OF bapisditm INITIAL SIZE 0,

l_wa_itemx TYPE bapisditmx,

l_itab_itemx TYPE STANDARD TABLE OF bapisditmx INITIAL SIZE 0,

ORDER_HEADER_IN LIKE BAPISDH1.

l_wa_ord_header-updateflag = 'U'.

ORDER_HEADER_IN-REF_DOC = '0000000244'.

*Populate Item detail

l_wa_item-itm_number = '000010'.

l_wa_item-NET_WEIGHT = '5000'.

APPEND l_wa_item TO l_itab_item.

*Populate Item detail checkbox

l_wa_itemx-itm_number = '000010'.

l_wa_itemX-NET_WEIGHT = 'X'.

l_wa_itemx-updateflag = 'U'.

APPEND l_wa_itemx TO l_itab_itemx.

l_wa_bapiparex-structure = 'BAPE_VBAP'.

l_wa_bapiparex-valuepart1+0(10) = '0000000244'.

l_wa_bapiparex-valuepart1+10(6) = '000010'.

l_wa_bapiparex-valuepart1+16(15) = 'ABCDEF'.

APPEND l_wa_bapiparex TO l_itab_bapiparex.

CLEAR l_wa_bapiparex.

l_wa_bapiparex-structure = 'BAPE_VBAPX'.

l_wa_bapiparex-valuepart1+0(10) = '0000000244'.

l_wa_bapiparex-valuepart1+10(6) = '000010'.

l_wa_bapiparex-valuepart1+17(1) = 'X'.

APPEND l_wa_bapiparex TO l_itab_bapiparex.

clear l_wa_bapiparex.

.

CALL FUNCTION 'BAPI_SALESORDER_CHANGE'

EXPORTING

salesdocument = '0000000244'

order_header_in = ORDER_HEADER_IN

order_header_inx = l_wa_ord_header

TABLES

return = return

order_item_in = l_itab_item

order_item_inx = l_itab_itemx

  • schedule_lines = l_itab_schedule

  • schedule_linesx = l_itab_schedulex

extensionin = l_itab_bapiparex.

.

  • IF SY-SUBRC = 0.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

    • EXPORTING

    • WAIT = 'X'

    • IMPORTING

    • RETURN =

  • .

    • ELSE.

    • RAISE ERROR.

    • ENDIF.

I HAVE GONE THROUGH DEBUGGING AND FOUND ALL ARE GOING FINE...ITS UPDATING VBKOM AND VBKOMX STRUCTURE BUT AT LAST ITS NOT UPDATING THE CUSTOM FIELDS

Thanks,

Baidya

2 REPLIES 2

Former Member
0 Kudos

Guys any reply????????

0 Kudos

Sorry guys........this code is correct one.......there is a problem in IDES....i tried in client server its working fine

If anyone is having this type of requirement then copy this program.

thanks,

Baidya