Application Development and Automation 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: 
Read only

Problem in order change bapi

Former Member
0 Likes
474

Dear Gurus,

I m using bapi BAPI_SALESORDER_CHANGE for quantity change of an order...when passing the import parameters and executing..am getting any error in return parameters as MISSING THE ITEM NUMBER WHEN YOU CHANGE THE SCHEDULE LINE

please tell me what parameters i need to pass to change the quantity of an order..

Thanks in advance

Regards

Raj

2 REPLIES 2
Read only

Former Member
0 Likes
435

Hi,

Pls try to pass the Schdeule line information for the order item number also if you have not passed.

Reward if helpful.

Best Wishes,

Chandralekha

Read only

Former Member
0 Likes
435

Hi Raj,

You try this sample code. Its change the Order Qty.

Note : if no shedulde item number for the SD docu Number

just pass 001 to p_etenr(parameter).

REPORT zchange_test MESSAGE-ID 38.

----


* Selection Screen Definitions *

----


PARAMETERS: p_vbeln TYPE vbap-vbeln OBLIGATORY, "Order Number

p_posnr TYPE vbap-posnr OBLIGATORY, "Order Item

p_etenr TYPE vbep-etenr OBLIGATORY, "Schedule Line

p_reqqty TYPE bapischdl-req_qty OBLIGATORY. " Order Qty

----


* Internal Tables/Structures/Variables for calling BAPI. *

----


DATA: i_hdr TYPE bapisdh1,

i_hdrx TYPE bapisdh1x,

i_ret TYPE bapiret2 OCCURS 0 WITH HEADER LINE,

wa_ret TYPE bapiret2.

DATA: BEGIN OF i_sched OCCURS 10.

INCLUDE STRUCTURE bapischdl.

DATA: END OF i_sched.

DATA: BEGIN OF i_schedx OCCURS 10.

INCLUDE STRUCTURE bapischdlx.

DATA: END OF i_schedx.

----


* START-OF-SELECTION Event *

----


START-OF-SELECTION.

"----


" Initialize internal tables.

"----


REFRESH: i_sched, i_schedx, i_ret.

CLEAR: i_sched, i_schedx, i_ret.

"----


" Fill required ORDER_HEADER_IN data.

"----


i_hdrx-updateflag = 'U'.

"----


" Fill required SCHEDULE_LINES data.

"----


i_sched-itm_number = p_posnr.

i_sched-sched_line = p_etenr.

i_sched-req_qty = p_reqqty.

i_schedx-updateflag = 'U'.

i_schedx-itm_number = p_posnr.

i_schedx-sched_line = p_etenr.

i_schedx-req_qty = 'X'.

APPEND i_sched.

APPEND i_schedx.

CALL FUNCTION 'BAPI_SALESORDER_CHANGE'

EXPORTING

salesdocument = p_vbeln

order_header_in = i_hdr

order_header_inx = i_hdrx

TABLES

return = i_ret

schedule_lines = i_sched

schedule_linesx = i_schedx.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.

LOOP AT i_ret.

WRITE / i_ret-message.

ENDLOOP.

Reward if useful..

Thanks,

Durai.V

Edited by: Durai V on Jul 11, 2008 8:00 AM