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

Similar Messages

  • Error in BAPI_SALESORDER_CHANGE while updating condition

    Hi,
    I am using this BAPI to change an existing pricing condition. However, I am getting an error  " Manual change of condition type is not possible". I'm not sure whether this is a coding error or is it related to configuration. this is how I am populating the structures:
    so_cond_in-itm_number = wa_vbap1-posnr.
    so_cond_in-cond_count = wa_konv-zaehk.
    so_cond_in-cond_st_no = wa_konv-STUNR.
    so_cond_in-cond_type  = wa_konv-kschl.
    so_cond_in-cond_value = wa_konv-kbetr.
    so_cond_in-currency = wa_konv-waers.
    so_condx_in-itm_number = wa_vbap1-posnr.
    so_condx_in-updateflag = 'U'.
    so_condx_in-cond_st_no = wa_konv-STUNR.
    so_condx_in-cond_count = wa_konv-zaehk.
    so_condx_in-cond_type  = wa_konv-kschl.
    so_condx_in-cond_value = 'X'.
    so_condx_in-currency   = 'X'.
    APPEND so_condx_in.
    CLEAR so_condx_in.
    APPEND so_cond_in.
    CLEAR so_cond_in.
    st_logswitch-cond_handl = 'X'.
    Any help would be appreciated.
    Thanks
    SM

    Hi Sneha ,
    Can you please check the code for using the BAPI_SALESORDER_CHANGE bapi. this is similar to your chase.  Please compare with the passing parameters
    then you will get some idea on your code.
    *- Population of Order Item data
        ls_order_item-itm_number = ls_submit-posnr. "Item
        ls_order_item-prc_group5 = '003'."lc_004.          "Material Group5
        IF ls_submit-zmeng = 0.
          ls_order_item-reason_rej = lc_99.         "Reason for Rejection
        ENDIF.
        APPEND ls_order_item TO lt_order_item.
    *-Population of update flag for Order Item
        ls_order_itemx-itm_number = ls_submit-posnr."Item
        ls_order_itemx-updateflag = lc_u.           "Update flag
        ls_order_itemx-prc_group5 = gc_x.           "Material Group5 update
    *- if the required quanity is zero then reject the line
        IF ls_submit-zmeng = 0.
          ls_order_itemx-reason_rej = gc_x.         "Reason for Rejection
        ENDIF.
        APPEND ls_order_itemx TO lt_order_itemx.
    *-Population of
        ls_schedule_lines-itm_number = ls_submit-posnr.
        ls_schedule_lines-sched_line = ls_submit-etenr.
        ls_schedule_lines-req_qty = ls_submit-zmeng.
        APPEND ls_schedule_lines TO lt_schedule_lines.
    *-Population of update flag for Schedule line data
        ls_schedule_linesx-itm_number = ls_submit-posnr.
        ls_schedule_linesx-sched_line = ls_submit-etenr.
        ls_schedule_linesx-updateflag = lc_u.
        ls_schedule_linesx-req_qty = gc_x.
        APPEND ls_schedule_linesx TO lt_schedule_linesx.
    *- at the end of Order call the BAPI to Update the Order
        ls_order_head-collect_no = ls_submit-vbeln.
         ls_order_headx-updateflag = lc_u.
         ls_order_headx-collect_no = gc_x.
    *- BAPI Call to Update the Order
          CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
            EXPORTING
              salesdocument    = ls_submit-vbeln
              order_header_in  = ls_order_head
              order_header_inx = ls_order_headx
            TABLES
              return           = lt_return
              order_item_in    = lt_order_item
              order_item_inx   = lt_order_itemx
              schedule_lines   = lt_schedule_lines
              schedule_linesx  = lt_schedule_linesx.
    *- Check for the errors and based on that populate the log
          READ TABLE lt_return INTO ls_return WITH KEY type = lc_e.
          IF sy-subrc EQ 0.
            LOOP AT lt_return INTO ls_return WHERE type = lc_e.
              ls_log-excep = 1.
              ls_log-vbeln = ls_submit-vbeln.
              ls_log-message = ls_return-message.
              APPEND ls_log TO gt_log.
              CLEAR: ls_log,
                     ls_submit-vbeln .
            ENDLOOP.
          ELSE.
    *- Commit the Changes
            CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
              EXPORTING
                wait = gc_x.
    *- Check for the success message and populate the log
            LOOP AT lt_return INTO ls_return WHERE number = lc_311.
              ls_log-excep = 3.
              ls_log-vbeln = ls_submit-vbeln.
              ls_log-message = ls_return-message.
              APPEND ls_log TO gt_log.
              CLEAR: ls_log,
                     ls_submit-vbeln .
            ENDLOOP.
          ENDIF.
    Thanks
    Sekhar

  • Enter the document number error in BAPI_SALESORDER_CHANGE

    Hi,
    please help me on the below error:
    Call of BAPI_SALESORDER_CHANGE gives us an error V1 045 "Enter the document number". We are sure the call is proper (document number is send). The errors occurs in function module SD_SALES_DOCUMENT_READ in lines 60 and 61:
    60 VBAK-VBELN = DOCUMENT_NUMBER.
    61 PERFORM BELEG_LESEN(SAPMV45A).
    In line 60 field VBAK-VBELN is set but in form BELEG_LESEN(SAPMV45) is initial. The value of field is checked in MV45AF0B_BELEG_LESEN line 53.
    53 if vbak-vbeln is initial.
    54 message e045.
    55 endif.
    kindly help me on this error,
    Thanks in advance friends,
    Naidu

    LOOP AT IT_ZVCONTRACT_SUSP_SAVE INTO WA_ZVCONTRACT_SUSP_SAVE.
    *Assign values to required fields for for updation
        SALESDOCUMENT = WA_ZVCONTRACT_SUSP_SAVE-VBELN.
        ORDER_HEADER_IN-SALES_ORG = WA_ZVCONTRACT_SUSP_SAVE-VKORG.
        ORDER_HEADER_IN-PURCH_DATE = '00000000'.
        ORDER_HEADER_INX-SALES_ORG = 'X'.
        ORDER_HEADER_INX-PURCH_DATE = 'X'.
        ORDER_HEADER_INX-UPDATEFLAG = 'U'.
        WA_ORDER_ITEM_IN-ITM_NUMBER = WA_ZVCONTRACT_SUSP_SAVE-POSNR.
        IF WA_ZVCONTRACT_SUSP_SAVE-CFLAG EQ 'P'.      "flag for permanent suspension
          WA_ORDER_ITEM_IN-REASON_REJ = WA_ZVCONTRACT_SUSP_SAVE-ABGRU.
        ELSEIF WA_ZVCONTRACT_SUSP_SAVE-CFLAG EQ 'T'.  "flag for temporary suspension
          WA_ORDER_ITEM_IN-REASON_REJ = ''.
        ENDIF.
        APPEND WA_ORDER_ITEM_IN TO ORDER_ITEM_IN.
        WA_ORDER_ITEM_INX-ITM_NUMBER = WA_ZVCONTRACT_SUSP_SAVE-POSNR.
        WA_ORDER_ITEM_INX-UPDATEFLAG = 'U'.
        WA_ORDER_ITEM_INX-REASON_REJ = 'X'.
        APPEND WA_ORDER_ITEM_INX TO ORDER_ITEM_INX.
    *update contract for reason code
        CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
          EXPORTING
            SALESDOCUMENT    = SALESDOCUMENT
            ORDER_HEADER_IN  = ORDER_HEADER_IN
            ORDER_HEADER_INX = ORDER_HEADER_INX
          TABLES
            RETURN           = RETURN
            ORDER_ITEM_IN    = ORDER_ITEM_IN
            ORDER_ITEM_INX   = ORDER_ITEM_INX.
    ENDLOOP.
    We are using it the above given way and it is working fine.
    Regards,
    Abhijit G. Borkar

  • "Enter document number error" in BAPI_SALESORDER_CHANGE

    Hi,
    I am trying to change the sales order thorugh BAPI_SALEORDER_CHANGE as follows,
    CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
    EXPORTING
    salesdocument = <fs_order_alv_aux>-vbeln
    order_header_in = e_bapisdh1
    order_header_inx = e_bapisdh1x
    simulation = p_consol
    TABLES
    return = t_bapi_return
    extensionin = t_bapiparex.
    I am changing only KVGR5 through this BAPI, and I am passing sales documetn number through <fs_order_alv_aux>-vbeln.
    When I check inside BAPI I am able to see SALESDOCUMENT : 0021033932, while debugging further I came to know about following.
    Inside the Function SD_SALES_DOCUMENT_READ. following 2 lines gets executed.
    VBAK-VBELN = DOCUMENT_NUMBER.
    PERFORM BELEG_LESEN(SAPMV45A).
    Here, VBAK-VBELN has a value, but as soon as it goes inside PERFORM BELEG_LESEN(SAPMV45A). VBAK-VBELN value gets cleared and following error has been set inside the perform.
    if vbak-vbeln is initial.
    message e045.
    endif.
    If I manually fill VBAK-VBELN inside this perform then everything works fine.
    I even tried same thing through SE37 by executing this BAPI but in this case it doesnot clear the VBAK-VBELN inside this PERFROM.
    Can anyone help?
    Thank you.

    Hi Pramod,
    it does not look like a conversion error.
    You may try again with SE37, enter debugger at start and set a watchpoint at VBAK-VBELN in function SD_SALES_DOCUMENT_READ, i.e. program SAPLV45A.
    When VBAK-VBELN is set, it will stop at the watchpoint. Check the call stack at this point to find out how the value gets here. Then start your misbehaving program and (I hope so) find out ehere it is going wrong.
    The SD process is heavily penetrated with enhancements for a couple of industry solutions. I do not know your environment so it is hard to say how the document number is passed to function group V45A.
    Regards,
    Clemens

  • Error in BAPI_SALESORDER_CHANGE -- Enter The Profit Center

    Hi All,
    Am Creating Sales Order using BDC and getting Sales order number and uploading it's  Item text using
    BAPI_SALESORDER_CHANGE , But am getting error as please enter profit center for last record in Bapireturn and text is not getting updated.
    Everything is correctly uploaded with material number and profit center for sales order,
    while uploading it's item details text error occurs for last record as
    please enter profit center .Remaining Sales order text is getting uploaded ..
    May i know why this occurs and how to solve it ...

    Hi Santhosh
    Have Pasted my Code here for your reference ..
    \FORM createtext_bapi.
    DATA: t_posnr LIKE vbap-posnr occurs 0 with header line.
    data: begin of t_posnr occurs 0 ,
          vbeln like vbap-vbeln,
          matnr like vbap-matnr,
          posnr like vbap-posnr,
          end of t_posnr.
    DATA: ORD_TEXT LIKE BAPISDTEXT OCCURS 0 WITH HEADER LINE.
    DATA : TEXT(125) TYPE C.
    DATA: SOHEADER LIKE BAPISDH1.
    DATA: SOHEADERX LIKE BAPISDH1X .
    DATA: SORETURN  type table of bapiret2 with header line.
    DATA: I_ITEM LIKE BAPISDITM OCCURS 0 WITH HEADER LINE.
    DATA: I_ITEMX LIKE BAPISDITMX OCCURS 0 WITH HEADER LINE.
      DATA:w_item(6) value '000000'.
      DATA:w_item1(6) value '000010'.
      loop at  itab1.
      clear w_item.
       loop at it_sord where salesorder = itab1-salesorder.
          w_item = w_item + w_item1.
          unpack w_item to w_item.
    *****HEADER
      SOHEADERX-UPDATEFLAG = 'U'.
    ****LINE ITEM
    I_ITEM-ITM_NUMBER = w_item.
    APPEND I_ITEM.
    I_ITEMX-ITM_NUMBER = w_item.
    I_ITEMX-UPDATEFLAG = 'U'.
    APPEND I_ITEMX.
    ****LINE ITEM TEXT
    ORD_TEXT-DOC_NUMBER = it_sord-salesorder.
    ORD_TEXT-ITM_NUMBER = w_item.
    ORD_TEXT-TEXT_ID    = '0001'.  " IN SO MATERIAL SALES TEXT
    ORD_TEXT-LANGU      = 'EN'.
    ORD_TEXT-FUNCTION = '004'.
    CLEAR : TEXT.
           concatenate  s_date  it_sord-s_date into ORD_TEXT-TEXT_LINE."
           append ORD_TEXT.
         clear ORD_TEXT.
         concatenate  s_time  it_sord-s_time into ORD_TEXT-TEXT_LINE."
          append ORD_TEXT.
         clear ORD_TEXT.
         concatenate  e_date  it_sord-e_date into ORD_TEXT-TEXT_LINE."
          append ORD_TEXT.
         clear ORD_TEXT.
         concatenate  e_time  it_sord-e_time into ORD_TEXT-TEXT_LINE."
          append ORD_TEXT.
         clear ORD_TEXT.
         concatenate  pickup  it_sord-pickup into ORD_TEXT-TEXT_LINE."
          append ORD_TEXT.
         clear ORD_TEXT.
        concatenate  despt  it_sord-despt into ORD_TEXT-TEXT_LINE."
          append ORD_TEXT.
         clear ORD_TEXT.
    *APPEND ORD_TEXT.
                 CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
                   EXPORTING
                     salesdocument               = it_sord-salesorder
                     ORDER_HEADER_IN             = SOHEADER
                     order_header_inx            = SOHEADERX
                   tables
                     return                      = SORETURN
                    ORDER_ITEM_IN               = I_ITEM
                    ORDER_ITEM_INX              = I_ITEMX
                    ORDER_TEXT                  = ORD_tEXT.
    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
        EXPORTING
          WAIT = 'X'.
       refresh ORD_TEXT.
    READ TABLE SORETURN WITH KEY TYPE = 'E'.
    IF SY-SUBRC = 0.
    WRITE:/1 ' SO TEXT CHANGE  NOT UPDATED',
               itab1-salesorder, SORETURN-MESSAGE. "SORETURN-row ,
    *SORETURN-number,
    *SORETURN-MESSAGE_V1.
    ELSE.
    WRITE: ' SO TEXT CHANGE    UPDATED'.
    ENDIF.
    refresh:ORD_tEXT.
    endloop.
    endloop.
    ENDFORM.                    " createtext_bapi

  • Update error in BAPI_SALESORDER_CHANGE

    Hi,
    I have to add new line items to the existing sales order, so I have created a BDC for t-code VA02, when I run the program after I save the Sales order I got update error which says "Item status (document 2123455,  item 20) is missing".
    Then I converted the BDC into BAPI_SALESORDER_CHANGE, but still I have the same problem.
    Below are the parameters which I'm passing to function module. Please suggest me what could be the problem?
    lw_headx-updateflag = 'U'.
      LOOP AT p_lt_final_item.
        lv_itemno = lv_itemno + 10.
        MOVE: lv_itemno     TO lw_item-itm_number,
              gv_material TO lw_item-material,
              p_lt_final_item-ismnw TO lw_item-target_qty,
              p_lt_final_item-werks TO lw_item-plant,
              'hello'    TO lw_item-short_text.
        APPEND lw_item TO lt_item.
        MOVE: lv_itemno TO lw_itemx-itm_number,
              'I'     TO lw_itemx-updateflag,
              'X'     TO lw_itemx-material,
              'X'     TO lw_itemx-target_qty,
              'X'     TO lw_itemx-plant,
              'X'     TO lw_itemx-short_text.
        APPEND lw_itemx TO lt_itemx.
        MOVE: lv_itemno TO lw_sched-itm_number,
              '1' TO lw_sched-sched_line,
              p_lt_final_item-ismnw TO lw_sched-req_qty,
              sy-datum TO lw_sched-req_date.
              APPEND lw_sched TO lt_sched.
       MOVE: lv_itemno TO lw_schedx-itm_number,
             '1' TO   lw_schedx-sched_line,
              'I'     TO lw_schedx-updateflag,
              'X'     TO lw_schedx-req_qty,
              'X'     TO lw_schedx-req_date.
              APPEND lw_schedx TO lt_schedx.
      ENDLOOP.
      CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
        EXPORTING
          SALESDOCUMENT               = p_salesorder
    *     ORDER_HEADER_IN             =
          ORDER_HEADER_INX            = lw_headx
        TABLES
         RETURN                      = lt_return
         ORDER_ITEM_IN               = lt_item
         ORDER_ITEM_INX              = lt_itemx
         SCHEDULE_LINES              = lt_sched
         SCHEDULE_LINESX             = lt_schedx
      CALL FUNCTION 'BAPI_TRANSACTION_COMMIT' .
    Regards
    Jaker.
    Edited by: Rob Burbank on Feb 9, 2009 5:20 PM
    (Per suggestion from Jelena Perfiljeva, added code tags)

    Switching from transaction to BDC or BAPI will not help you. There is clearly a data issue in this order. Read the long text for the message - it might have some additional information.
    I'm guessing that there is some kind of a custom status maintained in your system on item level (see VA03 -> item data -> Status tab). You might want to check with your SD specialist on the status configuration.
    P.S. Also do use the Code tags when posting any code. Although in this case you might as well just delete the code since it has nothing to do with this problem anyway.
    Edited by: Jelena Perfiljeva on Feb 9, 2009 5:06 PM

  • Getting Error in BAPI_SALESORDER_CHANGE

    I am using BAPI_SALESORDER_CHANGE for creating line item for the SO.
    Sometimes I am getting error "Forward scheduling (enter start date) "
    Please help me to resolve this error

    Hi,
    R u creating sales order,but ur not getting items?is it right?
    If u want to create sales orders u use  bapi fun module as
    BAPI_SALESORDER_CREATEFROMDAT2
    in that
                      order_items_in        = itab_item
                      order_items_inx       = itab_itemx
    u use these items like this way..i am giving example.
    ADD 1 TO lv_item.
          wa_item-itm_number = lv_item.
          wa_item-material = it_va01-matnr.
          wa_item-untof_wght = 'TO'.
          wa_item-gross_wght = lv_qty.
          wa_item-net_weight = it_va01-kwmeng.
          IF it_va01-spart EQ '10' OR it_va01-spart EQ '40'
             OR it_va01-spart EQ 'PK'.
            wa_item-reqmts_typ = 'KE'.
          ELSEIF it_va01-spart EQ '60'.
            wa_item-reqmts_typ = 'KSL'.
          ENDIF.
          WA_ITEM-TAX_CLASS1 = 'G'.
          WA_ITEM-TAX_CLASS4 = '4'.
          WA_ITEM-OVERDLVTOL = '10'.
          APPEND wa_item TO itab_item.
          CLEAR : lv_qty.
          wa_item-itm_number = lv_item.
          wa_itemx-material = 'X'.
          wa_itemx-untof_wght = 'X'.
          wa_itemx-gross_wght = 'X'.
          wa_itemx-net_weight = 'X'.
          wa_itemX-reqmts_typ = 'X'.
          WA_ITEMX-TAX_CLASS1 = 'X'.
          APPEND wa_itemx TO itab_itemx.
    Regards,
    lokesh

  • BAPI_SALESORDER_CHANGE. Error V1 045 -- Indicate number of document.

    Hi Experts.
    When a pre-order (ZAG) it's confirmed in SAP, we make an oficial order (TA), then, when save the oficial order I need delete the field LCNUM in pre-order.
    I'm using this BAPI, in a USER EXIT inside program SAPVM45A, when the number of document it's the pre-order.. but it failed, and return to me the message error that I don't indicate the number of document.
    I find where it's the fail, when called to this function
      call function 'SD_SALES_DOCUMENT_READ'
    there is a moment in the code with that
    VBAK-VBELN = DOCUMENT_NUMBER.
      PERFORM BELEG_LESEN(SAPMV45A).
      PERFORM KONV_SELECT(SAPFV45P).
    Well, when called the perform BELEG_LESEN, ---> VBAK-VBELN LOST , yes I tell you the true..., LOST the value of the pre-Order...
    I think that when I call this function it's while save a order, program lost the value
    Example of the code:
    l_saledocument = v_vbelv. "Number of pre-po
              l_order_header_in-doc_num_fi = l_lcnum. "l_lcnum it's empty because I want update INITIAL in pre-po
              l_order_header_inx-doc_num_fi = 'X'.
              l_order_header_inx-updateflag = 'U'.
           Llamada a la bapi
              CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
                EXPORTING
                  salesdocument    = l_saledocument
                  order_header_in  = l_order_header_in
                  order_header_inx = l_order_header_inx
                TABLES
                  return           = li_return.
              READ TABLE li_return WITH KEY type = 'E'.

    Hi Pedro,
    have a look to SAP Note 1232196.
    You have to call FM SD_SALES_DOCUMENT_INIT before calling BAPI
    Hope it helps
    Lorenzo

  • BAPI_SALESORDER_CHANGE insert sales order item lines ERRORS

    Hello experts,
    i have to insert new item lines for a given sales order document number.
    i use bapi_salesorder_change but it does not work.
    these are the messages in the return table:
    Error 1.
    Message: ORDER_HEADER_IN has been processed succesfully
    Message: No item category available
    Message: Error in ITEM_IN
    Message: Condition cc_cond is not allowed as header condition
    Message: Sales document was not changed
    Error 2.
    Message: ORDER_HEADER_IN has been processed succesfully
    Message:Material is not defined for sales org., distribution chan, language DE {but i checked the table mvke with the matnr and sales org and distribution chanel and the material exists}
    Message: Error in ITEM_IN
    Message: Condition cc_cond is not allowed as header condition
    Message: Sales document was not changed
    here is the code:
      i_t_item-itm_number    = p_posnr.
      i_t_item-material      = p_matnr.
      i_t_item-target_qty    = p_qty.
      i_t_item-plant         = p_plant.
      i_t_item-hg_lv_item = p_uepos.
      i_t_item-price_date   = p_preisdat.
       i_t_item-prc_group2   = cc_prc_group.
      APPEND i_t_item.
    *setting conditions
      i_t_bapicond-itm_number  = p_posnr.
      i_t_bapicond-cond_type   = cc_condition_type.
      i_t_bapicond-cond_value  = l_netwr.
      i_t_bapicond-conpricdat  = gc_datum.
      i_t_bapicond-currency    = cc_eur.
      APPEND i_t_bapicond.
      i_t_itemx-updateflag = cc_i. {= 'I'}
      i_t_itemx-itm_number = p_posnr.
      i_t_itemx-material      = cc_x.
      i_t_itemx-target_qty    = cc_x.
      i_t_itemx-plant         = cc_x.
      i_t_itemx-hg_lv_item    = cc_x.
      i_t_itemx-price_date    = cc_x.
      i_t_itemx-prc_group2    = cc_x.
      APPEND i_t_itemx.
      i_t_bapicondx-updateflag = cc_i.{'I'}
      i_t_bapicondx-itm_number = p_posnr.
      i_t_bapicondx-cond_type = cc_x.
      i_t_bapicondx-cond_value = cc_x.
    i_t_bapicondx-conpricdat = cc_x.
      i_t_bapicondx-currency = cc_x.
      append i_t_bapicondx.
      CLEAR: l_behave, sy-subrc.
      CLEAR i_t_header.
      i_t_header-updateflag = cc_u. {='U'}
      APPEND i_t_header.
      CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
        EXPORTING
           salesdocument               = sales_ord_number
       ORDER_HEADER_IN       =
           order_header_inx            = i_t_header
           simulation                      = cc_x
           behave_when_error         = l_behave
       INT_NUMBER_ASSIGNMENT       = ' '
       LOGIC_SWITCH                =
        TABLES
           return                              = i_t_return
           order_item_in                  = i_t_item
           order_item_inx                = i_t_itemx
       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                    = i_t_text
       ORDER_KEYS                  =
           conditions_in               = i_t_bapicond
           conditions_inx             = i_t_bapicondx
         extensionin                 = i_t_extensionin.
      IF i_t_return-type EQ cc_s OR i_t_return-type EQ cc_w OR i_t_return-type EQ cc_i.
        CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
          EXPORTING
            wait = cc_x.
        PERFORM return_code.
      ELSE.
        p_flag = cc_x.
        PERFORM return_code_err.
    to rollback the transation for error records
        CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
      ENDIF. " IF i_t_return-type EQ 'S'
    i hope you can tell me where my code is wrong.
    Best Regards,
    Emilia

    Hello ,
    Error 2
    i checked about the material number and it seems that everything is in order.
    so this is not the problem.:(
    Error 1
    about the item category error: do i get this error because i don't fill the field ITEM_CATEG?
    Error 1 and Error 2
    About Message: Condition cc_cond is not allowed as header condition
    i really don't undesrtand what this is about.
    thank you for your answer.
    Best regards,
    Emilia

  • Updation Error in Schedule line category using 'BAPI_SALESORDER_CHANGE'

    HI ,
    I am using BAPI_SALESORDER_CHANGE to Update schedule line category for an order.But the issue is...the entries are updated if it is having single schedule line item,but if more than on item it is giving error in Last Record.
    15192625   000200 0001 2.608.596.065               130,000  21.09.2009 ZX CP
    *15192625   000200 0002 2.608.596.065                 0,000  04.02.2010 ZX CP
    *EV1                  335System error: Schedule line 0002 for item 000200 does not exist
    EV4                  219Sales document 0015192625 was not changed
    i have written the code like below:
    loop at i_ma4_etenr.
              i_salesdocument = i_ma4_etenr-vbeln.
             i_order_header_inx-updateflag = 'U'.
            r_schedule_lines-itm_number = i_ma4_etenr-posnr.
            r_schedule_lines-sched_line = i_ma4_etenr-etenr.
            r_schedule_lines-sched_type = i__ma4_etenr-ettyp .
            APPEND r_schedule_lines TO i_schedule_lines.
            CLEAR : r_schedule_linesx.
            r_schedule_linesx-itm_number = i_y16v_ma4_etenr-posnr.
            r_schedule_linesx-sched_line = i_y16v_ma4_etenr-etenr.
            r_schedule_linesx-updateflag = 'U'.
            r_schedule_linesx-sched_type = 'X'.
            APPEND r_schedule_linesx TO i_schedule_linesx.
    endloop.
            CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
              EXPORTING
                salesdocument               = i_salesdocument
                order_header_inx            = i_order_header_inx
              TABLES
                return                      = i_return
                schedule_lines              = i_schedule_lines
                schedule_linesx             = i_schedule_linesx.
    Thanks in Advance,
    Sateesh Kumar.

    Hi,
    As you are facing error , so check wheather in VA02 schedule line fields have been uploaded or not initially.
    If they are not uploaded then you will be facing the error.
    Otherwise check:
    Did you pass the X fields for the schedule lines properly. As you are changing only the schedule lines, Just pass the SCHEDULE_LINES , SCHEDULE_LINESX Internal tables.
    Please also check whether anything is passed to ORDER_ITEM_INX- UPDATE field. it should be blank.
    May it helps you.
    Regards,
    DS.

  • BAPI_SALESORDER_CHANGE error V1 739 - field EDATU, WMENG

    Hi people,
           I tryng to use de FM BAPI_SALESORDER_CHANGE to update de field edatu and wmeng (tab schedule), but the error message V1 739 is returned. Manually by transaction VA02 the modification is possible and the fields are changeable, I have not found notes about this problem, anybody know this problem, and know how solve it ?? My second alternative is do this modification using batch input.
      thanks,
    []'s
      Suzuki - Curitiba - Brazil.
    Message was edited by:
            Edson  Suzuki

    Hi Suzuki,
    I am facing the same issue like this at the moment. Would you be able to share how you managed to solve the problem?
    Thanks
    Ritwik Sharma

  • Sales Order -  BAPI_SALESORDER_CHANGE Error.

    Hi,
    I would want to compare the system price and the expected price for a sales order and in case of any discrepancy, set a 'reason for rejection' code. I'm using the bapi 'BAPI_SALESORDER_CHANGE' to make changes to the sales order (setting the rejection code). This is working fine in cases where there is some value for both the prices but is throwing an error while the system price is null.
    Is there any way to overcome this error and still set the rejection code?
    I pass all the required information to the BAPI,
    - Sales Order Number
    - Update Flag in HEADER_INX (U)
    - Item Number and Reason for Rejection in ITEM_IN
    - Item Number, Update Flag, Reason for Rejection (X) in ITEM_INX
    However I'm able to manually set RFR even if system price is null but not through BAPI. Is there any additional details that needs to be passed.
    Error Details:
    Error Message:
    No Sales Price (YYYY) for material XXXXX line IIII. Order will be incomplete.
    Message no. ZZ054
    Diagnosis
    The system could not determine a Sales Price (YYYY) for material 1. line 2..
    System Response
    The entire order will become incomplete when you save it.
    Thank you.

    Rob,
    I have checked the custom coding and the condition under which the message is popping up. I'm curious to understand why this is bypassed while setting RFR using VA02 while not in BAPI. It does not stop here while debugging.
    Also, once the RFR is set using VA02 and if I try to modify anything in the sales order or revoke the RFR, I get to this custom code.
    Thank you for your valuable time.

  • BAPI_SALESORDER_CHANGE: Error-Item not found

    Hi,
    I am calling BAPI_SLESORDER_CHANGE from an enhancement in the include MV45AF0B_BELEG_SICHERN. This will be called after the commit work of sales order. Im using this BAPI for the purpose of changing/updating the Inquiry line item from which the SO is created.
    When I execute the BAPI in SE37 by passing the Inquiry no. & item to be updated, it is not giving any error. In my enhancement, I am passing the same values but getting the error: ITEM NOT FOUND.
    When I debugged the BAPI, the error is raised in the Fm SD_SALES_ITEM_READ.
    In the below code in FM, VBAP is getting filled inside the PERFORM VBAP_BEARBEITEN_VORBEREITEN but when it comes out of this subroutine, the VBAP is initial.
    But when executing with SE37, this VBAP value is not getting cleared after the subroutine.
      PERFORM XVBAP_LESEN_DIREKT_SVBAP(SAPFV45P) USING ITEM_NUMBER.
      PERFORM VBAP_BEARBEITEN_VORBEREITEN(SAPFV45P).
      EVBAP = VBAP.
    Please help me out to resolve this issue.

    Yes,
    but in sales order creation you are going thru a different code:
    * Anlegen <= Here from sales order creation
      IF SVBAP-TABIX = 0.
        CLEAR:  MAEPV,
                MAAPV,
                MTCOM,
                XVBUP,
                XVBAPF,
                KONDD,
                XVBAP.
         *VBAP = XVBAP.                    " Getuntes clear
        HVBAP = XVBAP.                     " Getuntes clear
         *HVBAP = XVBAP.                   " Getuntes clear
        VBAP = XVBAP.                      " Getuntes clear
         *MTCOM = MTCOM.                   " Getuntes clear
        MOVE-CORRESPONDING XVBAP TO VBAPD. " Getuntes clear
         *VBAPD = VBAPD.                   " Getuntes clear
        CLEAR: HVBKD, *HVBKD.
    * Steuerflag für Textverarbeitung initialisieren
        CLEAR NO_TEXT_COPY-ITEM.
        clear no_text_copy-check.
      ELSE.
    * Ändern <= Here from SE37
        VBAP = XVBAP.
    It's a completely different behaviour!
    Regards,
    Klaus

  • Is it possible to ignore error messages in BAPI_SALESORDER_CHANGE  ?

    Dear all,
    I encountered another problem today which I hope you can help me with.
    During manual Sales Order Change, customizing triggers an error message which can be ignored for the special case I'm dealing with. It will pop up, but - like a warning message - the user can continue to enter data and afterwards save the changed SO.
    Now when I try to do the same thing via the BAPI, the BAPI fails due to this error message.
    Is there any way to make the BAPI ignore this error message, meaning to just continue processing the Sales Order when this message occured?
    Thank you very much,
            Johannes.

    <u>Suggestion #1</u>
    Take a look at the BAPI parameter BEHAVE_WHEN_ERROR.  Here is the long text for this parameter:
    <b>Short text</b>
    Error Handling
    <b>Description</b>
    This parameter controls how the program behaves when an error occurs. Up until now, the BAPI always terminated when an error occured. For example, if you created a sales order with several items and one item contained an error, the whole sales order was not created.
    This parameter make it possible to create an order even if some of the items cannot be created.
    <b>Value Range</b>
    Space = If an error occurs, processing stops and the sales document
    is not saved.
    P = If an error occurs, the sales document can be saved.
    Problematic items are not processed but they are logged.
    R = As for P but the document is not saved.
    <b>Default</b>
    Space
    <b>Notes</b>
    If several fields are changed within a structure and the field check finds an error, the system stops processing the structure and it is not changed.
    <b>For example:</b>
    You want to change the delivery block, billing block and item data in the header data of a sales order. If you specify a delivery block that is not permitted, the system does not change the header data but the items will be changed as long as they do not contain any errors themselves.
    <u>Suggestion #2</u>
    This can also depend on which message you are trying to ignore. 
    Some messages are set as customizable (in table T100C - see function module 'READ_CUSTOMIZED_MESSAGE').  FYI: SAP has been known to change certain messages to be "customizable" via an OSS Note upon request.
    Some messages might behave differently during a BAPI call.  See field CALL_BAPI in program SAPMV45A.
    If you haven't already done so, it might be worth an OSS Note search using your message class and number (include the BAPI name or "sales order" if too many notes are found).
    Best Regards,
    James Gaddis

  • BAPI_SALESORDER_CHANGE to update reason for rejection of sales order item

    Hi,
    The FM BAPI_SALESORDER_CHANGE is not working properly as I am getting below error when try to update the reason for rejection at sales order item level.
    The delivery is done for this salesorder. Is it because the reason for rejection field is not as an input field when delivery done?
    error in return table is " Field 'ABGRU' cannot be changed, VBAPKOM 000010  ready for input"
    Request your suggestions to avoid this error.
    Thanks

    >
    anikaushi wrote:
    > Hi,
    > The delivery is done for this salesorder. Is it because the reason for rejection field is not as an input field when delivery done?
    >
    >  error in return table is " Field 'ABGRU' cannot be changed, VBAPKOM 000010  ready for input"
    >
    >
    > Thanks
    Yes, Most likely.. You can confirm this by trying to change a order without delivery and see if it goes thru (to ensure that you have passed correct parameters)...
    you may have to delete the delivery (and if billing document exist, cancel it), before you can reject the line item... it would be safer to raise an error message and let the users manually delete delivery document as long as you don't have large volumes of this scenario..
    Please see the SDN thread for how you can avoid this error...
    Re: Cancel Sale Order after Issued Billing

Maybe you are looking for

  • A volume failed to mount/Operation cannot be completed

    We bought a MacBook on the weekend. Our Apple concierge insisted that we can keep our music, videos and photos on our Windows XP desktop and "share" the files on the Mac--in other words, we can pull down what we need to edit or save on the Mac as nee

  • How can I delete an e-mail without opening it?

    How can I delete an e-mail without opening it?

  • How to display xml sting as tree , using af:tree

    Hi, i need to display a xml string stored in the data base table, as a xml tree in GUI. I understand ADF having a component called <af:tree> . It expects input data as "oracle.adf.view.faces.model.TreeModel" type. how to convert the string format of

  • Release transfer

    Hi guys, I understand that release transfer is used to move objects from one SWC version to another . I am having a new SWCV SRM server 7.0 ( PI content )  and a older swcv POscenarios ( having custom mappings using objects in SRM server 3.0 ) In my

  • Keynote in Pasive (or Active) 3d

    I have been using Keynote for a while to create great looking 3D protestations. Creating a master Keynote and tweaking it to create Real 3D look. Left eye and then Right eye. Then exporting as quicktime. Taking in to Final cut with a custom sequence