Regarding BAPI_SALESORDER_CHANGE

Hi All,
I am trying to add line items in the Sales Order using BAPI.
System is updating only 1 line item and for remaining line items system is giving error saying that 'SO is currently being proceed by user id (who ever running that program) but no where that SO is in process. '
Please Help..........
Thanx in Advance.......
Rgds,
Shiv

Hi,
If that is the case.I think there might be one of the session.please delete that session and reprocess it.
Regards,
Rahul

Similar Messages

  • BAPI Function modules for sales

    Hi All,
    Pls give the BAPI FM for following purposes.
    1. Sales Order Change- Release Billing block
    2. Billing creation- with ref. order.
    Regards,
    Ashwin

    BAPI_SALESORDER_CHANGE - Sales order: Change Sales Order
    Check these threads for related information.
    BAPI_SALESORDER_CHANGE
    regarding bapi_salesorder_change
    You can crete Sales order with Multiple billing doc reference using this BAPI. BAPI_SALESORDER_CREATEFROMDAT2
    Reward points if useful.

  • Regarding adding new pricing condition using BAPI_SALESORDER_CHANGE

    Hi All,
    I am trying to add a new pricing condition at item level using Bapi_salesorder_change, but it is not getting updated. I am also doing Bapi_transaction_commit as the next step.
    I am passing the sales order number and the Update flag in the header. Tried passing G as the logic switch-pricing and also tried with logic_switch-COND_HANDL = X.
    I am passing the data in structure CONDITIONS_IN with the value for item numebr, condition step number, condition count , condition value, currency and unit.
    Also I am passing data in CONDITIONS_INX with the required flags set and update flag as 'I'.
    The output says that order is changed and saved successfully, but the condition type is not there when i check the pricing coinditions inside the order at item level.Please help.
    Regards,
    Kaustubh B. Khasnis

    Hi,
    In the condition tab..
    Press the determination analysis button..
    There it will show the why the pricing condition type is not added..
    Thanks,
    Naren

  • Regarding contract sales tab value not updating into the standard VA42 t-co

    Hello Experts!!!
    How to add screen shots in sdn...
    so that i can add my screen shots in SDN
    The below shown screen shot is the output of our Zprogram.The table field name:VBKD-BZIRK, where is has been marked as red colur in box.
    While dropping the from Source contract to Target Contract, where the value is not picking to the target contract and finally it is not displaying in the Standard VA42 transaction
         Input value
    That same field should come in the final alv output and also include in the va43 transaction sales tab( sales district)
    This value must then be inserted into every document which is being transferred.
    The above input field dragged from Source Contract to Target Contract, the picked value should reflected in the VA42 transation , but it is not effecting.
    Regards,
    Preethi...

    i already used same But it's not working
    s_order_header_inx-updateflag = 'U'.
    Line items
      REFRESH: i_order_item_in, i_order_item_inx.
      LOOP AT t_data INTO wa_data.
        LOOP AT t_data_item INTO wa_data_item WHERE vbeln = wa_data-vbeln. .
    BAPISDITM
          i_order_item_in-itm_number = wa_data_item-posnr.
          i_order_item_in-profit_ctr = wa_data_item-profit_ctr.
    BAPISDITMX
          i_order_item_inx-itm_number = wa_data_item-posnr.
          i_order_item_inx-updateflag = 'U'.
          i_order_item_inx-profit_ctr = 'X'.
          APPEND: i_order_item_in, i_order_item_inx.
        ENDLOOP.
        CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
          EXPORTING
            input  = wa_data-vbeln
          IMPORTING
            output = wa_data-vbeln.
        CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
          EXPORTING
            salesdocument     = wa_data-vbeln
            order_header_in   = s_order_header_in
            order_header_inx  = s_order_header_inx
            behave_when_error = 'P'
          TABLES
            return            = it_return
            order_item_in     = i_order_item_in
            order_item_inx    = i_order_item_inx.

  • Schedule lines creation with BAPI_SALESORDER_CHANGE

    Dear All,
    1. I'm trying to create a new Schedule Lines to an already existing Scheduling Agreement.
    2. For this, I'm using the BAPI --> BAPI_SALESORDER_CHANGE.
    3. This BAPI returns me a message saying that the Schedule line processed successfully.
    4. When I check the VBEP Table with the Scheduling Agreement number, I'm able to see the newly created schedule line.
    5. But, when I see the Transaction VA33, I'm not able to see the schedule lines.
    I checked in SDN and OSS notes. I found 1647069 which says to pass the line number and Item number which I'm already doing it.
    Can any one help me out ?
    Regards,
    Deepu.K

    I verified in my system that the below should work. Here, I am inserting a new schedule 0002 for item 10 with qty 1 and another date.
    Of course, you should ensure that there is sufficient quantity that is not yet confirmed by existing schedule lines.
    BAPI_SALESORDER_CHANGE
    SALESDOCUMENT = '0011827125'
    ORDER_HEADER_INX
               UPDATEFLAG = 'U'
    ORDER_ITEM_IN
               ITM_NUMBER = '000010'
    ORDER_ITEM_INX
               ITM_NUMBER = '000010'
               UPDATEFLAG = 'U'
    SCHEDULE_LINES
               ITM_NUMBER = '000010'
               SCHED_LINE = '0002'
               REQ_DATE   = '20120104'
               REQ_QTY = '1'
    SCHEDULE_LINESX
               ITM_NUMBER = '000010'
               SCHED_LINE = '0002'
               UPDATEFLAG = 'I'
               REQ_DATE   = 'X'
               REQ_QTY = 'X'.

  • BAPI_SALESORDER_CHANGE schedule_lines

    Hi experts.
    I'm doing a simple order update, using FM BAPI_SALESORDER_CHANGE.
    The goal is to change header data (with order_header_in and order_header_inx structures), schedule lines data (with schedule_lines and schedule_linesx structures) and  text data (with order_text structure).
    The problem is that header and text data is actually changed, but schedulle data doesn't.
    Can anyone help?
    Best regards.
    Valter Oliveira.
    SAMPLE CODE:
    HEADER
        CLEAR: wa_header_in.
        wa_header_in-po_dat_s   = wa_pub-data.
        wa_header_in-ref_1      = wa_pub-diario.
        wa_header_in-ref_1_s    = wa_pub-suplemento.
        wa_header_in-dlv_block  = space.
        CLEAR: wa_header_inx.
        wa_header_inx-updateflag  = 'U'.
        wa_header_inx-po_dat_s    = 'X'.
        wa_header_inx-ref_1       = 'X'.
        wa_header_inx-ref_1_s     = 'X'.
        wa_header_inx-dlv_block   = 'X'.
    SCHEDULE
        SELECT posnr FROM vbap
          INTO (vl_posnr)
         WHERE vbeln = wa_pub-vbeln.
          SELECT etenr FROM vbep
            INTO (vl_etenr)
           WHERE vbeln = wa_pub-vbeln
             AND posnr = vl_posnr.
            ti_sched-itm_number = vl_posnr.
            ti_sched-sched_line = vl_etenr.
            ti_sched-req_dlv_bl = space.
            ti_sched-req_date = wa_pub-data.
            ti_sched-sched_type = 'CN'.
            ti_schedx-itm_number = vl_posnr.
            ti_schedx-sched_line = vl_etenr.
            ti_schedx-req_dlv_bl = 'X'.
            ti_schedx-sched_type = 'X'.
            ti_schedx-req_date = 'X'.
            APPEND ti_sched. APPEND ti_schedx.
          ENDSELECT.
        ENDSELECT.
    CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
          EXPORTING
            salesdocument    = wa_pub-vbeln
            order_header_in  = wa_header_in
            order_header_inx = wa_header_inx
          TABLES
            schedule_lines   = ti_sched
            schedule_linesx  = ti_schedx
            order_text       = ti_texts
            return           = ti_ret.

    Hi experts.
    I'm doing a simple order update, using FM BAPI_SALESORDER_CHANGE.
    The goal is to change header data (with order_header_in and order_header_inx structures), schedule lines data (with schedule_lines and schedule_linesx structures) and  text data (with order_text structure).
    The problem is that header and text data is actually changed, but schedulle data doesn't.
    Can anyone help?
    Best regards.
    Valter Oliveira.
    SAMPLE CODE:
    HEADER
        CLEAR: wa_header_in.
        wa_header_in-po_dat_s   = wa_pub-data.
        wa_header_in-ref_1      = wa_pub-diario.
        wa_header_in-ref_1_s    = wa_pub-suplemento.
        wa_header_in-dlv_block  = space.
        CLEAR: wa_header_inx.
        wa_header_inx-updateflag  = 'U'.
        wa_header_inx-po_dat_s    = 'X'.
        wa_header_inx-ref_1       = 'X'.
        wa_header_inx-ref_1_s     = 'X'.
        wa_header_inx-dlv_block   = 'X'.
    SCHEDULE
        SELECT posnr FROM vbap
          INTO (vl_posnr)
         WHERE vbeln = wa_pub-vbeln.
          SELECT etenr FROM vbep
            INTO (vl_etenr)
           WHERE vbeln = wa_pub-vbeln
             AND posnr = vl_posnr.
            ti_sched-itm_number = vl_posnr.
            ti_sched-sched_line = vl_etenr.
            ti_sched-req_dlv_bl = space.
            ti_sched-req_date = wa_pub-data.
            ti_sched-sched_type = 'CN'.
            ti_schedx-itm_number = vl_posnr.
            ti_schedx-sched_line = vl_etenr.
            ti_schedx-req_dlv_bl = 'X'.
            ti_schedx-sched_type = 'X'.
            ti_schedx-req_date = 'X'.
            APPEND ti_sched. APPEND ti_schedx.
          ENDSELECT.
        ENDSELECT.
    CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
          EXPORTING
            salesdocument    = wa_pub-vbeln
            order_header_in  = wa_header_in
            order_header_inx = wa_header_inx
          TABLES
            schedule_lines   = ti_sched
            schedule_linesx  = ti_schedx
            order_text       = ti_texts
            return           = ti_ret.

  • How to pass Itab to "BAPI_SALESORDER_CHANGE"

    Requirment : We cancel sales order that have been created but not fulfilled within 7 days.
    At present, we do this manually.  Can we configure to have the system auto cancel the sales order
    after the said period? 
    selection screen
    u2022     Sales organization (P_VKORG like ZSD_REJECT-VKORG)
    u2022     Sales office (S_VKBUR for ZSD_REJECT-VKBUR)
    u2022     Plant (S_WERKS for ZSD_REJECT-WERKS)
    u2022     Sales order type (S_AUART for ZSD_REJECT-AUART)
    u2022     Sales order no. (S_VBELN for ZSD_REJECT-VBELN)
    u2022     Customer no. (S_KUNNR for ZSD_REJECT-KUNNR)
    u2022     Rejection date (S_REJDTE for ZSD_REJECT-REJDATE)
    Report format/columns should be as follows:
    1.     Sales organization (ZSD_REJECT-VKORG)
    2.     Sales office (ZSD_REJECT-VKBUR)
    3.     Plant (ZSD_REJECT-WERKS)
    4.     Customer no. (ZSD_REJECT-KUNNR)
    5.     Customer name (KNA1-NAME1)
    6.     Sales order no. (ZSD_REJECT-VBELN)
    7.     Sales order item (ZSD_REJECT-POSNR)
    8.     Material no. (VBAP-MATNR)
    9.     Material description (VBAP-ARKTX)
    10.     Order quantity (VBAP-KWMENG)
    11.     Rejected quantity (ZSD_REJECT-REJQTY)
    12.     Unit of measure (VBAP-VRKME)
    13.     Rejected net value (ZSD_REJECT-REJVAL)
    14.     Currency (VBAK-WAERK)
    15.     Rejection date (ZSD_REJECT-REJDATE)
    16.     Rejection time (ZSD_REJECT-REJTIME)
    17.     Rejection user (ZSD_REJECT-REJUSER)
    Program : I have created one report & calling bapi BAPI_SALESORDER_CHANGE
    TYPES: BEGIN OF t_tab,
             vkorg   TYPE zsd_reject-vkorg ,
             vkbur   TYPE zsd_reject-vkbur ,
             auart   TYPE zsd_reject-auart ,
           END OF t_tab.
    TYPES: BEGIN OF t_vbak,
            vbeln   TYPE vbak-vbeln ,
            erdat   TYPE vbak-erdat ,
            waerk   TYPE vbak-waerk,
            vbtyp   TYPE vbak-vbtyp,
            auart   TYPE vbak-auart,
            vkorg   TYPE vbak-vkorg ,
            vkbur   TYPE vbak-vkbur ,
            kunnr   TYPE vbak-kunnr ,
            cmfre   TYPE vbak-cmfre ,
           gbsta   type vpup-gbsta,
            costa   TYPE vbuk-costa ,
            fkstk   TYPE vbuk-fkstk,
          END OF t_vbak.
    TYPES: BEGIN OF t_data,
            vbeln   TYPE vbak-vbeln ,
            waerk   TYPE vbak-waerk,
            auart   TYPE vbak-auart,
            vkorg   TYPE vbak-vkorg ,
            vkbur   TYPE vbak-vkbur ,
            kunnr   TYPE vbak-kunnr ,
            cmfre   TYPE vbak-cmfre ,
          END OF t_data.
    TYPES: BEGIN OF t_vbap,
             matnr   TYPE vbap-matnr ,
             vbeln   TYPE vbap-vbeln ,
             posnr   TYPE vbap-posnr,
             arktx   TYPE vbap-arktx ,
             pstyv   TYPE vbap-pstyv,
             abgru   TYPE vbap-abgru,
             kwmeng  TYPE vbap-kwmeng,
             werks   TYPE vbap-werks ,
             END OF t_vbap.
    TABLES                                                               *
    TABLES : zsd_reject.
    INTERNAL TABLES, STRUCTURES & WORK AREAS                             *
    DATA: it_vbak  TYPE STANDARD TABLE OF  t_vbak WITH HEADER LINE,
          it_data  TYPE STANDARD TABLE OF t_data WITH HEADER LINE ,
          it_vbap  TYPE STANDARD TABLE OF t_vbap ,
          wa_vbak  TYPE t_vbak ,
          wa_vbap  TYPE t_vbap ,
          wa_data  TYPE t_data.
    PARAMETERS & SELECT-OPTIONS                                         *
    DUE TO AN SAP LIMITATION WITH CREATING / CHANGING VARIANTS,
    selection screen fields over 45 characters in length should be avoided
    SELECTION-SCREEN: BEGIN OF BLOCK a01 WITH FRAME TITLE text-001.
    PARAMETERS: p_vkorg LIKE zsd_reject-vkorg.
    SELECT-OPTIONS: s_vkbur FOR zsd_reject-vkbur,
                    s_werks FOR zsd_reject-werks,
                    s_auart FOR zsd_reject-auart,
                    s_vbeln FOR zsd_reject-vbeln,
                    s_kunnr FOR zsd_reject-kunnr,
                    s_rejdte FOR zsd_reject-rejdate.
    SELECTION-SCREEN: END OF BLOCK a01.
    DATA : p_days TYPE i VALUE 7,
           l_checkdate LIKE  sy-datum.
    START-OF-SELECTION.
      l_checkdate = sy-datum - p_days.
      SELECT vbak~vbeln
             vbak~erdat
             vbak~waerk
             vbak~vbtyp
             vbak~auart
             vbak~vkorg
             vbak~vkbur
             vbak~kunnr
             vbak~cmfre
           vbup~gbsta
             vbuk~costa
             vbuk~fkstk
      INTO  TABLE it_vbak
      FROM vbak INNER JOIN vbuk
      ON  vbakvbeln = vbukvbeln
      WHERE vbak~vkorg = p_vkorg
      AND vbak~vkbur IN s_vkbur
      AND vbak~auart IN s_auart
      AND  vbak~vbtyp = 'C'
      AND vbuk~gbstk NE 'C'.
      Requirment :
    This checking is only for those order were previously blocked and has been released, which means credit release date not equal to 00.00.0000 and hence program will check rejection logic based on credit release date vs system date > 7 calendar days.  For those orders which holding credit release date equals to 00.00.0000 will go through rejection checking
    based on order creation date vs system date > 7 calendar days respectively.
    LOOP AT it_vbak INTO wa_vbak.
        IF NOT wa_vbak-cmfre IS INITIAL.
          IF wa_vbak-cmfre > l_checkdate.
            DELETE it_vbak FROM wa_vbak.
          ENDIF.
        ELSE.
          IF wa_vbak-erdat > l_checkdate.
            DELETE it_vbak FROM wa_vbak.
          ENDIF.
        ENDIF.
      ENDLOOP.
      SELECT vbapmatnr vbapvbeln vbapposnr vbaparktx vbap~pstyv
      vbapabgru vbapkwmeng vbap~werks INTO TABLE it_vbap
      FROM vbap INNER JOIN vbup ON
      vbapvbeln = vbupvbeln AND vbapposnr = vbupposnr
      FOR ALL entries
      IN it_vbak WHERE vbap~vbeln = it_vbak-vbeln AND
      gbsta NE 'C'.
    I have taken the records in two internal table for header & item it_vbak & it_vbap
    now I need to call the BAPI_SALESORDER_CHANGE and pass the internal table to Bapi .
    Can anyone please let me know how to pass this into Bapi?
    CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
      EXPORTING
        salesdocument               =
      ORDER_HEADER_IN             =
        order_header_inx            =
      SIMULATION                  =
      BEHAVE_WHEN_ERROR           = ' '
      INT_NUMBER_ASSIGNMENT       = ' '
      LOGIC_SWITCH                =
    tables
       return                      =
      ORDER_ITEM_IN               =
      ORDER_ITEM_INX              =
      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                 =
    Thanks in advance
    Regards
    Rahul

    Hi,
    I am trying to cancel the  sales order that have been created but not fulfilled within 7 days.
    If this condition is true dump is coming (when I am trying to delete the records from internal table)
    if wa_vbak-erdat > l_checkdate.
              delete it_vbak from wa_vbak.
            endif.
    Error analysis
    The program attempted to interp 70000200KL " as a number, but since the value contravenes the
    this was not possible.
    types: begin of t_vbak,
            vbeln   type vbak-vbeln ,
            erdat   type vbak-erdat ,
            waerk   type vbak-waerk,
            vbtyp   type vbak-vbtyp,
            auart   type vbak-auart,
            vkorg   type vbak-vkorg ,
            vtweg   type vbak-vtweg,
            spart   type vbak-spart,
            vkbur   type vbak-vkbur ,
            kunnr   type vbak-kunnr ,
            cmfre   type vbak-cmfre ,
           gbsta   type vpup-gbsta,
            costa   type vbuk-costa ,
            fkstk   type vbuk-fkstk,
            end of t_vbak.
    data : p_days type i value 7,
           l_checkdate like  sy-datum.
    DATA: it_vbak  TYPE STANDARD TABLE OF  t_vbak WITH HEADER LINE,
          it_data  TYPE STANDARD TABLE OF t_data WITH HEADER LINE ,
    start-of-selection.
    l_checkdate = sy-datum - p_days.
    select vbak~vbeln
             vbak~erdat
             vbak~waerk
             vbak~vbtyp
             vbak~auart
             vbak~vkorg
             vbak~vtweg
             vbak~spart
             vbak~vkbur
             vbak~kunnr
             vbak~cmfre
           vbup~gbsta
             vbuk~costa
             vbuk~fkstk
      into  corresponding fields of  table it_vbak
      from vbak inner join vbuk
      on  vbakvbeln = vbukvbeln
      where vbak~vkorg = p_vkorg
      and vbak~vkbur in s_vkbur
      and vbak~auart in s_auart
      and  vbak~vbtyp = 'C'
      and vbuk~gbstk ne 'C'
      and vbak~vbeln = '0000003549'.
      sort it_vbak by vbeln.
      if not it_vbak[] is initial.
        loop at it_vbak into wa_vbak.
          if not wa_vbak-cmfre is initial.
            if wa_vbak-cmfre > l_checkdate.
              delete it_vbak from wa_vbak.
            endif.
          else.
    ******Error (short dump here  if condition true )***************************
            if wa_vbak-erdat > l_checkdate.
              delete it_vbak from wa_vbak.
            endif.
          endif.
        endloop.
      endif.
    Regards
    Rahul

  • Update ship-to partner in sales order using BAPI_SALESORDER_CHANGE

    Dear all,
    We are trying to update the ship-to partner in a sales order using BAPI_SALESORDER_CHANGE. This is working correctly for most of our orders, so we do fill the BAPI correctly. However for some of our orders on item level a different payer is specified than on header level. However in that case the BAPI will not update the ship-to partner, but given an error message VPD 034 u2018The document must contain the same credit control areas for all payersu2019. Debugging already learned that actually the message is given not because of different credit control areas, but due to the fact that the payers and therefore the credit customers are different (although in the same credit control areas). For this reason we can not update the ship-to party of a large number of our sales orders with this BAPI. Actually we have 2 questions:
    ·         Has somebody experienced the same issue and did you manage to solve it somehow, so the BAPI could be used for this purpose of updating partner data?
    ·         Do you know other ways of updating the partners or partner address of an existing sales order in the background?
    Thanks in advance for your assistance.
    Regards,
    Satish.

    It was caused by standard SAP.

  • Unable to update sales order unsing the BAPI 'BAPI_SALESORDER_CHANGE'

    Hi All,
    I am unable to update the payment method field for some sales orders using the bapi 'BAPI_SALESORDER_CHANGE'. I am getting the reason in the table RETURN as 'Field 'ZLSCH' cannot be changed, VBAPKOM 000050  ready for input'.
    Could anyone throw some light on it.
    Thanks a ton.
    Regards,
    Santosh Kotra.

    Hi
    Without reversing invoice we can't update price and this is standard bevaior which is logical too. For your scenario I am wondering why would you want to change price for a line item or order which is alrady invoiced and posted to FI. What difference would it make to change price in sale order when this has already been posted in FI?
    Thank$

  • Change sold-to party BAPI_SALESORDER_CHANGE

    Hello,
    Does anyone know how to change partner function AG (sold-to-party) in a sales order header from within ABAP code ?
    I'm using BAPI_SALESORDER_CHANGE function module to change partner functions. It works well for all other partner functions, but for the AG ("sold-to-party") function it yields a message saying that changing AG function is impossible.
    Although changing "sold-to-party" partner function is disabled in user interface (VA02 transaction -> order header details), but the user DOES have the possibility to change "sold-to-party": he can change field KUNNR in main screen of transaction VA02 (this field is mapped to VBAK-KUNNR) - after changing it, the AG partner function in header details changes to the value set in it. Does anyone have an idea how to achieve the same from ABAP code ?
    Regards,
    Flavio.

    REPORT  ZSALESORDER_CHANGE MESSAGE-ID 38.
    Selection Screen Definitions *
    PARAMETERS: p_vbeln TYPE vbap-vbeln OBLIGATORY, "Order Number
    p_posnr TYPE vbap-posnr OBLIGATORY, "Order Item
    p_etenr TYPE vbep-etenr OBLIGATORY, "Schedule Line
    p_reqqty TYPE bapischdl-req_qty OBLIGATORY. " Order Qty
    Internal Tables/Structures/Variables for calling BAPI. *
    DATA: i_hdr TYPE bapisdh1,
    i_hdrx TYPE bapisdh1x,
    i_ret TYPE bapiret2 OCCURS 0 WITH HEADER LINE,
    wa_ret TYPE bapiret2.
    DATA: BEGIN OF i_sched OCCURS 10.
    INCLUDE STRUCTURE bapischdl.
    DATA: END OF i_sched.
    DATA: BEGIN OF i_schedx OCCURS 10.
    INCLUDE STRUCTURE bapischdlx.
    DATA: END OF i_schedx.
    START-OF-SELECTION Event *
    START-OF-SELECTION.
    *" Initialize internal tables.
    REFRESH: i_sched, i_schedx, i_ret.
    CLEAR: i_sched, i_schedx, i_ret.
    *" Fill required ORDER_HEADER_IN data.
    i_hdrx-updateflag = 'U'.
    *" Fill required SCHEDULE_LINES data.
    i_sched-itm_number = p_posnr.
    i_sched-sched_line = p_etenr.
    i_sched-req_qty = p_reqqty.
    i_schedx-updateflag = 'U'.
    i_schedx-itm_number = p_posnr.
    i_schedx-sched_line = p_etenr.
    i_schedx-req_qty = 'X'.
    APPEND i_sched.
    APPEND i_schedx.
    CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
    EXPORTING
    salesdocument = p_vbeln
    order_header_in = i_hdr
    order_header_inx = i_hdrx
    TABLES
    return = i_ret
    schedule_lines = i_sched
    schedule_linesx = i_schedx.
    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
    LOOP AT i_ret.
    WRITE / i_ret-message.
    ENDLOOP.

  • Error in BAPI_SALESORDER_CHANGE

    I need to post the changed incoterm value by using BAPI_SALESORDER_CHANGE. But everytime I used to get the error:
    Field header_inx-updateflag is not an input field.
    I have written the below mentioned code : 
    *& Report  ZBAPI1                                                      *
    REPORT  ZBAPI1                                  .
    TABLES: VBBE.
    DATA: BEGIN OF ITAB OCCURS 0,
          VBELN LIKE VBBE-VBELN,
          POSNR LIKE VBBE-POSNR,
          END OF ITAB.
    DATA: WA_ITAB LIKE LINE OF ITAB.
    DATA:BEGIN OF I_VBELN OCCURS 0.
            INCLUDE STRUCTURE BAPIVBELN.
    DATA:END OF I_VBELN.
    DATA: WA_I_VBELN LIKE LINE OF I_VBELN.
    DATA:BEGIN OF I_SHEADER OCCURS 0.
            INCLUDE STRUCTURE BAPISDH1X.
    DATA:END OF I_SHEADER.
    DATA: WA_I_SHEADER LIKE LINE OF I_SHEADER.
    DATA:BEGIN OF ZRETURN OCCURS 0.
            INCLUDE STRUCTURE BAPIRET2.
    DATA:END OF ZRETURN.
    DATA: WA_ZRETURN LIKE LINE OF ZRETURN.
    DATA:BEGIN OF I_SITEM OCCURS 0.
            INCLUDE STRUCTURE BAPISDITM.
    DATA:END OF I_SITEM.
    DATA: WA_I_SITEM LIKE LINE OF I_SITEM.
    DATA:BEGIN OF I_SITEMX OCCURS 0.
            INCLUDE STRUCTURE BAPISDITMX.
    DATA:END OF I_SITEMX.
    DATA: WA_I_SITEMX LIKE LINE OF I_SITEMX.
    DATA:BEGIN OF ZRETURN1 OCCURS 0.
            INCLUDE STRUCTURE BAPIRET2.
    DATA:END OF ZRETURN1.
    DATA: WA_ZRETURN1 LIKE LINE OF ZRETURN1.
    PARAMETERS: P_VBELN LIKE BAPIVBELN-VBELN,
                P_INCO1 LIKE BAPISDITEM-INCOTERMS1.
    SELECT VBELN
           POSNR FROM VBBE INTO TABLE ITAB
             WHERE VBELN = P_VBELN.
    DELETE ADJACENT DUPLICATES FROM ITAB COMPARING VBELN POSNR.
    CLEAR: I_SHEADER, I_VBELN, I_SITEM,I_SITEMX,
           ZRETURN, ZRETURN1.
    REFRESH: I_SHEADER, I_VBELN, I_SITEM,I_SITEMX,
             ZRETURN, ZRETURN1.
    LOOP AT ITAB INTO WA_ITAB.
      WA_I_SHEADER-UPDATEFLAG = 'U'.
      WA_I_SHEADER-INCOTERMS1 = 'X'.
      APPEND WA_I_SHEADER TO I_SHEADER.
      WA_I_VBELN-VBELN = WA_ITAB-VBELN.
      APPEND WA_I_VBELN TO I_VBELN.
      WA_I_SITEM-ITM_NUMBER = WA_ITAB-POSNR.
      WA_I_SITEM-INCOTERMS1 = P_INCO1.
      APPEND WA_I_SITEM TO I_SITEM.
      WA_I_SITEMX-ITM_NUMBER = WA_ITAB-POSNR.
      WA_I_SITEMX-INCOTERMS1 = 'X'.
      APPEND WA_I_SITEMX TO I_SITEMX.
      CLEAR: WA_ITAB, WA_I_VBELN, WA_I_SHEADER, WA_ZRETURN, WA_ZRETURN1,
             WA_I_SITEM, WA_I_SITEMX.
    ENDLOOP.
    CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
      EXPORTING
        SALESDOCUMENT               = I_VBELN
      ORDER_HEADER_IN             =
        ORDER_HEADER_INX            = I_SHEADER
      SIMULATION                  =
      BEHAVE_WHEN_ERROR           = ' '
      INT_NUMBER_ASSIGNMENT       = ' '
      LOGIC_SWITCH                =
      TABLES
        RETURN                      = ZRETURN
        ORDER_ITEM_IN               = I_SITEM
        ORDER_ITEM_INX              = I_SITEMX
      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 = ZRETURN1.
    WRITE:/'SY_SUBRC: ', SY-SUBRC.
    LOOP AT ZRETURN.
      WRITE:/ ZRETURN-MESSAGE, ZRETURN-TYPE.
    ENDLOOP.
    IF SY-SUBRC EQ 0.
    LOOP AT ZRETURN1.
        WRITE:/ ZRETURN1-MESSAGE, ZRETURN1-TYPE.
    ENDLOOP.
    ENDIF.
    CLEAR: I_SHEADER, I_VBELN, I_SITEM,I_SITEMX,
           ZRETURN, ZRETURN1.
    REFRESH: I_SHEADER, I_VBELN, I_SITEM,I_SITEMX,
             ZRETURN, ZRETURN1.
    Please do help me in solving the problem.
    thanks & regards,
    nitya

    I have added the order_header_inx but still the same error comes. I am sending you the code :
    *& Report  ZBAPI1                                                      *
    REPORT  ZBAPI1                                  .
    TABLES: VBBE, VBKD.
    DATA: BEGIN OF ITAB OCCURS 0,
          VBELN LIKE VBBE-VBELN,
          POSNR LIKE VBBE-POSNR,
          END OF ITAB.
    DATA: WA_ITAB LIKE LINE OF ITAB.
    DATA: BEGIN OF ITAB1 OCCURS 0.
            INCLUDE STRUCTURE VBKD.
    DATA: END OF ITAB1.
    DATA: ITAB2 LIKE ITAB1.
    DATA:BEGIN OF I_VBELN OCCURS 0.
            INCLUDE STRUCTURE BAPIVBELN.
    DATA:END OF I_VBELN.
    DATA: WA_I_VBELN LIKE LINE OF I_VBELN.
    DATA:BEGIN OF I_SHEADERX OCCURS 0.
            INCLUDE STRUCTURE BAPISDH1X.
    DATA:END OF I_SHEADERX.
    DATA: WA_I_SHEADERX LIKE LINE OF I_SHEADERX.
    DATA: BEGIN OF I_SHEADER OCCURS 0.
            INCLUDE STRUCTURE BAPISDH1.
    DATA: END OF I_SHEADER.
    DATA: WA_I_SHEADER LIKE LINE OF I_SHEADER.
    DATA:BEGIN OF ZRETURN OCCURS 0.
            INCLUDE STRUCTURE BAPIRET2.
    DATA:END OF ZRETURN.
    DATA: WA_ZRETURN LIKE LINE OF ZRETURN.
    DATA:BEGIN OF I_SITEM OCCURS 0.
            INCLUDE STRUCTURE BAPISDITM.
    DATA:END OF I_SITEM.
    DATA: WA_I_SITEM LIKE LINE OF I_SITEM.
    DATA:BEGIN OF I_SITEMX OCCURS 0.
            INCLUDE STRUCTURE BAPISDITMX.
    DATA:END OF I_SITEMX.
    DATA: WA_I_SITEMX LIKE LINE OF I_SITEMX.
    DATA:BEGIN OF ZRETURN1 OCCURS 0.
            INCLUDE STRUCTURE BAPIRET2.
    DATA:END OF ZRETURN1.
    DATA: WA_ZRETURN1 LIKE LINE OF ZRETURN1.
    SELECTION-SCREEN BEGIN OF BLOCK A.
    PARAMETERS: P_VBELN LIKE BAPIVBELN-VBELN,
                P_INCO1 LIKE BAPISDITEM-INCOTERMS1.
    SELECTION-SCREEN END OF BLOCK A.
    AT SELECTION-SCREEN OUTPUT.
      LOOP AT SCREEN.
        IF NOT P_VBELN IS INITIAL.
          READ TABLE ITAB1 INTO ITAB2 WITH KEY VBELN = P_VBELN.
          MOVE ITAB2-INCO1 TO P_INCO1.
          MODIFY SCREEN.
        ENDIF.
        EXIT.
      ENDLOOP.
      SELECT * FROM VBKD INTO TABLE ITAB1.
    START-OF-SELECTION.
      SELECT VBELN
             POSNR FROM VBBE INTO TABLE ITAB
               WHERE VBELN = P_VBELN.
      DELETE ADJACENT DUPLICATES FROM ITAB COMPARING VBELN POSNR.
    END-OF-SELECTION.
      CLEAR: I_SHEADERX, I_VBELN, I_SITEM,I_SITEMX,I_SHEADER,
             ZRETURN, ZRETURN1.
      REFRESH: I_SHEADERX, I_VBELN, I_SITEM,I_SITEMX,I_SHEADER,
               ZRETURN, ZRETURN1.
      LOOP AT ITAB INTO WA_ITAB.
        WA_I_SHEADERX-UPDATEFLAG ='U'.
        APPEND WA_I_SHEADERX TO I_SHEADERX.
        WA_I_SHEADER-INCOTERMS1 = P_INCO1.
        APPEND WA_I_SHEADER TO I_SHEADER.
        WA_I_VBELN-VBELN = WA_ITAB-VBELN.
        APPEND WA_I_VBELN TO I_VBELN.
        WA_I_SITEM-ITM_NUMBER = WA_ITAB-POSNR.
        WA_I_SITEM-INCOTERMS1 = P_INCO1.
        APPEND WA_I_SHEADER TO I_SHEADER.
        WA_I_SITEMX-ITM_NUMBER = WA_ITAB-POSNR.
        WA_I_SITEMX-UPDATEFLAG ='U'.
        WA_I_SITEMX-INCOTERMS1 ='X'.
        APPEND WA_I_SITEMX TO I_SITEMX.
        CLEAR: WA_ITAB, WA_I_VBELN, WA_I_SHEADERX, WA_ZRETURN, WA_ZRETURN1,
               WA_I_SITEM, WA_I_SITEMX.
      ENDLOOP.
      CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
        EXPORTING
          SALESDOCUMENT               = I_VBELN
          ORDER_HEADER_IN             = I_SHEADER
          ORDER_HEADER_INX            = I_SHEADERX
    *   SIMULATION                  =
    *   BEHAVE_WHEN_ERROR           = ' '
    *   INT_NUMBER_ASSIGNMENT       = ' '
    *   LOGIC_SWITCH                =
        TABLES
          RETURN                      = ZRETURN
          ORDER_ITEM_IN               = I_SITEM
          ORDER_ITEM_INX              = I_SITEMX
    *   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
          ='X'
        IMPORTING
          RETURN = ZRETURN1.
      WRITE:/'SY_SUBRC: ', SY-SUBRC.
      LOOP AT ZRETURN.
        WRITE:/ ZRETURN-MESSAGE, ZRETURN-TYPE.
      ENDLOOP.
      IF SY-SUBRC EQ 0.
        LOOP AT ZRETURN1.
          WRITE:/ ZRETURN1-MESSAGE, ZRETURN1-TYPE.
        ENDLOOP.
      ENDIF.
      CLEAR: I_SHEADER, I_VBELN, I_SITEM,I_SITEMX,
             ZRETURN, ZRETURN1.
      REFRESH: I_SHEADER, I_VBELN, I_SITEM,I_SITEMX,
               ZRETURN, ZRETURN1.
    Thanks for your valuable time
    regards,
    nitya

  • What are the paramters to b passed to the bapi_salesorder_change?

    what are the paramters to b passed to the bapi_salesorder_change, and how the parameters to b populated?

    Check the documentation in SE37.
    how to use bapi to change so's schedule line category
    Help with BAPI_SALESORDER_CHANGE
    Regards,
    Amit
    Reward all helpful replies.

  • Bapi parametrs to be passed in bapi_salesorder_change to change quantity

    Hi,
    how to change quantity of sales order by using bapi_salesorder_change.
    kindly Help us... to solve this Issue....(bapi parametrs to be passed in bapi_salesorder_change to change quantity)
    regards
    sathish Kumar.

    pass the updateflag = U
    pass the posnr,qty,mat in the item and pass the itemx= 'X' to these fileds.

  • How to use this CF - BAPI_SALESORDER_CHANGE to set reason for rejec in VA02

    Hi gurus,
    Can anybody guide me how can i use this Call function in the program to change sales order item data.
    Requirement:
    I want to set an Reason for Rejection in Open sales orders .
    how should i use this call function in program so that i can set - Reason for Rejection in Sales Orders.
    Guru's please give in detail like what parameters should i pass and where should i pass.
    Regards.
    S.Saravanan

    Hi,
    Use field REASON_REJ ad pass the reason code to item structure and set the flag for the item in ITEMX table.
    For more info, look for the where used list of the BAPI 'BAPI_SALESORDER_CHANGE' or search the forum.
    Regards
    Shiva

  • BAPI_SALESORDER_CHANGE Quantity in the sALES ORDER NOT GETTING UPDATED.

    Hi Experts,
    i am adding a new line item to the sales order with line item number and material number and QUANTITY.
    by using BAPI_SALESORDER_CHANGE bapi every thing is geeting updated but QUANTITY field is not getting updated.
    regards,
    Jay Sawant.

    I m using this code..
    Fill Line Item Details
      fl_order_itm-itm_number = line_item + 1000.
      fl_order_itm-material   = mpn.
      fl_order_itm-target_qty = qty.
       fl_order_itm-sales_unit = unit.
      APPEND fl_order_itm TO it_oditm.
    Fill the Header Order Details
    fl_order_itm_inx-itm_number = line_item + 1000.  "added
      fl_order_itm_inx-updateflag = 'U'.
      fl_order_itm_inx-material   = 'X'.
      fl_order_itm_inx-target_qty = 'X'.
    CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
        EXPORTING
          salesdocument            = vbeln
      ORDER_HEADER_IN             =
          order_header_inx         = order_header
      SIMULATION                  =
      BEHAVE_WHEN_ERROR           = ' '
      INT_NUMBER_ASSIGNMENT       = ' '
      LOGIC_SWITCH                =
      NO_STATUS_BUF_INIT          = ' '
        TABLES
          return                   =  it_ret2
       order_item_in               =  it_oditm
       order_item_inx              =  it_oditx
      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          =

Maybe you are looking for