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_CHANGE

Former Member
0 Likes
557

hi i am using the following code for BAPI to change the SO but this is not working

i want to change the Reason of Rejection field in the SO.

kindly check the below code.

the return messages shows the SO is changed but its not doing that..



REPORT zbapi NO STANDARD PAGE HEADING LINE-SIZE 255.

DATA wa LIKE bapisdh1x.
DATA i_item LIKE bapisditm OCCURS 0 WITH HEADER LINE.
DATA i_item_x LIKE bapisditmx OCCURS 0 WITH HEADER LINE.
DATA i_return LIKE bapiret2 OCCURS 0 WITH HEADER LINE.

BREAK-POINT.
wa-updateflag = 'U'.

i_item-itm_number = '000030'.
i_item-reason_rej = 'A5'.
APPEND i_item.


i_item_x-itm_number = '000030'.
i_item_x-updateflag = 'U'.
i_item_x-reason_rej = 'X'.
APPEND i_item_x.

*
CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
  EXPORTING
    salesdocument               = '0205000665'
*   ORDER_HEADER_IN             =
    order_header_inx            = wa
*   SIMULATION                  =
*   BEHAVE_WHEN_ERROR           = ' '
*   INT_NUMBER_ASSIGNMENT       = ' '
*   LOGIC_SWITCH                =
  TABLES
    return                      = i_return
   order_item_in               = i_item
   order_item_inx              = i_item_x
*   PARTNERS                    =
*   PARTNERCHANGES              =
*   PARTNERADDRESSES            =
*   ORDER_CFGS_REF              =
*   ORDER_CFGS_INST             =
*   ORDER_CFGS_PART_OF          =
*   ORDER_CFGS_VALUE            =
*   ORDER_CFGS_BLOB             =
*   ORDER_CFGS_VK               =
*   ORDER_CFGS_REFINST          =
*   SCHEDULE_LINES              =
*   SCHEDULE_LINESX             =
*   ORDER_TEXT                  =
*   ORDER_KEYS                  =
*   CONDITIONS_IN               =
*   CONDITIONS_INX              =
*   EXTENSIONIN                 =
          .

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
*           EXPORTING
*             WAIT          =
*           IMPORTING
*             RETURN        =
          .

abhishek

Message was edited by:

Abhishek Suppal

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
520

Hi,

Your code looks good..Try add one zero in front of the order number

salesdocument = '<b>0205000665</b>'

Thanks,

Naren

hi i am using the following code for BAPI to change the SO but this is not working

i want to change the Reason of Rejection field in the SO.

kindly check the below code.

the return messages shows the SO is changed but its not doing that..



REPORT zbapi NO STANDARD PAGE HEADING LINE-SIZE 255.

DATA wa LIKE bapisdh1x.
DATA i_item LIKE bapisditm OCCURS 0 WITH HEADER LINE.
DATA i_item_x LIKE bapisditmx OCCURS 0 WITH HEADER LINE.
DATA i_return LIKE bapiret2 OCCURS 0 WITH HEADER LINE.

BREAK-POINT.
wa-updateflag = 'U'.

i_item-itm_number = '000030'.
i_item-reason_rej = 'A5'.
APPEND i_item.


i_item_x-itm_number = '000030'.
i_item_x-updateflag = 'U'.
i_item_x-reason_rej = 'X'.
APPEND i_item_x.

*
CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
  EXPORTING
    salesdocument               = '0205000665'
*   ORDER_HEADER_IN             =
    order_header_inx            = wa
*   SIMULATION                  =
*   BEHAVE_WHEN_ERROR           = ' '
*   INT_NUMBER_ASSIGNMENT       = ' '
*   LOGIC_SWITCH                =
  TABLES
    return                      = i_return
   order_item_in               = i_item
   order_item_inx              = i_item_x
*   PARTNERS                    =
*   PARTNERCHANGES              =
*   PARTNERADDRESSES            =
*   ORDER_CFGS_REF              =
*   ORDER_CFGS_INST             =
*   ORDER_CFGS_PART_OF          =
*   ORDER_CFGS_VALUE            =
*   ORDER_CFGS_BLOB             =
*   ORDER_CFGS_VK               =
*   ORDER_CFGS_REFINST          =
*   SCHEDULE_LINES              =
*   SCHEDULE_LINESX             =
*   ORDER_TEXT                  =
*   ORDER_KEYS                  =
*   CONDITIONS_IN               =
*   CONDITIONS_INX              =
*   EXTENSIONIN                 =
          .

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
*           EXPORTING
*             WAIT          =
*           IMPORTING
*             RETURN        =
          .

abhishek

Message was edited by:

Abhishek Suppal

3 REPLIES 3
Read only

Former Member
0 Likes
520

Hi,

Instead of giving the SO number in a string, store it in a variable and try passing it to the FM.

Is there any preceding zeroes in the SO number?

Regards

Subramanian

Read only

Former Member
0 Likes
521

Hi,

Your code looks good..Try add one zero in front of the order number

salesdocument = '<b>0205000665</b>'

Thanks,

Naren

Read only

Former Member
0 Likes
520

Are you getting any error message in the return table?

Thanks & Regards,

Govind.