Update sales order using BAPI_SALESORDER_CHANGE --- URGENT!!!!

Hello,
<b> I want to update Batch, Pricing date, Header text & Item text using BAPI_SALESORDER_CHANGE.</b>
But i am not able to do it.
i have written a code, but it's still not updating:
PARAMETERS: p_vbeln LIKE vbak-vbeln.
TYPES: BEGIN OF t_return.
        INCLUDE STRUCTURE bapiret2.
TYPES: END OF t_return.
TYPES: BEGIN OF t_order_item_in.
        INCLUDE STRUCTURE bapisditm.
TYPES: END OF t_order_item_in.
TYPES: BEGIN OF t_order_item_inx.
        INCLUDE STRUCTURE bapisditmx.
TYPES: END OF t_order_item_inx.
TYPES: BEGIN OF t_schedule_lines.
        INCLUDE STRUCTURE bapischdl.
TYPES: END OF t_schedule_lines.
TYPES: BEGIN OF t_schedule_linesx.
        INCLUDE STRUCTURE bapischdlx.
TYPES: END OF t_schedule_linesx.
TYPES: BEGIN OF t_order_text.
        INCLUDE STRUCTURE bapisdtext.
TYPES: END OF t_order_text.
DATA: l_vbeln              LIKE          bapivbeln-vbeln,
      i_order_header_inx   LIKE          bapisdh1x,
      i_order_header_in    LIKE          bapisdh1,
      i_return             TYPE TABLE OF t_return,
      i_order_item_in      TYPE TABLE OF t_order_item_in,
      wa_order_item_in     LIKE LINE  OF i_order_item_in,
      i_order_item_inx     TYPE TABLE OF t_order_item_inx,
      wa_order_item_inx    LIKE LINE  OF i_order_item_inx,
      i_schedule_lines     TYPE TABLE OF t_schedule_lines,
      wa_schedule_lines    LIKE LINE  OF i_schedule_lines,
      i_schedule_linesx    TYPE TABLE OF t_schedule_linesx,
      wa_schedule_linesx   LIKE LINE  OF i_schedule_linesx,
      i_order_text         TYPE TABLE OF t_order_text,
      wa_order_text        LIKE LINE  OF i_order_text,
      w_return             LIKE          bapiret2,
      l_date               TYPE char10.
CLEAR l_vbeln.
l_vbeln = p_vbeln.
          UPDATE REJECTION REASON IN SALES ORDER                *
*WRITE sy-datum TO l_date.
i_order_header_inx-updateflag = 'U'.
REFRESH i_order_item_in.
CLEAR wa_order_item_in.
wa_order_item_in-itm_number = '000010'.
wa_order_item_in-batch = '2007450027'.
wa_order_item_in-price_date = sy-datum.
wa_order_item_in-reason_rej = '00'.
APPEND wa_order_item_in TO i_order_item_in.
REFRESH i_order_item_inx.
CLEAR wa_order_item_inx.
wa_order_item_inx-itm_number = '000010'.
wa_order_item_inx-updateflag = 'U'.
wa_order_item_in-batch = 'X'.
wa_order_item_in-price_date = 'X'.
wa_order_item_inx-reason_rej = 'X'.
APPEND wa_order_item_inx TO i_order_item_inx.
*wa_order_text-doc_number = l_vbeln.
**wa_order_text-TDOBJECT = 'EHSWA_MAN'.
***wa_order_text-text_id = '0001'.
**wa_order_text-TDTEXT = 'Header Texts'.
*wa_order_text-text_line = 'SYNGENTA HEADER'.
***wa_order_text-function = 'U'.
wa_order_text-doc_number = l_vbeln.
wa_order_text-itm_number = '000010'.
*wa_order_text-TDOBJECT = 'EBAN'.
wa_order_text-text_id = '0001'.
*wa_order_text-TDTEXT = 'Item text'.
wa_order_text-text_line = 'SYNGENTA TEXT'.
wa_order_text-function = '004'.
APPEND wa_order_text TO i_order_text.
CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
  EXPORTING
    salesdocument               = l_vbeln
  ORDER_HEADER_IN             =
    order_header_inx            = i_order_header_inx
  SIMULATION                  =
  BEHAVE_WHEN_ERROR           = ' '
  INT_NUMBER_ASSIGNMENT       = ' '
  LOGIC_SWITCH                =
  NO_STATUS_BUF_INIT          = ' '
  TABLES
    return                      = i_return
    order_item_in               = i_order_item_in
    order_item_inx              = i_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              = i_schedule_lines
   schedule_linesx             = i_schedule_linesx
   order_text                  = i_order_text
  ORDER_KEYS                  =
  CONDITIONS_IN               =
  CONDITIONS_INX              =
  EXTENSIONIN                 =
IF sy-subrc = 0.
  CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
    EXPORTING
      wait   = 'X'
    IMPORTING
      return = w_return.
ENDIF.
Please help out.
Please send the code of it.
Thanks in advance...

START-OF-SELECTION.
Get Blocked Orders
  PERFORM sub_select_orders.
  PERFORM order_reason_for_reject.
  END-OF-SELECTION.
Display output
  PERFORM sub_display_output.
*&      Form  sub_select_orders
      text
