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

Using BAPI_SALESORDER_CHANGE ,

Former Member
0 Likes
497

Hi gurus,

My requirement is for line item add reason for rejection and create a new line item with the remaining Qty.( becos changing the Plant)

plant is chnaging, reason for jejection is also ading,

a new line item is also adding

but for that qty is not adding .. i am not getting an yerror messages from BAPI

can you please help me..

adding a new line itm ,,

using BAPI_SALESORDER_CHANGE

 xorder_items_in-itm_number = w_posnr.
      xorder_items_in-material = wa_final-matnr.
      xorder_items_in-plant = 'PT02'."wa_final-PLANT.
      xorder_items_in-target_qty = wa_final-kwmeng - wa_final-rfmng.
      xorder_items_in-target_qu = 'EA'.
      APPEND xorder_items_in.
*
      xorder_item_inx-itm_number = w_posnr.
      xorder_item_inx-material = 'X'.
      xorder_item_inx-plant = 'X'.
      xorder_item_inx-target_qty = 'X'.
      xorder_item_inx-target_qu = 'X'.
      xorder_item_inx-updateflag = 'I'.
      APPEND xorder_item_inx.

      CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
      EXPORTING
        salesdocument               = w_vbeln
        order_header_in             = wa_head
        order_header_inx            = wa_headx

      TABLES
        return                      = t_return
       order_item_in               = xorder_items_in
       order_item_inx              = xorder_item_inx
              .
      IF sy-subrc IS INITIAL.
        CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.

        MOVE wa_final-vbeln TO wa-vbeln.
        MOVE w_posnr TO wa-posnr.
        wa-message = 'New LineItem Added Successfully'.
        APPEND wa TO it.
        CLEAR wa.

      ELSE.

        MOVE wa_final-vbeln TO wa-vbeln.
        MOVE w_posnr TO wa-posnr.
        LOOP AT t_return INTO wa_return
                         WHERE type EQ c_e.
          wa-message = wa_return-message.
          APPEND wa TO it.
          CLEAR wa.
        ENDLOOP.
      ENDIF.

Edited by: kishan P on Sep 4, 2010 9:55 AM

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
454

Hi,

I have also faced similar problem but it was while creating Sales Order using 'BAPI_SALESORDER_CREATEFROMDAT2'. You have to enter the quantity in BAPISDITM-TARGET_QTY then only system will update the same.

Hope this will help.

Thanks & Regards,

Rock.

2 REPLIES 2
Read only

Former Member
0 Likes
454

Hi,

To Update the sales order quantity, You have to pass values to the structure "SCHEDULE_LINES" & "SCHEDULE_LINESX".

Edit : SDN thread [BAPI_SALESORDER_CHANGE |; may be helpful

Regards

Vinod

Edited by: Vinod Kumar on Sep 4, 2010 10:09 AM

Read only

Former Member
0 Likes
455

Hi,

I have also faced similar problem but it was while creating Sales Order using 'BAPI_SALESORDER_CREATEFROMDAT2'. You have to enter the quantity in BAPISDITM-TARGET_QTY then only system will update the same.

Hope this will help.

Thanks & Regards,

Rock.