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

Help with BAPI_SALESORDER_CHANGE

Former Member
0 Likes
974

Hello,

I'm implementing a button that blocks delivery in sales order, for a Z-Report. For this, I decided to use the 'BAPI_SALESORDER_CHANGE' instead batch input. Here is my code:

DATA: us_order TYPE vbak-vbeln,

l_header_inx TYPE bapisdh1x,

l_header_in TYPE bapisdh1.

...

MOVE: 'U' TO l_header_inx-updateflag,

'X' TO l_header_inx-dlv_block,

'ZL' TO l_header_in-dlv_block.

CALL FUNCTION 'BAPI_SALESORDER_CHANGE'

EXPORTING

salesdocument = us_order

order_header_in = l_header_in

order_header_inx = l_header_inx

TABLES

return = lt_return.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

EXPORTING

wait = 'X'

IMPORTING

return = l_return.

But the 'lt_return' variable gives the following:

Purchase order number in document number: 25972 already exists

Sales document 0000025972 was not changed

Then i decided to make the delivery block by myself, with transaction VA02. I was expecting the same message that the bapi returns, but for my surprise the change was made without problems. So, I imagine that a batch input could work too.

But my question is, why bapi didn't work? I want to finish this requirement with bapi instead a batch input.

Thanks

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
920

BAPI didnt work because u supplied existing PO number. Provide unique PO number and try.

BAPI didnt work because u supplied existing PO number. Provide unique PO number and try.

5 REPLIES 5
Read only

Former Member
0 Likes
921

BAPI didnt work because u supplied existing PO number. Provide unique PO number and try.

Read only

0 Likes
920

I do pass the PO number... you just see the important part of the code. Just check the error message: PO '25972'

Message was edited by:

Julio Almeida

Read only

0 Likes
920

Can you show us all of your code?

Read only

0 Likes
920

ok...

start-of-selection.

perform f_block using '0000025972'.

----


  • Form f_block *

----


FORM f_block USING value(us_orden) TYPE vbak-vbeln.

DATA: l_header_inx TYPE bapisdh1x,

l_header_in TYPE bapisdh1,

lt_return TYPE STANDARD TABLE OF bapiret2,

l_return TYPE bapiret2.

MOVE: 'U' TO l_header_inx-updateflag,

'X' TO l_header_inx-dlv_block,

'ZL' TO l_header_in-dlv_block.

CALL FUNCTION 'BAPI_SALESORDER_CHANGE'

EXPORTING

salesdocument = us_orden

order_header_in = l_header_in

order_header_inx = l_header_inx

TABLES

return = lt_return.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

EXPORTING

wait = 'X'

IMPORTING

return = l_return.

ENDFORM. " f_automatic_schedule_all

Read only

Former Member
0 Likes
920

hi geeks..

I am a fresher and i have to use this bapi to update quantity and post the BAPI

with error log...

Can anyone pls let me know ...how to do it....with example structure????

Thanks in Advance