FORM sub_select_orders .
  SELECT a~vbeln
         a~erdat
         a~erzet
         a~auart
         b~posnr
         FROM ( vbak as A
         INNER JOIN VBAP AS B
         on Bvbeln = AVBELN )
         INTO TABLE i_order_data
         WHERE a~vbeln IN s_ordno  AND
               A~auart IN s_auart  AND
               A~erdat IN s_orddt  AND
               A~vkorg IN s_vkorg  AND
               A~vtweg IN s_vtweg  AND
               A~spart IN s_spart .
  IF sy-subrc NE 0.
    MESSAGE i001.
  No data selected
    LEAVE LIST-PROCESSING.
  ENDIF.
ENDFORM.                    " sub_get_blocked_orders
*&      Form  order_reason_for_reject
      text
-->  p1        text
<--  p2        text
FORM order_reason_for_reject .
  LOOP AT i_order_data INTO w_order_data.
    w_output-vbeln = w_order_data-vbeln.
    w_ordhdrx-updateflag = c_update.
Update Order Reason for rejection .
    w_orditem-ITM_NUMBER = w_order_data-posnr.
    w_orditem-reason_rej = p_abgru.
    append w_orditem to i_orditem .
    w_orditemx-ITM_NUMBER = w_order_data-posnr.
    w_orditemx-updateflag = c_update.
    w_orditemx-reason_rej = 'X'.
    append w_orditemx to i_orditemx .
    At end of vbeln .
    w_output-vbeln = w_order_data-vbeln .
      CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
        EXPORTING
          salesdocument    = w_order_data-vbeln
          order_header_in  = w_ordhdr
          order_header_inx = w_ordhdrx
        TABLES
          ORDER_ITEM_IN    = i_orditem
          ORDER_ITEM_INX   = i_orditemx
          return           = i_bapiret.
      READ TABLE i_bapiret WITH KEY type = c_error
                           TRANSPORTING NO FIELDS.
      IF sy-subrc EQ '0'.
        move 'Order Reason for rejection update Failed' to
        w_output-message .
      ELSE.
        CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
          EXPORTING
            wait   = c_check
          IMPORTING
             return = i_return.
      move 'Order Reason for rejection update successful' to
      w_output-message .
     endif .
     refresh :i_orditemx , i_orditem .
    Endat .
    APPEND w_output TO i_output.
    CLEAR w_output.
  endloop .
ENDFORM.                    " order_reason_for_reject

