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: 

Can't change vdatu in BAPI_SALESORDER_CHANGE

nsserkan
Explorer
0 Kudos
409

Hello Gurus. I am trying to change vdatu. The values that I changed in the alv edit seem to have not changed in VA03. I could not understand where I am wrong or missing. Can you help me?

Thank you from now.

  DATA: iorder_cond_in    TYPE STANDARD TABLE OF bapicond WITH HEADER LINE,
iorder_cond_inx TYPE STANDARD TABLE OF bapicondx WITH HEADER LINE,
iorder_item_in TYPE STANDARD TABLE OF bapisditm WITH HEADER LINE,
iorder_item_inx LIKE TABLE OF bapisditmx WITH HEADER LINE,
iorder_keys TYPE STANDARD TABLE OF bapisdkey WITH HEADER LINE,
ireturn TYPE STANDARD TABLE OF bapiret2 WITH HEADER LINE,
iorder_number LIKE bapivbeln-vbeln,
ilogic_switch LIKE bapisdls,
iorder_header_inx LIKE bapisdh1x,
lt_schdl TYPE TABLE OF bapischdl WITH HEADER LINE,
lt_schdlx TYPE TABLE OF bapischdlx WITH HEADER LINE.

DATA : gt_index_rows TYPE lvc_t_row WITH HEADER LINE,
ref1 TYPE REF TO cl_gui_alv_grid.

CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
IMPORTING
e_grid = ref1.

CALL METHOD ref1->get_selected_rows
IMPORTING
et_index_rows = gt_index_rows[].

LOOP AT gt_index_rows WHERE index > 0.
READ TABLE gt_siparis INTO gs_siparis INDEX gt_index_rows-index.

IF sy-subrc EQ 0.
iorder_item_inx = 'X'.
ilogic_switch-pricing = 'B'.
iorder_number = gs_siparis-vbeln.

CLEAR iorder_item_in.
iorder_item_in-itm_number = gs_siparis-posnr.
iorder_item_in-purch_date = gs_siparis-vdatu.
* iorder_item_in-bill_date = gs_siparis-edatu.
APPEND iorder_item_in.

CLEAR iorder_item_inx.
iorder_item_inx-itm_number = gs_siparis-posnr.
iorder_item_inx-updateflag = 'U'.
iorder_item_in-purch_date = gs_siparis-vdatu.
* iorder_item_inx-bill_date = gs_siparis-edatu.
APPEND iorder_item_inx.

lt_schdl-date_type = 'D'.
APPEND lt_schdl.
lt_schdlx-updateflag = 'U'.
APPEND lt_schdlx.

CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
EXPORTING
salesdocument = iorder_number
order_header_inx = iorder_header_inx
* logic_switch = ilogic_switch
TABLES
return = ireturn
* order_keys = iorder_keys
order_item_in = iorder_item_in
order_item_inx = iorder_item_inx
* conditions_in = iorder_cond_in
* conditions_inx = iorder_cond_inx.
schedule_lines = lt_schdl
schedule_linesx = lt_schdlx.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'
IMPORTING
return = gs_return2.
ENDIF.
ENDLOOP.
1 ACCEPTED SOLUTION

nsserkan
Explorer
299

Problem solved.

I leave the code below.

  DATA: iorder_cond_in    TYPE STANDARD TABLE OF bapicond WITH HEADER LINE,
iorder_cond_inx TYPE STANDARD TABLE OF bapicondx WITH HEADER LINE,
iorder_item_in TYPE STANDARD TABLE OF bapisditm WITH HEADER LINE,
iorder_item_inx LIKE TABLE OF bapisditmx WITH HEADER LINE,
iorder_keys TYPE STANDARD TABLE OF bapisdkey WITH HEADER LINE,
ireturn TYPE STANDARD TABLE OF bapiret2 WITH HEADER LINE,
iorder_number LIKE bapivbeln-vbeln,
ilogic_switch LIKE bapisdls,
iorder_header_in LIKE bapisdh1 OCCURS 0 WITH HEADER LINE,
iorder_header_inx LIKE bapisdh1x OCCURS 0 WITH HEADER LINE,
lt_schdl TYPE TABLE OF bapischdl WITH HEADER LINE,
lt_schdlx TYPE TABLE OF bapischdlx WITH HEADER LINE.

DATA : gt_index_rows TYPE lvc_t_row WITH HEADER LINE,
ref1 TYPE REF TO cl_gui_alv_grid.

CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
IMPORTING
e_grid = ref1.

CALL METHOD ref1->get_selected_rows
IMPORTING
et_index_rows = gt_index_rows[].

LOOP AT gt_index_rows WHERE index > 0.
READ TABLE gt_siparis INTO gs_siparis INDEX gt_index_rows-index.

IF sy-subrc EQ 0.
iorder_item_inx = 'X'.
ilogic_switch-pricing = 'B'.
iorder_number = gs_siparis-vbeln.

CLEAR iorder_item_in.
iorder_item_in-itm_number = gs_siparis-posnr.
iorder_item_in-po_itm_no = gs_siparis-etenr.
* iorder_item_in-bill_date = gs_siparis-edatu.
APPEND iorder_item_in.

CLEAR iorder_header_in."REQ_DATE_H
iorder_header_in-req_date_h = gs_siparis-vdatu.
APPEND iorder_header_in.

CLEAR iorder_header_inx."REQ_DATE_H.
iorder_header_inx-updateflag = 'U'.
iorder_header_inx-req_date_h = 'X'.
APPEND iorder_header_inx.

