BAPI_SALESORDER_CHANGE Problem

I try to update "ORDER_TEXT":
SALESDOCUMENT='0000014020'
ORDER_HEADER_INX-UPDATEFLAG='U'
ORDER_TEXT-DOC_NUMBER='0000014020'
ORDER_TEXT-ITM_NUMBER='000000'
ORDER_TEXT-TEXT_ID='0001'
ORDER_TEXT-LANGU='E'
ORDER_TEXT-TEXT_LINE='Add text to head'
But I can't get the change.
Help me, Any idea?

Hi
Check the fields which you want to update and try..
ORDER_HEADER_INX-UPDATEFLAG='U'
Like this..
ORDER_HEADER_INX-DOC_NUMBER='X'
ORDER_HEADER_INX-ITM_NUMBER='X'
ORDER_HEADER_INX-TEXT_ID='X'
ORDER_HEADER_INX-LANGU='X'
ORDER_HEADER_INX-TEXT_LINE='X'
Thanks,
Govind.
Message was edited by: Govindaraju Ayyakkannu

Similar Messages

  • BAPI_SALESORDER_CHANGE -Problem in Background

    Hi all,
    There is a requirement to change pricing conditions in Sales order.The pricing condition is based some values passed in tab
    additional data B. Am using the standard BAPI for modifying the value.
    But the changed pricing appears only when the SO is opened in Change mode but not in display mode.On adding the
    LOGIC_SWITCH -PRICING = 'B', this problem was eliminated.But now wat happens is if there are two pricing conditions, only the first condition appears in display mode whereas both conditions appear in change mode.
    Tried adding LOGIC_SWITCH --cond_handl = 'X' but to no avail, still the same. can anyone help me please.
    This problemm is faced only wen the BAPI_SALESORDER_CHANGE is run in Background.
    Else everything is fine in Foreground.
    Thanks in advance.

    HI kavitha
    I used the same bapi to update pricing field for sales order.
    Please specify which fields you want to update.
    are these fields present in bapi import or tables parameters.
    If no then these fields are Z fields and they have to be enhanced in tables first and then in exit.
    below is the demo program to pass z fields (ZZAGMID ) in bapi ( note : tables has to be enhanced before )
    this code will help u to understand how to update z fields
    let me if you are not able to follow..
    REPORT  ZTEST_BAPI.
    PARAMETERS: P_VBELN TYPE VBAK-VBELN,
                p_posnr TYPE vbap-posnr,
                P_AGMID type BAPE_VBAP-ZZAGMID.
    DATA: T_LINE LIKE BAPISDITM OCCURS 0 WITH HEADER LINE.
    DATA: T_LINEX LIKE BAPISDITMX OCCURS 0 WITH HEADER LINE.
    DATA: T_EXTEN LIKE BAPIPAREX OCCURS 0 WITH HEADER LINE.
    DATA: T_RETURN LIKE BAPIRET2 OCCURS 0 WITH HEADER LINE.
    DATA: BAPE_VBAP LIKE BAPE_VBAP.
    DATA: BAPE_VBAPX LIKE BAPE_VBAPX.
    DATA: ORDER_HEADERX LIKE BAPISDH1X.
    DATA: BAPE_VBAK type BAPE_VBAK .
    DATA: BAPE_VBAKX LIKE BAPE_VBAKX.
    DATA: W_RETURN LIKE BAPIRET2.
    data: v_val TYPE BAPIPAREX-VALUEPART1.
    data: v_number(5) TYPE c.
    ORDER_HEADERX-UPDATEFLAG = 'U'.
    T_LINE-ITM_NUMBER = p_posnr.
    T_LINE-PLANT = '5AP1'.
    APPEND T_LINE.
    T_LINEX-ITM_NUMBER = p_posnr.
    T_LINEX-UPDATEFLAG = 'U'.
    T_LINEX-PLANT = 'X'.
    APPEND T_LINEX.
    T_EXTEN-STRUCTURE = 'BAPE_VBAP'.
    BAPE_VBAP-vbeln = p_vbeln.
    BAPE_VBAP-posnr = p_posnr.
    BAPE_VBAP-ZZAGMID = P_AGMID.
    T_EXTEN+30 = BAPE_VBAP.
    APPEND t_exten.
    BAPE_VBAPX-VBELN = P_VBELN.
    BAPE_VBAPX-POSNR = p_posnr.
    BAPE_VBAPX-ZZAGMID = 'X'.
    T_EXTEN-STRUCTURE = 'BAPE_VBAPX'.
    T_EXTEN+30 = BAPE_VBAPX.
    APPEND T_EXTEN.
    IMPORT v_number from MEMORY ID v_number.
    BREAK-POINT.
    CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
    EXPORTING
    salesdocument = p_vbeln
    order_header_inx = ORDER_HEADERX
    tables
    return = T_RETURN
    ORDER_ITEM_IN = T_LINE
    ORDER_ITEM_INX = T_LINEX
    EXTENSIONIN = T_EXTEN.
    call function 'BAPI_TRANSACTION_COMMIT'
    * EXPORTING
    * WAIT =
    * IMPORTING
    * RETURN =
    CLEAR: W_RETURN.
    LOOP AT T_RETURN INTO W_RETURN.
    WRITE: W_RETURN-MESSAGE,/.
    ENDLOOP.

  • BAPI_SALESORDER_CHANGE problem: change sold-to-party

    Hi guys,
    I am having a problem with my current dev. I am using BAPI_SALESORDER_CHANGE to change the sold-to of a sales order.
    However, I am getting error message: "You cannot change entry in partner function XX".
    Can anyone help me on this?
    Thanks!
    jac

    hi,
    REPORT  ZMYBAPI2                                .
    data : ordervbeln like bapivbeln occurs 0 with header line,
           order_header_in like bapisdh1 occurs 0 with header line,
           order_header_ix like bapisdh1x occurs 0 with header line.
    data : order_items_in like bapisditm  occurs 0 with header line,
           order_items_ix like bapisditmx occurs 0 with header line.
    data : order_partners like bapiparnr occurs 0 with header line.
    data : return1 like bapiret2 occurs 0 with header line.
    data : w_vbeln like bapivbeln occurs 0 with header line.
    data:
         order_schedules_in like bapischdl occurs 0 with header line,
         order_schedules_inx like bapischdlx occurs 0 with header line.
    order_header_in-sales_org  = 'JNJ1'.
    order_header_in-distr_chan = '02'.
    order_header_in-division   = 'J1'.
    order_header_in-sales_off  = 'JNJ1'.
    order_header_in-purch_no_c = 'testbapipo'.
    order_header_in-purch_date = sy-datum.
    order_header_in-req_date_h = sy-datum.
    append order_header_in.
    order_items_in-material      = '000000000000000727'.
    order_items_in-plant         = 'JNJ1'.
      append order_items_in.
      order_partners-partn_role = 'AG'.
      order_partners-partn_numb = '0000000011'.
      append order_partners.
      order_schedules_in-itm_number = '10'.
      order_schedules_in-req_qty   = '10'.
      append order_schedules_in.
    *Updating the indices
      order_header_ix-updateflag = 'U'.
      order_header_ix-sales_org  = 'X'.
      order_header_ix-distr_chan = 'X'.
      order_header_ix-division   = 'X'.
      order_header_ix-sales_off  = 'X'.
      order_header_ix-purch_no_c = 'X'.
      order_header_ix-purch_date = 'X'.
    order_header_ix-req_date_h = 'X'.
      append order_header_ix.
      order_items_ix-updateflag    = 'U'.
      order_items_ix-material      = 'X'.
      order_items_ix-plant         = 'X'.
      order_items_ix-division      = 'X'.
      order_items_ix-target_qu     = 'X'.
      append order_items_ix.
      order_schedules_inx-updateflag        = 'U'.
      order_schedules_inx-itm_number       = 'X'.
      order_schedules_inx-req_qty          = 'x'.
      append order_schedules_inx.
    call function 'BAPI_SALESORDER_CHANGE'
      exporting
       salesdocument               =
       ORDER_HEADER_IN             = order_header_in
        order_header_inx            = order_header_ix
      SIMULATION                  =
      BEHAVE_WHEN_ERROR           = ' '
      INT_NUMBER_ASSIGNMENT       = ' '
      LOGIC_SWITCH                =
      tables
        return                      = return1
       ORDER_ITEM_IN               = order_items_in
       ORDER_ITEM_INX              = order_items_ix
       PARTNERS                    = order_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              = order_schedules_in
      SCHEDULE_LINESX             =
      ORDER_TEXT                  =
      ORDER_KEYS                  =
      CONDITIONS_IN               =
      CONDITIONS_INX              =
      EXTENSIONIN                 =
    if sy-subrc ne 0.
        write: return1-message,return1-number,return1-type.
      else.
          write: return1-message,return1-number,return1-type.
          call function 'BAPI_TRANSACTION_COMMIT'
       EXPORTING
         WAIT          =
       IMPORTING
         RETURN        =
      endif.
    This may give an idea, This program written on 4.6B.
    still u r problem not solved, please post the code
    regards,
    pavan

  • BAPI_SALESORDER_CHANGE problem in updating qty

    hi,
    i am working in bapi_saleorder_change . in that i want to update some fields but  some fields are not update properly. for qty(vbap-kwmeng) i set BAPISDITM-TARGET_QTY = qty ,  BAPISDITMx-TARGET_QTY = 'X' and BAPISDITMX-UPDATEFLAG = 'U' in the internal table ORDER_ITEM_IN and ORDER_ITEM_INx but still it is not working. similar things, i have did for changing material ,delv.prior and  reason for rejection which update successfully. Whereas fields like qty(kwmeng),price date (in header),payment terms(vbkd-zterm in header) ,plant(werks in item ) are not updated properly .
      And I also want to know how to change SHIP-TO party using this FM.
      Thanks in advance.

    Hi
    you can do in this way
      MOVE: '10' TO BAPISCHDL-REQ_QTY,
                 '10'  TO BAPISCHDL-itm_number,
                 '10' TO BAPISCHDL-SCHED_LINE.
                  APPEND  BAPISCHDL.
       MOVE: 'U' TO BAPISCHDLX-UPDATEFLAG,
                   'X' TO BAPISCHDLX-REQ_QTY,
                  '10' TO BAPISCHDLX-itm_number.
                   APPEND  BAPISCHDLX.
    Use  SCHEDULE_LINES           =  BAPISCHDL
           SCHEDULE_LINESX         =  BAPISCHDLX
             in bapi_saleorder_change FM

  • Problem while changing Sales order using 'BAPI_SALESORDER_CHANGE'

    Hi all,
    Below is my code to update delivery block value:
    FORM call_bapi_salesorder_change .
    DATA:  iv_bapi_view  LIKE order_view.
    DATA: gt_sales_doc TYPE STANDARD TABLE OF sales_key, " Document Numbers to Be Selected
            gt_items TYPE STANDARD TABLE OF bapisdit. " Order Item Data for Document Numbers
    *************************************************************8
    DATA:order_headers_out LIKE bapisdhd OCCURS 0 WITH HEADER LINE.
    DATA:order_header_inx LIKE bapisdh1x.
      DATA: lv_salesdocument LIKE bapivbeln-vbeln.
      data: lv_matnr(10) type c.
      DATA:
    gt_schdule TYPE STANDARD TABLE OF bapischdl, " for gl date & load date
    gt_schdulex TYPE STANDARD TABLE OF bapischdlx, " for partner role and partner function.
            gt_return TYPE STANDARD TABLE OF bapiret2,
            gt_itemin TYPE STANDARD TABLE OF bapisditm,
            gt_iteminx TYPE STANDARD TABLE OF bapisditmx ,
            gt_bapisdh1 TYPE STANDARD TABLE OF  bapisdh1.
      DATA:gs_head_bapi TYPE bapisdh1x,
           gs_schdule TYPE bapischdl,
           gs_schdulex TYPE bapischdlx,
           gs_return TYPE bapiret2,
           gs_itemin TYPE bapisditm,
           gs_iteminx TYPE bapisditmx,
           gs_bapisdh1 TYPE bapisdh1.
      CLEAR : gt_schdule,gt_schdulex,gs_return.
      REFRESH gt_return.
      gs_head_bapi-updateflag = 'U'.
    SORT gt_final BY vbeln.
    CLEAR gs_vbep.
    REFRESH gt_vbep[].
      CLEAR gs_final.
      LOOP AT gt_final1 INTO gs_final.
        gs_itemin-itm_number = gs_final-posnr.
    *move gs_final-matnr to lv_matnr."qx94162
       gs_itemin-material = gs_final-matnr.
        CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
          EXPORTING
            input  = gs_final-matnr
          IMPORTING
            output = gs_final-matnr.
       CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
        EXPORTING
          input  = lv_matnr
        IMPORTING
         output = lv_matnr.
       gs_itemin-material = lv_matnr.
        gs_itemin-material = gs_final-matnr.
        gs_iteminx-itm_number = gs_final-posnr.
        gs_iteminx-updateflag = 'U'.""changed to I
        gs_iteminx-material = 'X'.
        " gs_schdule-req_dlv_bl = gs_final-lifsp. " Delivery block
        gs_schdule-itm_number = gs_final-posnr.
        gs_schdulex-itm_number = gs_final-posnr.
        gs_schdule-sched_line = '0001'.
        gs_schdulex-sched_line = '0001'.
       MOVE gs_final-lifsp to gs_schdule-req_dlv_bl.
        gs_schdule-req_dlv_bl = gs_final-lifsp.
        gs_schdulex-req_dlv_bl = 'X'. " Delivery block
        gs_schdulex-updateflag = 'U'.
        gs_bapisdh1-sales_org = gs_final-vkorg.
        APPEND gs_schdule TO gt_schdule.
        APPEND gs_schdulex TO gt_schdulex.
        APPEND gs_itemin TO gt_itemin.
        APPEND gs_iteminx TO gt_iteminx.
       Append gs_BAPISDH1 to gt_BAPISDH1.
        lv_salesdocument = gs_final-vbeln.
        CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
          EXPORTING
            salesdocument               = lv_salesdocument     
           ORDER_HEADER_IN             = gs_BAPISDH1
            order_header_inx            = gs_head_bapi         
      SIMULATION                  =
      BEHAVE_WHEN_ERROR           = ' '
      INT_NUMBER_ASSIGNMENT       = ' '
      LOGIC_SWITCH                =
      NO_STATUS_BUF_INIT          = ' '
          TABLES
            return                      = gt_return            
       order_item_in               =    gt_itemin
       order_item_inx              = gt_iteminx
      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                = gt_schdule           
          schedule_linesx               = gt_schdulex          
      ORDER_TEXT                  =
      ORDER_KEYS                  =
      CONDITIONS_IN               =
      CONDITIONS_INX              =
      EXTENSIONIN                 =
      NFMETALLITMS                =
        CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
        REFRESH: gt_schdule, gt_schdulex, gt_itemin , gt_iteminx.
        LOOP AT gt_return INTO gs_return.
          WRITE / gs_return-message .
        ENDLOOP .
      ENDLOOP.
    ENDFORM.                    " CALL_BAPI_SALESORDER_CHANGE
    When I am using material value as 18342 using CONVERSION_EXIT_ALPHA_OUTPUT:
    ORDER_HEADER_IN has been processed successfully
    Material  is not defined for sales org.A101,  distr.chan.00,  language DE
    Error in ITEM_IN 000030
    SCHEDULE_IN has been processed successfully
    The sales document is not yet complete: Edit data
    Sales document 5010000715 was not changed
    and when I am using CONVERSION_EXIT_ALPHA_INPUT (000000000000018342)or  while debuging when I am changing value to  0018342 :
    I am getting below dump:
    Runtime Errors         DATA_LENGTH_0
    Exception              CX_SY_RANGE_OUT_OF_BOUNDS
    Date and Time          21.10.2010 07:22:17
    Information on where terminated
         Termination occurred in the ABAP program "SAPLVBAK" - in
          "MAP_VBAP_TO_BAPISDIT".
         The main program was "RS_TESTFRAME_CALL ".
         In the source code you have the termination point in line 168
         of the (Include) program "LVBAK001".
         The termination is caused because exception "CX_SY_RANGE_OUT_OF_BOUNDS"
          occurred in
         procedure "MAP_VBAP_TO_BAPISDIT" "(FORM)", but it was neither handled local
          nor declared
         in the RAISING clause of its signature.
         The procedure is in program "SAPLVBAK "; its source code begins in line
         99 of the (Include program "LVBAK001 ".
    The same dump I am getting while executing this above BAPI from SE37 tcode with the same test data.
    but I am able to change it though Va02 tcode.
    Edited by: Arora26 on Oct 21, 2010 7:58 AM

    Hi,
    have you searched for OSS notes? The note 1137897 looks like related to your problem. It mentions different BAPI but I assume that both BAPI reuse same routines and therefore it might solve your problem as well.
    Cheers

  • Problem in BAPI  'BAPI_SALESORDER_CHANGE'.

    Hi All,
    I am facing a problem in BAPI  'BAPI_SALESORDER_CHANGE'. My requirement is as below.
    For a particular type of Sales Order i have to update all the ship-to PO.Basically in all these PO's we have to suffix
    'old'.
    I am pasting the code which I used. I am actually displaying the return message in a table.
    The message says 'Schedule Order is saved'.
    When i go and check the SO the ship-to PO is not updated.
    Also i have one more querry.
    Is thsi BAPI to be run for each item or can i collect all items in t_item_in and then call the BAPI.
    Please guide me on this.
    Thanks in Advance,
    Saket.
    LOOP AT t_vbkd INTO wa_vbkd.
    CONCATENATE wa_vbkd-bstkd_e '-' v_po INTO v_po_ref.
    t_item_in-purch_no_c    = v_po_ref.
    t_item_inx-purch_no_c   = v_po_ref.
    t_item_inx-updateflag  = 'X'.
      APPEND t_item_in.
      APPEND t_item_inx.
    *LOOP AT t_vbak INTO wa_vbak.
    v_vbeln = wa_vbkd-vbeln.
    w_headerx-updateflag = 'U'.
    CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
      EXPORTING
        SALESDOCUMENT               = v_vbeln
        ORDER_HEADER_INX            = w_headerx
      TABLES
        RETURN                      = t_return
        ORDER_ITEM_IN               = t_item_in
        ORDER_ITEM_INX              = t_item_inx.
    READ TABLE t_return WITH KEY type = 'E'.
      IF sy-subrc = 0.
        t_output-rmks = t_return-message.
      ELSE.
        t_output-rmks = t_return-message.
      ENDIF.
      READ TABLE t_vbak INTO wa_vbak
       WITH KEY vbeln = v_vbeln.
      t_output-vbeln = v_vbeln.
      t_output-auart = wa_vbak-auart.
      t_output-vkorg = wa_vbak-vkorg.
      t_output-bstkd_e_old = wa_vbkd-bstkd_e.
      t_output-bstkd_e_new = t_item_in-purch_no_c.
      APPEND t_output.
    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
    EXPORTING
       WAIT          = 'X'
    IMPORTING
      RETURN        =
    ENDLOOP.

    REPORT  ZSALESORDER_CHANGE MESSAGE-ID 38.
    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
    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.
    REFRESH: i_sched, i_schedx, i_ret.
    CLEAR: i_sched, i_schedx, i_ret.
    i_hdrx-updateflag = 'U'.
    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.
    http://abap.wikiprog.com/wiki/BAPI_SALESORDER_CHANGE
    Edited by: krupa jani on Jul 30, 2009 9:22 AM

  • Problem while updating Item category using Bapi_salesorder_change

    Hi,
    Iam facing a probelm while updating item category using bapi Bapi_salesorder_change
    In the Return table iam getting the folowing mesages.
    Inforation mesage : Field 'PSTYV' cannot be changed, VBAPKOM 000010  ready for input
    Error Message : Item 000010 cannot be processed.
    Please find the code below
    CLEAR wa_bapisdh1x.
      wa_bapisdh1x-updateflag = 'U'.
      CLEAR wa_order_item_inx.
      wa_order_item_inx-itm_number = wa_vbap-posnr.
      wa_order_item_inx-item_categ = 'X'.
      wa_order_item_inx-UPDATEFLAG = 'U'.
      APPEND  wa_order_item_inx TO it_order_item_inx.
      CLEAR wa_order_item_inx.
      CLEAR wa_order_item_in.
      wa_order_item_in-itm_number = wa_vbap-posnr.
      wa_order_item_in-item_categ = 'ABC'.
      APPEND wa_order_item_in TO it_order_item_in.
      CLEAR wa_order_item_in.
    CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
        EXPORTING
          salesdocument    = w_vbeln
          order_header_inx = wa_bapisdh1x
        TABLES
          return           = it_return
          order_item_in    = it_order_item_in
          order_item_inx   = it_order_item_inx
    How can i correct it..
    Regards
    Kumar

    Actually iam facing a strange problem here.
    When i copy the program into another sample program and execute it iam able to change both the item catgegory and delivery block for particular sales order and item number.
    But in my main program i have BDC for MB1B transaction to create the material document.
    Once the material document is created succesfully iam using BAPI Sales_order_change to change the item category and delivery block..
    In my main program iam not to change the item catgeory getting an error field PSTYV cannot be changed.
    But the same code is running percfectly in the copied one..
    How can i correct that..
    Regards
    Kumar

  • Problem in updating Quantity using 'BAPI_SALESORDER_CHANGE'

    Hi,
    I am using Bapi_salesorder_change to update item quantity and reason for rejection.My code is as below.
           MOVE c_u TO e_orderheader_inx-updateflag.
            FREE i_orderitem_in.
            MOVE newitem-posnr_ref TO e_orderitem_in-itm_number.
            MOVE c_rej TO e_orderitem_in-reason_rej.
            MOVE c_qt TO e_orderitem_in-target_qty.
            APPEND e_orderitem_in TO i_orderitem_in.
            FREE i_orderitem_inx.
            MOVE newitem-posnr_ref TO e_orderitem_inx-itm_number .
            MOVE c_u TO e_orderitem_inx-updateflag.
            MOVE c_x TO e_orderitem_inx-reason_rej.
            MOVE c_x TO e_orderitem_inx-target_qty .
            APPEND e_orderitem_inx TO i_orderitem_inx.
            FREE i_return.
            CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
              EXPORTING
                salesdocument              = xvbak-vbeln
                ORDER_HEADER_IN            =
                order_header_inx           = e_orderheader_inx
              TABLES
               return                      =  i_zbapiret2
               order_item_in               =  i_orderitem_in
               order_item_inx              =  i_orderitem_inx.
    But in 'i_zbapiret2' iam getting the below errors.
    1)Storage location BH in plant is not defined .
    2) Error in ITEM_IN 000020
    3) sales documnet 000078965 was not changed.
    PLease help me to solve this problem.
    Thanks in advance,
    Sravanthi.

    Hi,
      From the error message it seems that you dont have the storage location for the plant as you have passed to the BAPI check table 'T001L' to see if that storage location is there for the plant. If not then we need to maintain that.
    Regards,
    Himanshu

  • Problem using BAPI_SALESORDER_CHANGE

    Hi Experts,
    I am inserting the Item in Sales order by using BAPI_SALESORDER_CHANGE.
    suppose there are 2 line item in sales i.e. 10 and 20 .
    now i want to insert line item i.e. 30.
    now the problem is that when i am trying to insert line item 30 it is getting inserted.
    but i want to update the quantity for line item 30.
    how to update the quantity of line item 30?
    anybody have the solution?
    Thanks in advance.
    Abhishek

    Hi,
      Fill tables parameter ORDER_ITEM_IN and ORDER_ITEM_INX for the line item you want to update the quantity for the field would be TARGET_QTY and TARGET_QU
    and in the ORDER_ITEM_INX have ITM_NUMBER = '30  the update indicator equal to 'X' and TARGET_QTY = 'X'and  TARGET_QU eq 'X' and that should do it.
    Regards,
    Himanshu

  • Problem with BAPI_SALESORDER_CHANGE ("Enter part 2 of the incoterms")

    Hi,
    I have a problem when I try to create Sales Order and change it with BAPI_SALESORDER_CHANGE.
    Logic of my program is
    1. Use BAPI_SALESDOCUMENT_COPY to copy data from Billing to Create SO
    2. Use BAPI_SALESORDER_CHANGE to unblock Billing Block in Sales Order Created from step1
    Problem occurs in step 2. Returning Bapi Error Message that "Enter part 2 of the Incoterms". I already check that after step 1 Sales Order already have incoterm2. And in step 2, I didn't send input parameter 'X' to update fiend incoterm2 (Table order_header_inx1).
    I debug BAPI_SALESORDER_CHANGE and found that my error came from function 'SD_SALES_ITEM_MAINTAIN'. I think that this function is used for update item. I couldn't see why it gave me that error about INCOTERMS2 which is in header.
    Have anyone ever been through the same problem before?
    Thanks,
    Pavin

    I just found the cause of this problem and want to share in this topic.
    Here is the process of BAPI_SALESORDER_CHANGE that cause my problem.
    BAPI_SALESORDER_CHANGE -> SD_SALESDOCUMENT_CHANGE -> SD_SALES_ITEM_MAINTAIN  -> perform vbkd-inco1_pruefen(sapfv45k) -> RV_INCOTERMS_CHECK
    My problem occurs in Function RV_INCOTERMS_CHECK because value in field VBKD-INCO2 is missing. This case only happen when I try to create CFR SO with reference from EXW Billing.
    Hope it's useful.
    Regards,
    Pavin
    Edited by: Pavin P. on Apr 30, 2009 5:15 AM

  • Problem with BAPI_SALESORDER_CHANGE function module

    I know lot of posts have been done about problems with this function module. However I was not able to find the answer to my problem. Hence posting a new thread
    I have the following code which changes the reason rejection (if required to 'ZF') and also updates the sales order quantity.
    The code works absolutely fine as long as the PGI date of the order item is either today or in the future. However if the PGI date of the order item is in the past. I get an error in the t_return table with error type 'E' saying 'PGI date is in the past hence could not update the item'.
    If I try to update the same order quantity in VA02 for the item with PGI date in the past it does so without any problem.
    Can someone please suggest what the problem might be. Or if there is some other way I can update the quantity. (I dont want to use BDC)
    FORM change_sales_order_item USING value(r_rtb_posnrs) TYPE zpsd_ztsdrtb_ro_track
                                 CHANGING r_return TYPE type_t_bapiret2.
      DATA: v_order_header_in TYPE bapisdh1,
      v_order_header_inx TYPE bapisdh1x,
      t_schedule_lines TYPE bapischdl OCCURS 0 WITH HEADER LINE,
      t_schedule_linesx TYPE bapischdlx OCCURS 0 WITH HEADER LINE,
      v_temp_rtb_vbeln TYPE vbeln,
      v_temp_rtb_posnr TYPE posnr,
      wa_old_rtb_posnrs TYPE ztsdrtb_ro_track,
      t_item_in TYPE bapisditm OCCURS 0 WITH HEADER LINE,
      t_item_inx TYPE bapisditmx OCCURS 0 WITH HEADER LINE,
      v_rtb_old_vbeln TYPE zrtbvbeln,
      v_rtb_old_posnr TYPE zrtbposnr,
      v_ro_old_vbeln TYPE zrovbeln,
      v_ro_old_posnr TYPE zroposnr,
      v_rtb_count TYPE i,
      v_next_row_index TYPE i,
      v_update_order_flg TYPE char1, "Update the sales order flag
      v_rtb_record_counter TYPE i,
      v_original_vbeln TYPE vbeln,
      t_bapiret TYPE STANDARD TABLE OF bapiret2.
      FIELD-SYMBOLS: <wa_r_rtb_posnrs> TYPE ztsdrtb_ro_track,
                     <wa_r_rtb_posnr_next> TYPE ztsdrtb_ro_track.
      CONSTANTS: c_updateflag TYPE bapisditmx-updateflag VALUE 'U'.
      v_order_header_inx-updateflag = 'U'.
    Get rid of the duplicate records for the same RTB order. Just use
    the last record quantity in the internal table
      LOOP AT r_rtb_posnrs ASSIGNING <wa_r_rtb_posnrs>.
        v_rtb_record_counter = v_rtb_record_counter + 1.
        <wa_r_rtb_posnrs>-seqnr = v_rtb_record_counter.
      ENDLOOP.
      SORT r_rtb_posnrs DESCENDING BY zrtbvbeln zrtbposnr seqnr zrtbconsumedflg.
      DELETE ADJACENT DUPLICATES FROM r_rtb_posnrs COMPARING zrtbvbeln zrtbposnr.
      DESCRIBE TABLE r_rtb_posnrs LINES v_rtb_count.
      v_rtb_record_counter = 0.
      v_update_order_flg = space.
      LOOP AT r_rtb_posnrs ASSIGNING <wa_r_rtb_posnrs>.
        v_rtb_record_counter = v_rtb_record_counter + 1.
        v_update_order_flg = space.
    Popluate the item quantity update flags for schedule lines
        t_schedule_linesx-itm_number = <wa_r_rtb_posnrs>-zrtbposnr.
        t_schedule_linesx-sched_line = '0001'.
        t_schedule_linesx-updateflag = c_updateflag.
        t_schedule_linesx-req_qty = 'X'.
        APPEND t_schedule_linesx.
        CLEAR t_schedule_linesx.
    *Item (Order QQuantity Field to be changed "KWMENG")
        t_schedule_lines-itm_number = <wa_r_rtb_posnrs>-zrtbposnr.
        t_schedule_lines-sched_line = '0001'.
        t_schedule_lines-req_qty = <wa_r_rtb_posnrs>-zrtbchgqty.
        APPEND t_schedule_lines.
        CLEAR t_schedule_lines.
    If fully consumed then set the rejection flag
        IF <wa_r_rtb_posnrs>-zrtbconsumedflg = 'X'.
          t_item_inx-itm_number = <wa_r_rtb_posnrs>-zrtbposnr.
          t_item_inx-updateflag = 'X'.
          t_item_inx-reason_rej = 'X'.
          APPEND t_item_inx.
          CLEAR t_item_inx.
          t_item_in-itm_number = <wa_r_rtb_posnrs>-zrtbposnr.
          t_item_in-reason_rej = 'ZF'.
          APPEND t_item_in.
          CLEAR t_item_in.
        ELSE.
          t_item_inx-itm_number = <wa_r_rtb_posnrs>-zrtbposnr.
          t_item_inx-updateflag = 'X'.
          t_item_inx-reason_rej = 'X'.
          APPEND t_item_inx.
          CLEAR t_item_inx.
          t_item_in-itm_number = <wa_r_rtb_posnrs>-zrtbposnr.
          t_item_in-reason_rej = ' '.
          APPEND t_item_in.
          CLEAR t_item_in.
        ENDIF.
    If you have reached the last line of the RTB intern table update the sales order
    *Index pointing to the next row
        v_next_row_index = v_rtb_record_counter + 1.
        IF v_rtb_record_counter = v_rtb_count.
          v_update_order_flg = 'X'.
        ELSEIF v_rtb_record_counter < v_rtb_count.
    Get the next row data
          READ TABLE r_rtb_posnrs INDEX v_next_row_index ASSIGNING <wa_r_rtb_posnr_next>.
          IF sy-subrc = 0.
            IF <wa_r_rtb_posnrs>-zrtbvbeln <> <wa_r_rtb_posnr_next>-zrtbvbeln.
              v_update_order_flg = 'X'.
            ENDIF.
          ENDIF.
        ELSE.
          v_update_order_flg = space.
        ENDIF.
    update the rtb orders with quantities and the rejection flag (if required)
        IF v_update_order_flg = 'X'.
          CALL FUNCTION 'BAPI_SALESORDER_CHANGE' STARTING NEW TASK 'SOUPDATE'
            PERFORMING callbk_bapi_salesorder_change ON END OF TASK
            EXPORTING
              salesdocument    = <wa_r_rtb_posnrs>-zrtbvbeln
              order_header_in  = v_order_header_in
              order_header_inx = v_order_header_inx
            TABLES
              return           = t_return
              schedule_lines   = t_schedule_lines
              schedule_linesx  = t_schedule_linesx
              order_item_in    = t_item_in
              order_item_inx   = t_item_inx.
          WAIT UNTIL t_return[] IS NOT INITIAL.
          READ TABLE t_return INTO wa_return WITH KEY type = 'E'.
          IF sy-subrc <> 0.
          ELSE.
            r_return[] = t_return[].
            MESSAGE ID 'ZSD' TYPE 'E' NUMBER 613.
           RAISE errorinorderupdate.
          ENDIF.
          REFRESH t_schedule_linesx.
          REFRESH t_schedule_lines.
          REFRESH t_item_in.
          REFRESH t_item_inx.
          REFRESH t_return.
        ENDIF.
      ENDLOOP.
    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
       IMPORTING
         return = t_bapiret.
    ENDFORM.                    "Change_Sales_Order

    see the following example and try to do this:
    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.

  • BAPI_SALESORDER_CHANGE - Fields update problem

    Hi experts,
    I need to update some specific fields (BAPIADDR1-HOME_CITY, BAPIADDR1-HOUSE_NO2) in sales order.
    For this I use BAPI above.
    Obviously in BAPIADDR1 structure there is also ADDR_NO field filled.
    The problem is, that the rest of the fields was deleted (updated). I mean these one, which was not specified ...
    How to avoid update those field. ?
    Really thanks.
    Daniel.

    data PARTNERADDRESSES like BAPIADDR1 occurs 0 with header line.
    PARTNERADDRESSES-ADDR_NO = '0000000004'.
    PARTNERADDRESSES-NAME = 'krupa'.
    PARTNERADDRESSES-STREET = 'test'.
    PARTNERADDRESSES-NAME_2 = 'Bldg 56'.
    PARTNERADDRESSES-CITY = 'ahmedabad'.
    *APPEND PARTNERADDRESSES. CLEAR PARTNERADDRESSES*
    call function 'BAPI_SALESORDER_CHANGE'
    exporting
    salesdocument = salesd
    ORDER_HEADER_IN = it_BAPISDH1
    order_header_inx = it_BAPISDH1X
    SIMULATION =
    BEHAVE_WHEN_ERROR = ' '
    INT_NUMBER_ASSIGNMENT = ' '
    LOGIC_SWITCH =
    tables
    ORDER_ITEM_IN = it_BAPISDITM
    ORDER_ITEM_INX = it_BAPISDITMX
    PARTNERS = it_BAPIPARNR
    return = it_BAPIRET2
    PARTNERCHANGES = it_BAPIPARNRC
    PARTNERADDRESSES = PARTNERADDRESSES

  • Problem with BAPI_SALESORDER_CHANGE for updating address details

    Hi,
    I am trying to update address details using the bapi BAPI_SALESORDER_CHANGE. I am unable to update. I am populating only the required fields.
    Could anyone tell whats the problem with BAPI?
    Thanks & Regards,
    Yaseen Mahammad.

    Yaseen,
    Do check whether you have passed values to the internal table ORDER_HEADER_INX. You have to pass value to the update field as 'U' and all the fields which you have passed in the header internal table as 'X'.
    and  behave_when_error = 'P'

  • Problem with BAPI_SALESORDER_CHANGE

    Hi Experts,
    I am using the following code to reject the sales orders and to update in the database.
    for the sales orders having multiple line items, when i select only one line item it should update only that particular line item but it is updating all the line items in that sales order.
    can anybody please tell me how to correct this error.
            I_ITEM-ITM_NUMBER = I_SELECTED_SO-POSNR.
            I_ITEM-REASON_REJ = I_SELECTED_SO-ABGRU.
            APPEND I_ITEM. CLEAR I_ITEM.
            I_ITEMX-ITM_NUMBER = I_SELECTED_SO-POSNR.
            I_ITEMX-UPDATEFLAG = 'U'.
            I_ITEMX-REASON_REJ = 'X'.
            APPEND I_ITEMX. CLEAR I_ITEMX.
          Save rejection reason text
            I_TEXT-DOC_NUMBER = I_SELECTED_SO-VBELN.
            I_TEXT-ITM_NUMBER = I_SELECTED_SO-POSNR.
            I_TEXT-LANGU      = SY-LANGU.
            APPEND I_TEXT.
            I_BAPISDH1X-UPDATEFLAG = 'U'.
            CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
              EXPORTING
                SALESDOCUMENT    = I_SELECTED_SO-VBELN
                ORDER_HEADER_IN  = I_BAPISDH1
                ORDER_HEADER_INX = I_BAPISDH1X
              TABLES
                RETURN           = I_RETURN
                ORDER_ITEM_IN    = I_ITEM
                ORDER_ITEM_INX   = I_ITEMX
                ORDER_TEXT       = I_TEXT.
    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
    thanks & regards,
    sudheer

    Not sure why it would update all lines... Could it be something in the configuration or in the user exit that propagates the update from one line to the others?
    I used pretty much the same code with just a few differences and didn't use I_TEXT at all:
    DATA: s_da_order_item_in TYPE t_order_item_in WITH HEADER LINE.
    DATA: s_da_order_item_inx TYPE t_order_item_inx WITH HEADER LINE.
        s_da_order_item_in-material   = it_ztable-matnr.
        s_da_order_item_in-itm_number = it_ztable-posnr.
        s_da_order_item_in-reason_rej = c_abgru.
        APPEND s_da_order_item_in.
        CLEAR  s_da_order_item_in.
        s_da_order_item_inx-updateflag = c_updateflag.
        s_da_order_item_inx-reason_rej = c_updatefield.
        s_da_order_item_inx-itm_number = it_ztable-posnr.
        APPEND s_da_order_item_inx.
        CLEAR  s_da_order_item_inx.
    The rest was the same. It worked perfectly fine.

  • Problem in using BAPI_SALESORDER_CHANGE

    Hi,
    We are using BAPI_SALESORDER_CHANGE for updating the delivery block information present in Shipping tab of sales order header.
    We are updating the below parameters and then calling the bapi.
       ls_header-DLV_BLOCK = 'Z1'.
       ls_head_update-updateflag = 'U'.
       ls_head_update-DLV_BLOCK = 'X'.
    CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
        EXPORTING
          SALESDOCUMENT               = gs_vbak-vbeln
          ORDER_HEADER_IN             = ls_header
          ORDER_HEADER_INX            = ls_head_update
          behave_when_error           = ' '
          int_number_assignment       = ' '
        TABLES
          RETURN                      = lt_return.
    But during execution we could see the messages in parameter return as below
    ORDER_HEADER_IN has been processed successfully
    No data was changed
    But we want to update the delivery block with Z1 which is not happening.
    Please let us know if we missed anything.
    Thanks in advance,
    Poornima

    HI,
    Check the tcode VA03 with the sales ordernumber before changing and after changing the sales order with delivery block.
    Refer to this link..
    BAPI_SALESORDER_CHANGE

