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

bapi salesorder

Former Member
0 Likes
479

i have written the below code to update order reason using bapi.

it doesn't work.

can u tell the modifications that are required.

DATA:TBX type TABLE OF BAPISDH1X  WITH HEADER LINE.

DATA:TB type TABLE OF BAPISDH1 WITH HEADER LINE.

PARAMETERS p_vbeln type bapivbeln-vbeln .

DATA:RETURN LIKE BAPIRET2 OCCURS 0 WITH HEADER LINE.

   TB-ord_reason = 'P04'.

APPEND tb.

   TBX-ord_reason = 'X'.

   TBX-UPDATEFLAG = 'U'.

append tbx.

CALL FUNCTION 'BAPI_SALESORDER_CHANGE'

EXPORTING

     SALESDOCUMENT = p_vbeln

     ORDER_HEADER_IN = TB

     ORDER_HEADER_INX = TBX

TABLES

     RETURN = RETURN.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

     EXPORTING

          WAIT = 'X'.

COMMIT WORK.




the error message returned by the bapi is "sales document type ywt not found".

2 REPLIES 2
Read only

Former Member
0 Likes
442

the error message returned by the bapi is "sales document type ywt  is not defined".

Read only

Abhijit74
Active Contributor
0 Likes
442

Hello,

Check TVAK table whether 'YWT' document type exists for not? For that you can go to Tcode OVAZ.

Thanks & Regards,

Abhijit