CLEAR iorder_item_inx.
iorder_item_inx-itm_number = gs_siparis-posnr.
iorder_item_inx-updateflag = 'U'.
* iorder_item_inx-bill_date = gs_siparis-edatu.
APPEND iorder_item_inx.

lt_schdl-itm_number = gs_siparis-posnr.
lt_schdl-date_type = '1'.
lt_schdl-req_date = gs_siparis-vdatu.
lt_schdl-sched_line = gs_siparis-etenr.
APPEND lt_schdl.
lt_schdlx-itm_number = gs_siparis-posnr.
lt_schdlx-sched_line = gs_siparis-etenr.
lt_schdlx-date_type = 'X'.
lt_schdlx-req_date = 'X'.
lt_schdlx-updateflag = 'U'.
APPEND lt_schdlx.

BREAK eserkan.
CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
EXPORTING
salesdocument = iorder_number
order_header_in = iorder_header_in
order_header_inx = iorder_header_inx
* logic_switch = ilogic_switch
TABLES
return = ireturn
* order_keys = iorder_keys
order_item_in = iorder_item_in
order_item_inx = iorder_item_inx
* conditions_in = iorder_cond_in
* conditions_inx = iorder_cond_inx.
schedule_lines = lt_schdl
schedule_linesx = lt_schdlx.

LOOP AT ireturn WHERE type CA 'EAX'.
EXIT.
ENDLOOP.
IF sy-subrc <> 0.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'
IMPORTING
return = gs_return2.
ELSE.
CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
ENDIF.
ENDIF.
ENDLOOP.
4 REPLIES 4

FredericGirod
Active Contributor
299
iorder_item_inx-purch_date = abap_true. .

0 Kudos
299

I tried but it gets its own standard date. It doesn't read the date I changed.

0 Kudos
299

why do you specify schedule_line ?

try to specify the less possible

nsserkan
Explorer
300

Problem solved.

I leave the code below.

  DATA: iorder_cond_in    TYPE STANDARD TABLE OF bapicond WITH HEADER LINE,
iorder_cond_inx TYPE STANDARD TABLE OF bapicondx WITH HEADER LINE,
iorder_item_in TYPE STANDARD TABLE OF bapisditm WITH HEADER LINE,
iorder_item_inx LIKE TABLE OF bapisditmx WITH HEADER LINE,
iorder_keys TYPE STANDARD TABLE OF bapisdkey WITH HEADER LINE,
ireturn TYPE STANDARD TABLE OF bapiret2 WITH HEADER LINE,
iorder_number LIKE bapivbeln-vbeln,
ilogic_switch LIKE bapisdls,
iorder_header_in LIKE bapisdh1 OCCURS 0 WITH HEADER LINE,
iorder_header_inx LIKE bapisdh1x OCCURS 0 WITH HEADER LINE,
lt_schdl TYPE TABLE OF bapischdl WITH HEADER LINE,
lt_schdlx TYPE TABLE OF bapischdlx WITH HEADER LINE.

DATA : gt_index_rows TYPE lvc_t_row WITH HEADER LINE,
ref1 TYPE REF TO cl_gui_alv_grid.

CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
IMPORTING
e_grid = ref1.

CALL METHOD ref1->get_selected_rows
IMPORTING
et_index_rows = gt_index_rows[].

LOOP AT gt_index_rows WHERE index > 0.
READ TABLE gt_siparis INTO gs_siparis INDEX gt_index_rows-index.

IF sy-subrc EQ 0.
iorder_item_inx = 'X'.
ilogic_switch-pricing = 'B'.
iorder_number = gs_siparis-vbeln.

CLEAR iorder_item_in.
iorder_item_in-itm_number = gs_siparis-posnr.
iorder_item_in-po_itm_no = gs_siparis-etenr.
* iorder_item_in-bill_date = gs_siparis-edatu.
APPEND iorder_item_in.

CLEAR iorder_header_in."REQ_DATE_H
iorder_header_in-req_date_h = gs_siparis-vdatu.
APPEND iorder_header_in.

CLEAR iorder_header_inx."REQ_DATE_H.
iorder_header_inx-updateflag = 'U'.
iorder_header_inx-req_date_h = 'X'.
APPEND iorder_header_inx.

CLEAR iorder_item_inx.
iorder_item_inx-itm_number = gs_siparis-posnr.
iorder_item_inx-updateflag = 'U'.
* iorder_item_inx-bill_date = gs_siparis-edatu.
APPEND iorder_item_inx.

lt_schdl-itm_number = gs_siparis-posnr.
lt_schdl-date_type = '1'.
lt_schdl-req_date = gs_siparis-vdatu.
lt_schdl-sched_line = gs_siparis-etenr.
APPEND lt_schdl.
lt_schdlx-itm_number = gs_siparis-posnr.
lt_schdlx-sched_line = gs_siparis-etenr.
lt_schdlx-date_type = 'X'.
lt_schdlx-req_date = 'X'.
lt_schdlx-updateflag = 'U'.
APPEND lt_schdlx.

BREAK eserkan.
CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
EXPORTING
salesdocument = iorder_number
order_header_in = iorder_header_in
order_header_inx = iorder_header_inx
* logic_switch = ilogic_switch
TABLES
return = ireturn
* order_keys = iorder_keys
order_item_in = iorder_item_in
order_item_inx = iorder_item_inx
* conditions_in = iorder_cond_in
* conditions_inx = iorder_cond_inx.
schedule_lines = lt_schdl
schedule_linesx = lt_schdlx.

LOOP AT ireturn WHERE type CA 'EAX'.
EXIT.
ENDLOOP.
IF sy-subrc <> 0.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'
IMPORTING
return = gs_return2.
ELSE.
CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
ENDIF.
ENDIF.
ENDLOOP.