Maybe you are looking for

  • List View like Library

    Hello All, Can we create a list view similar like Library Palette. If so which widget needs to be added on the palette. Basically we would like to show multiple columns as in library palette and allow the user to select one or multiple cells from the

  • Solution for the Camera Raw 8.2 update installation problem

    Hi. Adobe Camera Raw 8.2 for CC & CS6 was released two months ago. http://blogs.adobe.com/lightroomjournal/2013/09/camera-raw-8-2-and-dng-converter-8-2-now-a vailable.html But many people got problem in updating Camera Raw 8.2. I tried to inspect the

  • Program executing faster than OS level calls... wait()/sleep()/etc...?

    I have a class that uses makes an OS level call to move a file from location A to location B, and then I have further code that will open this file and then do some reading and writing to it. The problem I am having is that the OS command is issued a

  • LinkSys wired router set up advise?

    I recently bought a LinkSys BEFSR41 wired router w/4 port switch and I've been having trouble setting it up. I bought it so I could have a connection for an XBox 360, and possibly a PC laptop soon. It's working right now, but the IP in my system pref

  • Safari not playing *.WMV flies

    Any time I try to view pages with the "windows media player" built into a website to view a movie (or streaming media like on XM radio), the movie doesn't play; rather opens my own separate version to play the WMV file externally. How do I get my wmv