2007 Jun 04 4:33 PM
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
2007 Jun 04 5:07 PM
BAPI didnt work because u supplied existing PO number. Provide unique PO number and try.
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
2007 Jun 04 5:07 PM
BAPI didnt work because u supplied existing PO number. Provide unique PO number and try.
2007 Jun 04 7:04 PM
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
2007 Jun 04 7:10 PM
2007 Jun 04 7:21 PM
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
2007 Jun 20 2:47 PM
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
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |