Skip to Content
0
Former Member
May 08, 2013 at 11:32 AM

schedule line upload using bapi

421 Views

Dear Experts,

We tried to upload schedule lines using bapi_salesorder_change. after executing the bapi in background we are getting message as processed successfully. When we checked schedule agreement the schedules lines are not updated.

Please help.

-


*

*& Report ZBAPI_VA32_TEST

*&

&----


*&

*&

&----


REPORT ZBAPI_VA32_TEST.

DATA: lvbak TYPE vbak.

DATA:

v_vbeln TYPE bapivbeln-vbeln,

v_order_header_inx TYPE bapisdh1x,

i_item TYPE TABLE OF bapisditm WITH HEADER LINE,

i_itemx TYPE TABLE OF bapisditmx WITH HEADER LINE,

i_schedule_lines TYPE TABLE OF bapischdl WITH HEADER LINE,

i_schedule_linesx TYPE TABLE OF bapischdlx WITH HEADER LINE,

i_return TYPE TABLE OF bapiret2 WITH HEADER LINE.

DATA: lposnr TYPE vbap-posnr.

PARAMETERS: pvbeln TYPE vbak-vbeln OBLIGATORY.

v_order_header_inx-updateflag = 'U'.

v_vbeln = pvbeln.

i_item-itm_number = '000010'.

i_itemx-itm_number = '000010'.

i_itemx-updateflag = 'U'.

i_schedule_lines-itm_number = '000010'.

i_schedule_lines-sched_line = '0006'.

i_schedule_lines-req_date = sy-datum.

i_schedule_lines-req_qty = '6'.

i_schedule_linesx-itm_number = '000010'.

i_schedule_linesx-sched_line = '0006'.

i_schedule_linesx-updateflag = 'I'.

i_schedule_linesx-req_date = 'X'.

i_schedule_linesx-req_qty = 'X'.

APPEND i_item.

APPEND i_itemx.

APPEND i_schedule_lines.

APPEND i_schedule_linesx.

CALL FUNCTION 'BAPI_SALESORDER_CHANGE'

EXPORTING

salesdocument = v_vbeln

order_header_inx = v_order_header_inx

TABLES

return = i_return

order_item_in = i_item

order_item_inx = i_itemx

SCHEDULE_LINES = i_schedule_lines

SCHEDULE_LINESX = i_schedule_linesx.

LOOP AT i_return WHERE type = 'A' OR type = 'E'.

EXIT.

ENDLOOP.

IF sy-subrc ne 0.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.

ENDIF.