Similar Messages

  • 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.

  • Change sales order using BAPI_SALESORDER_CHANGE

    Hi i want to add a new line item to the existing sales order using BAPI_SALESORDER_CHANGE
    but when i am trying it is giving
    'Schedule line 0001 for item 000020 does not exist ' error..
    please help me..

    *********I wanted to add an new line item.***.. this is my code..********
    LOOP AT gt_input3 INTO st_input3.
    *Finding Max No of line Items
        IF fl_set IS INITIAL.
          READ TABLE gt_vbap INTO st_vbap WITH KEY vbeln = st_input3-vbeln.
          IF sy-subrc EQ 0.
            lv_posnr = st_vbap-posnr.
            fl_set = 'X'.
          ENDIF.
        ENDIF.
    *Populate Item details
        lv_posnr = lv_posnr + 10.
        lv_vbeln = st_input3-vbeln.
        lv_order_header_inx-updateflag = 'U'.
        st_order_item_in-itm_number = lv_posnr.
        st_order_item_in-material  = st_input3-matnr.
        st_order_item_in-target_qty = st_input3-imv_qty.
        st_order_item_in-plant = st_input3-werks.
        st_order_item_in-store_loc = st_input3-lgort.
       st_order_item_in-store_loc = st_input3-lgort.
        APPEND st_order_item_in TO lt_order_item_in.
    *Populate item updation Details
        st_order_item_inx-itm_number = lv_posnr.
        st_order_item_inx-updateflag = 'U'.
        st_order_item_inx-material = 'X'.
        st_order_item_inx-plant = 'X'.
        st_order_item_inx-store_loc = 'X'.
        st_order_item_inx-target_qty = 'X'.
        APPEND st_order_item_inx TO lt_order_item_inx.
    *Populate the Schedule Lines
        st_schedule_lines-itm_number = lv_posnr.
        st_schedule_lines-sched_line = '0001'.
        st_schedule_lines-req_qty = st_input3-imv_qty.
        APPEND st_schedule_lines TO lt_schedule_lines.
    *Populate the update details of schedule lines
        st_schedule_linesx-itm_number = lv_posnr.
        st_schedule_linesx-sched_line = '0001'.
        st_schedule_linesx-req_qty = 'X'.
        st_schedule_linesx-updateflag = 'U'.
        APPEND st_schedule_linesx TO lt_schedule_linesx.
           AT END OF vbeln.
    *Call BAPI Sales order change
          CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
            EXPORTING
              salesdocument    = lv_vbeln
              order_header_inx = lv_order_header_inx
            TABLES
              return           = lt_return
              order_item_in    = lt_order_item_in
              order_item_inx   = lt_order_item_inx
              schedule_lines   = lt_schedule_lines
              schedule_linesx  = lt_schedule_linesx.
    *Save Sales Order
          CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
            EXPORTING
              wait = 'X'.
          CLEAR lv_posnr.
          READ  TABLE lt_return INTO st_return WITH KEY type = 'E'.
          st_ipfile_err3-message = st_return-message.
    *Error Log
          LOOP AT gt_temp3 INTO st_temp3.
            IF st_ipfile_err3-message IS NOT INITIAL.
              MOVE st_temp3-record TO st_ipfile_err3-record.
              IF fl_set1 IS INITIAL.
                APPEND st_temp_err TO gt_ipfile_err3.
                fl_set1 = 'X'.
              ENDIF.
              APPEND st_ipfile_err3 TO gt_ipfile_err3.
            ELSE.
              APPEND st_temp3 TO gt_audit3.
            ENDIF.
            CLEAR : st_temp3,
                    st_temp_err,
                    st_ipfile_err3,
                    fl_set.
          ENDLOOP.
          REFRESH : gt_zrman,

  • How to update sales orders using B1WS in SAP 8.8 PL18

    Hello all.
    We are having a problem updating sales orders using Sap Business One Web Service ( B1WS ).
    We are running SBO 8.8 PL18, MS-SQL 2008, and all is fine when using the SBO client.
    But when it comes to updating sales orders through B1WS we just cannot get it to work.
    We can add new orders easily without problems. Updating orders always gives this error:
    \[ORDR.PayDuMonth\]\[line: 0\] , 'Field cannot be updated (ODBC -1029)'
    We have checked and verified multiple times that our setup is correct.
    Also the WDSL files are verified.
    We can update orders just fine using the sboclient.
    And using B1WS we can basically do everything, besides updating.
    We have also tried this on different company db's, so we are quite sure this is not
    something related to some general setting we missed, but who knows?
    We have tried different ways to "assemble" the order before updating, but it always
    ends with the above error.
    Here is an example of one of the tests, where we load an order by docentry,
    increment the quantity of all open lines by '1', and then try to update it.
            protected void Page_Load(object sender, EventArgs e)
                // First we login
                string sessionId = "";
                LoginService.LoginService l_login = new LoginService.LoginService();
                LoginService.LoginDatabaseType l_dbtype = LoginService.LoginDatabaseType.dst_MSSQL2008;
                LoginService.LoginLanguage _lang = LoginService.LoginLanguage.ln_English;
                string _server = "SAP-8_8PL18";
                string _licserver = "SAP-8_8PL18:30000";
                string _db = "my_test_company";
                string _user = "manager";
                string _pass = "********";
                try
                    sessionId = l_login.Login(_server, _db, l_dbtype, true, _user, _pass,
                               _lang, true, _licserver);
                catch (Exception ex)
                    Response.Clear();
                    Response.Write(ex.Message);
                    Response.End();
                if (sessionId == "")
                    Response.Clear();
                    Response.Write("No sessionId");
                    Response.End();
                // We are logged in and have a sessionId
                // Now load a valid open order by docentry
                try
                    OrdersServiceRef.OrdersService orderService = new OrdersServiceRef.OrdersService();
                    orderService.MsgHeaderValue = new OrdersServiceRef.MsgHeader();
                    orderService.MsgHeaderValue.SessionID = sessionId;
                    orderService.MsgHeaderValue.ServiceName = OrdersServiceRef.MsgHeaderServiceName.OrdersService;
                    orderService.MsgHeaderValue.ServiceNameSpecified = true;
                    OrdersServiceRef.DocumentParams docParams = new OrdersServiceRef.DocumentParams();
                    docParams.DocEntry = 31; // Docentry of a known open order
                    docParams.DocEntrySpecified = true;
                    OrdersServiceRef.Document order = orderService.GetByParams(docParams);
                    OrdersServiceRef.DocumentDocumentLine line = null;
                    for (int i = 0; i < order.DocumentLines.Length; i++)
                        line = order.DocumentLines<i>;
                        if (line.LineStatus == OrdersServiceRef.DocumentDocumentLineLineStatus.bost_Open)
                            line.Quantity += 1;
                    orderService.Update(order);
                catch (System.Web.Services.Protocols.SoapException ex)
                    Response.Clear();
                    Response.Write(ex.Message);
                    Response.End();
                catch (Exception ex)
                    Response.Clear();
                    Response.Write(ex.Message);
                    Response.End();
                Response.Clear();
                Response.Write("All OK");
                Response.End();
    I hope that someone has an idea as to why this happens.
    The customer often changes quantity or adds lines on their orders,
    and the only way to solve it so far has been to make a new order and
    close the old one.
    Thanks in advance
    J. Thomsen

    Hi,
    Welcome you post on the forum.
    Have you checked if you only update a specific line instead of a loop?
    Thanks,
    Gordon

  • Remove Reason For Rejection From Sales Order Using BAPI_SALESORDER_CHANGE

    Hi
    I have a sales order and would like to remove the rejection reason.
    I am trying to use BAPI_SALESORDER_CHANGE with the following code:
    (0000xxxxxxx  is my material #. i just removed the actual #).
    MOVE: '0000050106' TO SALESDOCUMENT.
    MOVE: 'U' TO T_HEADER_INX-UPDATEFLAG.
    MOVE:                        30 to t_order_item_in-ITM_NUMBER,
                                      ' ' to t_order_item_in-REASON_REJ,
          '0000000000xxxxxxxx' to t_order_item_in-material.
    APPEND t_order_item_in.
    MOVE: 'U' TO t_order_item_inx-updateflag.
    MOVE: 'X' to t_order_item_inx-REASON_REJ,
               'X' TO t_order_item_inx-material.
    CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
      EXPORTING
        salesdocument              = SALESDOCUMENT
        order_header_inx           = T_HEADER_INX
      tables
        RETURN                     = T_RETURN
        ORDER_ITEM_IN              = T_ORDER_ITEM_IN
        ORDER_ITEM_INX             = T_ORDER_ITEM_INX
    WAIT UP TO 5 SECONDS.
    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
    EXPORTING
      WAIT          = 'X'
    IMPORTING
       RETURN        = t_return
    WAIT UP TO 5 SECONDS.
    can anybody help?
    the BAPI returns success messages saying the item was processed successfully but the reason code is still there.
    However, if i pass in any other reason code like 02 or 06, it works!.
    thanks.

    Thanks for your help. =)
    I also realized that I forgot to add the SO Item # into the T_ORDER_ITEM_INX-ITM_NUMBER fields.
    But now it works.

  • To delete sales order using BAPI_SALESORDER_CHANGE

    HI ,
           I am using BAPI_SALESORDER_CHANGE to delete a bulk of order lines for an order.But the issue is...the entries are deleted in VBEP and VBUP tables for all the order lines where in VBAP only few order lines are deleted.This is happening repeatedly.
    I am passing data like this...
        CLEAR: l_vbap_inx.
        l_vbap_inx-itm_number            =  t_vbap-posnr.  " will have value
        l_vbap_inx-updateflag            = 'D'.
        APPEND l_vbap_inx.
        CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
             EXPORTING
                  salesdocument    = i_vbeln                   "will have order number
                  order_header_inx = l_vbak_inx            " will be paased with values 'U'
                  order_header_in  = header                 "will not hold any value
                  simulation       = i_simulate                  "space
             TABLES
                  return           = l_return
                  order_item_in    = l_vbap                   "bulk of order lines with 'D' flag
                  order_item_inx   = l_vbap_inx
                  extensionin      = l_vbap_ext.
    can you please suggest on this......
    Thanks in advance.

    HI ,
    Can any one of you please suggest me to amend the below given code which is used to  delete bulk of order lines from VBAP table.presently it is deleting first few order lines from VBAP and all order lines from VBEP and VBUP tables.when i execute the same program for second time  first left out order lines are getting deleted again.So..can any one please check the below code and suggest me something on this.
        REFRESH: l_return, l_vbap, l_vbap_inx, l_vbap_ext.
      IF xorder_delete = 'X'.
        l_vbak_inx-updateflag = 'D'.
    Even though all the order lines are to be deleted, the delete complete
    order flag says don't delete the header data
        IF i_cleanup = space.
          l_vbak_inx-updateflag = 'U'.
          PERFORM validate_line_count TABLES l_vbap_ext         "iw150709
                                       USING i_vbeln.           "iw150709
        ENDIF.
      ELSE.
        l_vbak_inx-updateflag = 'U'.
        PERFORM validate_line_count TABLES l_vbap_ext           "iw150709
                                     USING i_vbeln.             "iw150709
      ENDIF.
      LOOP AT t_vbap WHERE delete = 'X'.
        CLEAR: l_vbap.
        l_vbap-itm_number                =  t_vbap-posnr.
        APPEND l_vbap.
        CLEAR: l_vbap_inx.
        l_vbap_inx-itm_number            =  t_vbap-posnr.
        l_vbap_inx-updateflag            = 'D'.
        APPEND l_vbap_inx.
        CLEAR: l_vbap_ext, l_extension_vbapx.
        l_vbap_ext-structure             = 'BAPE_VBAPX'.
        l_extension_vbapx-vbeln          =  i_vbeln.
        l_extension_vbapx-posnr          =  t_vbap-posnr.
        l_extension_vbapx-zzco_reason    = 'X'.
        l_vbap_ext+30                    =  l_extension_vbapx.
        APPEND l_vbap_ext.
        CLEAR: l_vbap_ext, l_extension_vbap.
        l_vbap_ext-structure             = 'BAPE_VBAP'.
        l_extension_vbap-vbeln           =  i_vbeln.
        l_extension_vbap-posnr           =  t_vbap-posnr.
        l_extension_vbap-zzco_reason     =  i_reason.
        l_vbap_ext+30                    =  l_extension_vbap.
        APPEND l_vbap_ext.
      ENDLOOP.
    Only call BAPI if NOT in test mode.
      IF i_simulate = space.
        CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
             EXPORTING
                  salesdocument    = i_vbeln
                  order_header_inx = l_vbak_inx
                  order_header_in  = header
                  simulation       = i_simulate
             TABLES
                  return           = l_return
                  order_item_in    = l_vbap
                  order_item_inx   = l_vbap_inx
                  extensionin      = l_vbap_ext.
      ENDIF.
      LOOP AT l_return WHERE type = 'E' OR type = 'A'.
        MOVE-CORRESPONDING l_return TO t_messages.
        t_messages-field = 'VBELN'.
        APPEND t_messages.
      ENDLOOP.
    No ERRORs
      IF sy-subrc <> 0.
        IF i_simulate = space.
          CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
               IMPORTING
                    return = l_return.
    Edited by: manj1325 on Apr 9, 2010 8:19 AM

  • 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

  • Delete Sales order through BAPI_SALESORDER_CHANGE

    Hoi folks,..
      Can we delete the entire Sales order using BAPI_SALESORDER_CHANGE.  If yes, pls let me know the process?
    Thx

    HI,
    You can try to pass 'D' in the update flag of the header Structure.
    ie.. ORDER_HEADER_INX-UPDATEFLAG = 'D'
    and SALESDOCUMENT = 'The SO# to be deleted'.
    Hope this helps.
    Gary

  • Change Sales order using BAPI

    When trying to change a Sales order using BAPI_SALESORDER_CHANGE, I am getting the following error.
    SD document 15704 is not in the database or has been archived.
    Please let me know what could be the problem

    you have the error message, which is self explanatory.
    SD document 15704 is not in the database or has been archived.
    if you knat that the sales document indeed exists, and the  message is deceiving, then check why are yopu gettign that. maybe you didn;t provide the order# will leading zeros, or you are tryingto change an order immediately after creating, in which case DB commit might not be completed.

  • How to update Sales Order status using  BAPI_SALESORDER_CHANGE

    Hi,
    I want to update Sales Order status using BAPI_SALESORDER_CHANGE, this BAPI is called from middle ware, but there is no parameter to pass the status value to this function, please help me how to update sales order status using BAPI only.
    Thanks
    RK

    Hi,
    Can u give me details of what status u would like to update in sales order.
    If we are able to update the status from VA02, Then BAPI will assist for the same.
    Regards.

  • 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$

  • Quantity update into sales order using BAPI_SALESORDER_CREATEFROMDAT2

    Hi All,
    I am able to create a sales order using the BAPI "BAPI_SALESORDER_CREATEFROMDAT2".
    But even after assinging the Target_quntity and the Target_quantity_units, the values are not getting updated into the Sales order, but the sales order gets created .
    Did anyone of you had a similare problem, how was it solved.
    cold some one please help me out on this.
    Regards

    Hi
    I had used below code (using <b>BAPI_SALESORDER_CREATEFROMDAT1</b>)..but never faced any problem.. you can try the same...
    Regards,
    Raj
    REPORT  z_sd_salesorder_create
            NO STANDARD PAGE HEADING
            LINE-SIZE 150
            MESSAGE-ID zz.
                  S T R U C T U R E  D E C L A R A T I O N S             *
    TYPES: BEGIN OF x_ppl,
            ppl_order(18),   " ppl Orderno
            auart(4),         " Sales Doc Type
            vkorg(4),         " Sales Organization
            vtweg(2),         " Distribution Channel
            spart(2),         " Division
            div(3),           " Division
            kunnr(10),        " Sold-to Party
            date(10),         " Doc Dt
            matnr(18),        " Item Matnr#
            uom(3),           " UOM
            qty(15),          " Qty
           kschl(4),         " Pricing condiiton type
           kbetr(11),        " Rate
           END OF x_ppl.
    TYPES: BEGIN OF x_file,
            loc(30),          " Location
            div(3),           " Division
            ppl_order(18),   " ppl Orderno
            kunnr(10),        " Sold-to Party
            date(10),         " Doc Dt
            matnr(20),        " Item Matnr#
            qty(15),          " Qty
            uom(3),           " UOM
           kbetr(11),        " Rate
           discount(5),      " Discount
           END OF x_file.
    TYPES: BEGIN OF x_output,
            ppl_order(18),       " ppl Orderno
            mesg(130),            " Mesg Success/Error
           END OF x_output.
    TYPES: BEGIN OF x_werks,
            name2(30),                " Location
            werks TYPE werks_ext,     " Plant
           END OF x_werks.
    TYPES: BEGIN OF x_info,
            vkorg TYPE vkorg ,   " Sales org
            vtweg TYPE vtweg,    " Dist channel
            werks TYPE werks_ext," Plant
            spart TYPE spart,    " Storage Loc
           END OF x_info.
    TYPES: BEGIN OF x_material,
            ppl_prdid(20),      " ppl Prd id
            matnr TYPE matnr,    " Material (SAP)
           END OF x_material.
           I N T E R N A L    T A B L E    D E C L A R A T I O N S       *
    DATA: it_file  TYPE STANDARD TABLE OF x_file  WITH HEADER LINE." File Data
    DATA: it_data  TYPE STANDARD TABLE OF x_ppl  WITH HEADER LINE." ppl File
    DATA: it_out TYPE STANDARD TABLE OF x_output WITH HEADER LINE. " Outcome
    DATA: it_werks TYPE STANDARD TABLE OF x_werks WITH HEADER LINE.    " Plant
    DATA: it_info TYPE STANDARD TABLE OF x_info WITH HEADER LINE.      " Othr Info
    DATA: it_matnr TYPE STANDARD TABLE OF x_material WITH HEADER LINE. " Material Info
    DATA: it_item TYPE STANDARD TABLE OF bapiitemin WITH HEADER LINE.  "Order Itm data
    DATA: it_partner TYPE STANDARD TABLE OF bapipartnr WITH HEADER LINE. "Order Partner data
               V A R I A B L E S      D E C L A R A T I O N S            *
    DATA  : v_correct  TYPE i,
            v_error    TYPE i,
            v_total    TYPE i,
            v_return   LIKE bapireturn1,
            v_index    LIKE sy-tabix.
    *- Return values
    DATA: it_orderh TYPE bapisdhead, "Order Hdr data
          order TYPE bapivbeln-vbeln,
          soldto TYPE bapisoldto,
          shipto TYPE bapishipto,
          return TYPE bapireturn1.
    DATA: hdate   TYPE sy-datum.
                    U S E R   I N P U T S   S C R E E N                  *
    SELECTION-SCREEN: BEGIN OF BLOCK blk01 WITH FRAME TITLE text-t01.
    PARAMETERS: p_file TYPE rlgrap-filename OBLIGATORY. " File name
    SELECTION-SCREEN END OF BLOCK blk01.
                      S E L E C T I O N    S C R E E N                   *
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
      PERFORM get_file.
                    S t a r t    o f    S e l e c t i o n                *
    START-OF-SELECTION.
      PERFORM get_upload.
      PERFORM validate_data.        " Validate the data
      PERFORM data_swap.            " Prepare the data for processing
      IF NOT it_data[] IS INITIAL.
        PERFORM get_update.           " Create SalesOrders
      ELSE.
        MESSAGE i001(zz) WITH text-001.
        STOP.
      ENDIF.
                    E n d    o f    S e l e c t i o n                    *
    END-OF-SELECTION.
      IF NOT it_data[] IS INITIAL.
        PERFORM get_write.
      ENDIF.
    *&      Form  get_file
          Get File name
    FORM get_file .
      CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
        EXPORTING
          program_name  = syst-repid
          mask          = '*'
        CHANGING
          file_name     = p_file
        EXCEPTIONS
          mask_too_long = 1
          OTHERS        = 2.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
    ENDFORM.                    " get_file
    *&      Form  get_upload
          to upload the file
    FORM get_upload .
      DATA l_file TYPE string.
      CLEAR: it_file, it_file[].
      l_file = p_file.
      CALL FUNCTION 'GUI_UPLOAD'
        EXPORTING
          filename                = l_file
          filetype                = 'ASC'
          has_field_separator     = 'X'
        TABLES
          data_tab                = it_file
        EXCEPTIONS
          file_open_error         = 1
          file_read_error         = 2
          no_batch                = 3
          gui_refuse_filetransfer = 4
          invalid_type            = 5
          no_authority            = 6
          unknown_error           = 7
          bad_data_format         = 8
          header_not_allowed      = 9
          separator_not_allowed   = 10
          header_too_long         = 11
          unknown_dp_error        = 12
          access_denied           = 13
          dp_out_of_memory        = 14
          disk_full               = 15
          dp_timeout              = 16
          OTHERS                  = 17.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ELSEIF sy-subrc = 0.
        SORT it_file BY loc ppl_order.
      ENDIF.
    ENDFORM.                    " get_upload
    *&      Form  get_update
          Creating mapping Data in Z table
    FORM get_update .
      DATA: l_itemno(2) TYPE n,
            l_partner TYPE parvw,
            l_kunnr TYPE kunnr,
            l_matnr TYPE matnr,
            l_mesg TYPE string,
            l_kbetr TYPE p DECIMALS 2.
      DATA: l_in_qty LIKE vbap-zmeng,
            l_meins LIKE mara-meins,
            l_qty   LIKE vbap-zmeng.
      CLEAR: v_correct, v_error, v_total.
      SORT it_data BY ppl_order.
      LOOP AT it_data.
        CLEAR v_index.
        v_index = sy-tabix.
    *- New SalesOrder
        AT NEW ppl_order.
          READ TABLE it_data INDEX v_index.
          CLEAR: it_orderh, it_item, it_partner,
                 order, soldto, shipto, return,
                 it_item[], it_partner[].
          v_total = v_total + 1.  "Increment Total SalesOrders counter
          CLEAR l_itemno.
          l_itemno = '10'.
    *- Covert date fields into Internal format
          CALL FUNCTION 'CONVERT_DATE_TO_INTERN_FORMAT'
            EXPORTING
              datum = it_data-date
              dtype = 'DATS'
            IMPORTING
              idate = it_data-date.
    *- Populate SalesOrder header data.
          CALL FUNCTION 'CONVERSION_EXIT_AUART_INPUT'
            EXPORTING
              input  = it_data-auart
            IMPORTING
              output = it_data-auart.
          it_orderh-doc_type   = it_data-auart.
          it_orderh-sales_org  = it_data-vkorg.
          it_orderh-distr_chan = it_data-vtweg.
          it_orderh-division   = it_data-spart.
          it_orderh-purch_no   = 'DEPOT'.
          it_orderh-price_date = it_data-date.      "Doc Dt
          it_orderh-req_date_h = it_data-date.      "Del.Dt
          it_orderh-purch_no_s = it_data-ppl_order.
    *- Partner data
          CLEAR: l_partner, l_kunnr.
    *- Convert Partner type into internal format
          l_partner = 'SP'.  "SoldTo Party
          CALL FUNCTION 'CONVERSION_EXIT_PARVW_INPUT'
            EXPORTING
              input  = l_partner
            IMPORTING
              output = l_partner.
    *- Convert Customer into internal format
          l_kunnr = it_data-kunnr.
          CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
            EXPORTING
              input  = l_kunnr
            IMPORTING
              output = l_kunnr.
          it_partner-partn_role = l_partner.
          it_partner-partn_numb = l_kunnr.
          APPEND it_partner.
          CLEAR it_partner.
        ENDAT.
    *- Item data
        it_item-itm_number = l_itemno.
    *- Convert material number into internal format
        CLEAR l_matnr.
        l_matnr = it_data-matnr.
        CALL FUNCTION 'CONVERSION_EXIT_MATN1_INPUT'
          EXPORTING
            input        = l_matnr
          IMPORTING
            output       = l_matnr
          EXCEPTIONS
            length_error = 1
            OTHERS       = 2.
        IF sy-subrc <> 0.
          MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                  WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        ENDIF.
        it_item-material  = l_matnr.
    *- Call FM to get new qty based on SAP UOM
        CLEAR: l_meins, l_qty, l_in_qty.
        l_in_qty = it_data-qty.
        CALL FUNCTION 'Z_GET_QTY_FROM_UOM'
          EXPORTING
            matnr     = it_item-material
            in_meins  = it_data-uom
            in_qty    = l_in_qty
          IMPORTING
            out_meins = l_meins
            quantity  = l_qty.
        IF sy-subrc = 0.
          it_data-qty = l_qty.
          it_data-uom = l_meins.
        ENDIF.
        it_data-qty = it_data-qty * 1000.
        it_item-req_qty = it_data-qty.
        it_item-sales_unit = it_data-uom.
        it_item-req_date   = it_data-date.
    *- Pricing data
       it_item-cond_type = it_data-kschl.  "Pricing condition
       CLEAR l_kbetr.
       l_kbetr = it_data-kbetr / 10. "Price (Rate)
       it_item-cond_value = l_kbetr.
        APPEND it_item.
        CLEAR  it_item.
    *- Increment Item counter.
        l_itemno = l_itemno + 10.
    *- At end of SalesOrder
        AT END OF ppl_order.
          READ TABLE it_data INDEX v_index.
    *- Call the BAPI for SalesOrder creation
          CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT1'
            EXPORTING
              order_header_in = it_orderh
            IMPORTING
              salesdocument   = order
              sold_to_party   = soldto
              ship_to_party   = shipto
              return          = return
            TABLES
              order_items_in  = it_item
              order_partners  = it_partner.
          IF sy-subrc = 0.
            COMMIT WORK.
          ENDIF.
          v_return = return+0(1).
          IF v_return = 'E'.
            v_error = v_error + 1.
            CLEAR l_mesg.
            l_mesg = return.
            CONDENSE l_mesg.
          ELSE.
            v_correct = v_correct + 1.
            CLEAR l_mesg.
            CONCATENATE 'Salesorder'(007) order 'successfully created.'(008)
            INTO l_mesg SEPARATED BY space.
            CONDENSE l_mesg.
          ENDIF.
    *- Populate the output table
          CLEAR it_out.
          it_out-ppl_order = it_data-ppl_order.
          it_out-mesg = l_mesg.
          APPEND it_out.
          CLEAR it_out.
        ENDAT.
      ENDLOOP.
    ENDFORM.                    " get_update
    *&      Form  get_write
          Write the results
    FORM get_write .
      WRITE:/ 'Total Number of Records :'(002), v_total COLOR 1.
      WRITE:/ 'Total Correct Records   :'(003), v_correct COLOR 3.
      WRITE:/ 'Total Error Records     :'(004), v_error COLOR 6.
      SKIP 3.
      IF NOT it_out[] IS INITIAL.
        WRITE:/5 'ppl Order #'(005),
              28 'Message'(006).
      ENDIF.
      SKIP 1.
      LOOP AT it_out.
        WRITE:/5  it_out-ppl_order,
               28 it_out-mesg.
      ENDLOOP.
    ENDFORM.                    " get_write
    *&      Form  validate_data
          Validate the data
    FORM validate_data .
      DATA: l_bstkde TYPE bstkd_e.
      LOOP AT it_file.
        SELECT bstkd_e INTO l_bstkde
         UP TO 1 ROWS
         FROM vbkd
         WHERE bstkd_e = it_file-ppl_order.
        ENDSELECT.
        IF sy-subrc = 0.  " This ppl Order is already been created in SAP, so delete record
          DELETE it_file.
        ENDIF.
      ENDLOOP.
      SORT it_file BY ppl_order.
    ENDFORM.                    " validate_data
    *&      Form  data_swap
          Prepare the data for processing
    FORM data_swap .
      CLEAR: it_werks, it_info, it_matnr, it_data,
             it_werks[], it_info[], it_matnr[], it_data[].
      IF NOT it_file[] IS INITIAL.
    *- Get the plant from location
        SELECT name2
               werks
          INTO CORRESPONDING FIELDS OF TABLE it_werks
        FROM t001w FOR ALL ENTRIES IN it_file
        WHERE name2 = it_file-loc.
        IF sy-subrc = 0.
          SORT it_werks BY name2 werks.
    *- Get the Sales Org, Division and Distribution Channel
          IF NOT it_werks[] IS INITIAL.
            SELECT vkorg
                   vtweg
                   werks
            INTO CORRESPONDING FIELDS OF TABLE it_info
            FROM tvkwz FOR ALL ENTRIES IN it_werks
            WHERE werks = it_werks-werks.
            IF sy-subrc =  0.
              LOOP AT it_info.
                it_info-spart = '99'.
                MODIFY it_info INDEX sy-tabix.
              ENDLOOP.
              SORT it_info BY vkorg vtweg werks.
            ENDIF.
          ENDIF.
        ENDIF.
    *- Get material from ppl material
        SELECT ppl_prdid
               matnr
          FROM zppl_master
          INTO TABLE it_matnr FOR ALL ENTRIES IN it_file
          WHERE ppl_prdid = it_file-matnr.
        IF sy-subrc = 0.
          SORT it_matnr BY ppl_prdid matnr.
        ENDIF.
      ENDIF.
    *- Update the data in it_data
      LOOP AT it_file.
        CLEAR it_data.
       it_data-auart = 'OR'.
        it_data-auart = 'OR'.  " CHANGED BY Jo ON 3103005
        READ TABLE it_werks WITH KEY name2 = it_file-loc BINARY SEARCH.
        IF sy-subrc = 0.
          READ TABLE it_info WITH KEY werks = it_werks-werks BINARY SEARCH.
          IF sy-subrc = 0.
            it_data-vkorg = it_info-vkorg.
            it_data-vtweg = it_info-vtweg.
          ENDIF.
        ENDIF.
    *- Material
        READ TABLE it_matnr WITH KEY ppl_prdid = it_file-matnr BINARY SEARCH.
        IF sy-subrc = 0.
          it_data-matnr = it_matnr-matnr.
        ENDIF.
        it_data-ppl_order = it_file-ppl_order.
        it_data-date  = it_file-date.
        CONCATENATE it_file-kunnr it_file-loc+1(2) INTO it_data-kunnr.
        it_data-qty   = it_file-qty.
        it_data-uom   = it_file-uom.
       it_data-kbetr = it_file-kbetr.
    *- Pricing condition
       it_data-kschl = 'PR00'.
        CASE it_file-div.
          WHEN 'BRN'.
            it_data-div = '04'.
          WHEN 'GEN'.
            it_data-div = '03'.
          WHEN 'IVF'.
            it_data-div = '02'.
          WHEN 'OPH'.
            it_data-div = '01'.
        ENDCASE.
        it_data-spart = it_data-div.
        APPEND it_data.
        CLEAR  it_data.
      ENDLOOP.
    ENDFORM.                    " data_swap

  • Price is not being updated when creating a sales order using DTW oOrders

    Hello experts,
    When I create a sales Order using DTW (oOrders), the information in the input files document.csv and document_lines.csv is updated with no problem, except the price. The price is being ignored from the input files.
    Is there something that I must considered when trying to update the price of a sales order using the DTW?
    The field "price" was mapped in the source and target fields in DTW.
    Here is the document_lines.csv
    RecordKey,LineNum,AccountCode,Address,ItemCode,LineTotal,Price,Quantity,ShipDate,WarehouseCode,TaxCode
    RecordKey,LineNum,AccountCode,Address,ItemCode,LineTotal,Price,Quantity,ShipDate,WarehouseCode,TaxCode
    1,1,_SYS00000000059, ,30PA08-0360-25,1,11.2,3,20110702,V08,A5
    1,2,_SYS00000000059, ,30PA08-0707-25,1,15.2,3,20110702,V08,A5
    1,3,_SYS00000000059, ,30PA08-0707-22,1,18.3,3,20110702,V08,A5
    And the document.csv:
    RecordKey,DocEntry,CardCode,DocDate,DocDueDate,DocTotal
    RecordKey,DocEntry,CardCode,DocDate,DocDueDate,DocTotal
    1, ,c-6167,20110702,20110702,2
    Thank you for your help
    Jorge Manzo

    Hi,
    Try to re-create your dtw using my template,and use text tab when saving your template.
    SO-Header
    RecordKey     CardCode     CardName     Comments     DocDate     DocDueDate     DocNum
    RecordKey     CardCode     CardName     Comments     DocDate     DocDueDate     DocNum
    1     24-25 MANUFACTU     24-25 MANUFACTURING          4/5/2010     4/15/2010     11142
    SO-LINE
    RecordKey     linenum     itemcode     qty     uom      PriceAfterVAT      Price     SalesPersonCode
    RecordKey     linenum     itemcode     qty     uom      PriceAfterVAT      Price     SalesPersonCode
    1     0     SHAFT HEX 7/8"     1     pc     4536     4050     CRIS
    Note : Line -(LINE NUM and QTY is important upon computation of Price if SO is ITEM TYPE Document.
    hope this will help you!
    Regards,
    Darius

  • Update the material quantity in the sales order using LSMW...

    Hi Guru's,
    I created one sales order using BAPI..now i wanted update the material quantity in the sales order using LSMW...
    could you please provide the step by step process....
    if anyone of you provide the program logic similar to requirement that would be helpfull to me...
    thanks in advance
    Srinivas....

    Hi Sri,
    Hope it may help you.
    First do the recording for VA02 transaction, in that give the existing sales order number
    and update the Quantity and save it. Remaining steps are same what we used(LSMW) to upload data to applications.
    Regards,
    Vishvesh
    if helpful, rewards it.

  • Function Module or BAPI to update Sale Order Quantity (VBAP-kwmeng)

    Hi,
    I have a requirement to use a Function Module or BAPI to update Sale Order Quantity (VBAP-kwmeng), which one (Function Module or BAPI) should I use? is there any sample codes?
    Thanks a lot!!

    Hi,
    *& Report  ZTEST
    REPORT  ztest.
    DATA : wa_header TYPE bapisdh1x,
                i_item TYPE TABLE OF bapisditm WITH HEADER LINE,
                i_itemx TYPE TABLE OF bapisditmx WITH HEADER LINE,
                i_return TYPE TABLE OF bapiret2.
               wa_header-updateflag = 'U'.
               i_item-itm_number = '000010'.
               i_item-target_qty = '4'.
               APPEND i_item.
              i_itemx-itm_number = '000010'.
              i_itemx-updateflag = 'U'.
              i_itemx-target_qty = 'X'.
              APPEND i_itemx.
    CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
      EXPORTING
        salesdocument               = '1234567890'
        order_header_inx            = wa_header
      TABLES
        return                            = i_return
        order_item_in                 = i_item
        order_item_inx               = i_itemx
    Hope this will help you.
    Regards,
    Anand.

Maybe you are looking for