<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Help regarding BAPI_SALESORDER_CHANGE in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-regarding-bapi-salesorder-change/m-p/4993677#M1163060</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Could any one of you plz provide the solution for the below problem:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1) I am processing the BAPI_SALESORDER_CHANGE to MODIFy the Quantity of existing line item and simultaneously INSERT a New ITEM.&lt;/P&gt;&lt;P&gt; 2) When I am only modifying the REQ_QTY of 2 or more items it is processing correctly.&lt;/P&gt;&lt;P&gt;3) And if i INSERT a new item then it is INSERTING all fields correctly.&lt;/P&gt;&lt;P&gt;  BUT if I both MODIFY the quantity of line item  AND INSERT a new item .The Quantity of existing item is getting Updated Correctly.&lt;/P&gt;&lt;P&gt; BUT the Quanity of new Item is not the Quantity we send through the IDOC it is showing some different Quantity.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am filling the following fields in my code :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For MODIFYING an existing Line Item QUANTITY:&lt;/P&gt;&lt;P&gt;                    wa_item_bapi-sales_unit = 'CT'.&lt;/P&gt;&lt;P&gt;                    wa_item_bapi-itm_number = '156'.&lt;/P&gt;&lt;P&gt;                    APPEND wa_item_bapi TO i_item_bapi.&lt;/P&gt;&lt;P&gt;*********UPDATE i_item_BAPIX&lt;/P&gt;&lt;P&gt;                    wa_item_bapix-itm_number = '156'.&lt;/P&gt;&lt;P&gt;                    wa_item_bapix-updateflag = c_u.&lt;/P&gt;&lt;P&gt;                    wa_item_bapix-sales_unit = c_x.&lt;/P&gt;&lt;P&gt;                    APPEND wa_item_bapix TO i_item_bapix.&lt;/P&gt;&lt;P&gt;wa_schedule-itm_number = lv_posnr.&lt;/P&gt;&lt;P&gt;                      wa_schedule-sched_line = '0001'.&lt;/P&gt;&lt;P&gt;                      wa_schedule-req_qty    =  15.&lt;/P&gt;&lt;P&gt;                      wa_schedule-sched_type = CN.&lt;/P&gt;&lt;P&gt;                      APPEND wa_schedule TO i_schedule.&lt;/P&gt;&lt;P&gt;**UPDATE i_scheduleX&lt;/P&gt;&lt;P&gt;                      wa_schedulex-itm_number = 156.&lt;/P&gt;&lt;P&gt;                      wa_schedulex-sched_line = 0001.&lt;/P&gt;&lt;P&gt;                      wa_schedulex-sched_type = c_x.&lt;/P&gt;&lt;P&gt;                      wa_schedulex-updateflag = c_u.&lt;/P&gt;&lt;P&gt;                      wa_schedulex-req_qty    = c_x.&lt;/P&gt;&lt;P&gt;                      APPEND wa_schedulex TO i_schedulex.&lt;/P&gt;&lt;P&gt;       After this I am passing these internal tables to BAPI_SALESORDER_CHANGE&lt;/P&gt;&lt;P&gt;For INSERTING a NEW LINE ITEM.&lt;/P&gt;&lt;P&gt;                wa_item_bapi-sales_unit = 'CT'.&lt;/P&gt;&lt;P&gt;                wa_item_bapi-itm_number = '157'.&lt;/P&gt;&lt;P&gt;               wa_item_bapi-hg_lv_item = '156'(this field we are passing the item number of existing item in the Salesorder)&lt;/P&gt;&lt;P&gt;                wa_item_bapi-po_itm_no  = Blank.&lt;/P&gt;&lt;P&gt;                wa_item_bapi-material   = gv_codmat.&lt;/P&gt;&lt;P&gt;                wa_item_bapi-plant      =  ITPA.&lt;/P&gt;&lt;P&gt;                wa_item_bapi-item_categ = 'xxxx'.&lt;/P&gt;&lt;P&gt;                APPEND wa_item_bapi TO i_item_bapi.&lt;/P&gt;&lt;P&gt;*UPDATE i_item_BAPIX&lt;/P&gt;&lt;P&gt;                wa_item_bapix-updateflag = c_i.&lt;/P&gt;&lt;P&gt;                wa_item_bapix-material   = c_x.&lt;/P&gt;&lt;P&gt;                wa_item_bapix-sales_unit = c_x.&lt;/P&gt;&lt;P&gt;                wa_item_bapix-plant      = c_x.&lt;/P&gt;&lt;P&gt;                wa_item_bapix-item_categ = c_x.&lt;/P&gt;&lt;P&gt;              wa_item_bapix-hg_lv_item = c_x.&lt;/P&gt;&lt;P&gt;                wa_item_bapix-itm_number = c_x.&lt;/P&gt;&lt;P&gt;                wa_item_bapix-po_itm_no  = c_x.&lt;/P&gt;&lt;P&gt;                APPEND wa_item_bapix TO i_item_bapix.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;wa_schedule-itm_number = '157'.&lt;/P&gt;&lt;P&gt;                  wa_schedule-sched_line = 0001.(this schedule line is that of item existing already in Sales order for item 156)&lt;/P&gt;&lt;P&gt;                  wa_schedule-sched_type = CN(this schedule type is that of item existing already in Sales order for item 156)&lt;/P&gt;&lt;P&gt;                  wa_schedule-req_qty    = 15.&lt;/P&gt;&lt;P&gt;                  APPEND wa_schedule TO i_schedule.&lt;/P&gt;&lt;P&gt;*UPDATE i_scheduleX&lt;/P&gt;&lt;P&gt;                  wa_schedulex-itm_number = '157'.&lt;/P&gt;&lt;P&gt;                  wa_schedulex-sched_line = 0001(this schedule line is that of item existing already in Sales order for item 156)&lt;/P&gt;&lt;P&gt;                  wa_schedulex-sched_type = c_x.&lt;/P&gt;&lt;P&gt;                  wa_schedulex-updateflag = c_i.&lt;/P&gt;&lt;P&gt;                  wa_schedulex-req_qty    = c_x.&lt;/P&gt;&lt;P&gt;                  APPEND wa_schedulex TO i_schedulex.&lt;/P&gt;&lt;P&gt;Now i process the BAPI_SALESORDER_CHANGE&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Could any one plz provide help on it?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 11 Jan 2009 08:23:33 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2009-01-11T08:23:33Z</dc:date>
    <item>
      <title>Help regarding BAPI_SALESORDER_CHANGE</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-regarding-bapi-salesorder-change/m-p/4993677#M1163060</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Could any one of you plz provide the solution for the below problem:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1) I am processing the BAPI_SALESORDER_CHANGE to MODIFy the Quantity of existing line item and simultaneously INSERT a New ITEM.&lt;/P&gt;&lt;P&gt; 2) When I am only modifying the REQ_QTY of 2 or more items it is processing correctly.&lt;/P&gt;&lt;P&gt;3) And if i INSERT a new item then it is INSERTING all fields correctly.&lt;/P&gt;&lt;P&gt;  BUT if I both MODIFY the quantity of line item  AND INSERT a new item .The Quantity of existing item is getting Updated Correctly.&lt;/P&gt;&lt;P&gt; BUT the Quanity of new Item is not the Quantity we send through the IDOC it is showing some different Quantity.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am filling the following fields in my code :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For MODIFYING an existing Line Item QUANTITY:&lt;/P&gt;&lt;P&gt;                    wa_item_bapi-sales_unit = 'CT'.&lt;/P&gt;&lt;P&gt;                    wa_item_bapi-itm_number = '156'.&lt;/P&gt;&lt;P&gt;                    APPEND wa_item_bapi TO i_item_bapi.&lt;/P&gt;&lt;P&gt;*********UPDATE i_item_BAPIX&lt;/P&gt;&lt;P&gt;                    wa_item_bapix-itm_number = '156'.&lt;/P&gt;&lt;P&gt;                    wa_item_bapix-updateflag = c_u.&lt;/P&gt;&lt;P&gt;                    wa_item_bapix-sales_unit = c_x.&lt;/P&gt;&lt;P&gt;                    APPEND wa_item_bapix TO i_item_bapix.&lt;/P&gt;&lt;P&gt;wa_schedule-itm_number = lv_posnr.&lt;/P&gt;&lt;P&gt;                      wa_schedule-sched_line = '0001'.&lt;/P&gt;&lt;P&gt;                      wa_schedule-req_qty    =  15.&lt;/P&gt;&lt;P&gt;                      wa_schedule-sched_type = CN.&lt;/P&gt;&lt;P&gt;                      APPEND wa_schedule TO i_schedule.&lt;/P&gt;&lt;P&gt;**UPDATE i_scheduleX&lt;/P&gt;&lt;P&gt;                      wa_schedulex-itm_number = 156.&lt;/P&gt;&lt;P&gt;                      wa_schedulex-sched_line = 0001.&lt;/P&gt;&lt;P&gt;                      wa_schedulex-sched_type = c_x.&lt;/P&gt;&lt;P&gt;                      wa_schedulex-updateflag = c_u.&lt;/P&gt;&lt;P&gt;                      wa_schedulex-req_qty    = c_x.&lt;/P&gt;&lt;P&gt;                      APPEND wa_schedulex TO i_schedulex.&lt;/P&gt;&lt;P&gt;       After this I am passing these internal tables to BAPI_SALESORDER_CHANGE&lt;/P&gt;&lt;P&gt;For INSERTING a NEW LINE ITEM.&lt;/P&gt;&lt;P&gt;                wa_item_bapi-sales_unit = 'CT'.&lt;/P&gt;&lt;P&gt;                wa_item_bapi-itm_number = '157'.&lt;/P&gt;&lt;P&gt;               wa_item_bapi-hg_lv_item = '156'(this field we are passing the item number of existing item in the Salesorder)&lt;/P&gt;&lt;P&gt;                wa_item_bapi-po_itm_no  = Blank.&lt;/P&gt;&lt;P&gt;                wa_item_bapi-material   = gv_codmat.&lt;/P&gt;&lt;P&gt;                wa_item_bapi-plant      =  ITPA.&lt;/P&gt;&lt;P&gt;                wa_item_bapi-item_categ = 'xxxx'.&lt;/P&gt;&lt;P&gt;                APPEND wa_item_bapi TO i_item_bapi.&lt;/P&gt;&lt;P&gt;*UPDATE i_item_BAPIX&lt;/P&gt;&lt;P&gt;                wa_item_bapix-updateflag = c_i.&lt;/P&gt;&lt;P&gt;                wa_item_bapix-material   = c_x.&lt;/P&gt;&lt;P&gt;                wa_item_bapix-sales_unit = c_x.&lt;/P&gt;&lt;P&gt;                wa_item_bapix-plant      = c_x.&lt;/P&gt;&lt;P&gt;                wa_item_bapix-item_categ = c_x.&lt;/P&gt;&lt;P&gt;              wa_item_bapix-hg_lv_item = c_x.&lt;/P&gt;&lt;P&gt;                wa_item_bapix-itm_number = c_x.&lt;/P&gt;&lt;P&gt;                wa_item_bapix-po_itm_no  = c_x.&lt;/P&gt;&lt;P&gt;                APPEND wa_item_bapix TO i_item_bapix.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;wa_schedule-itm_number = '157'.&lt;/P&gt;&lt;P&gt;                  wa_schedule-sched_line = 0001.(this schedule line is that of item existing already in Sales order for item 156)&lt;/P&gt;&lt;P&gt;                  wa_schedule-sched_type = CN(this schedule type is that of item existing already in Sales order for item 156)&lt;/P&gt;&lt;P&gt;                  wa_schedule-req_qty    = 15.&lt;/P&gt;&lt;P&gt;                  APPEND wa_schedule TO i_schedule.&lt;/P&gt;&lt;P&gt;*UPDATE i_scheduleX&lt;/P&gt;&lt;P&gt;                  wa_schedulex-itm_number = '157'.&lt;/P&gt;&lt;P&gt;                  wa_schedulex-sched_line = 0001(this schedule line is that of item existing already in Sales order for item 156)&lt;/P&gt;&lt;P&gt;                  wa_schedulex-sched_type = c_x.&lt;/P&gt;&lt;P&gt;                  wa_schedulex-updateflag = c_i.&lt;/P&gt;&lt;P&gt;                  wa_schedulex-req_qty    = c_x.&lt;/P&gt;&lt;P&gt;                  APPEND wa_schedulex TO i_schedulex.&lt;/P&gt;&lt;P&gt;Now i process the BAPI_SALESORDER_CHANGE&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Could any one plz provide help on it?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 11 Jan 2009 08:23:33 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/help-regarding-bapi-salesorder-change/m-p/4993677#M1163060</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-01-11T08:23:33Z</dc:date>
    </item>
    <item>
      <title>Re: Help regarding BAPI_SALESORDER_CHANGE</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-regarding-bapi-salesorder-change/m-p/4993678#M1163061</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I had similar problem and apparently finding the right Itm_number is critical.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Get from VBAP all the records&lt;/P&gt;&lt;P&gt;  SELECT VBELN POSNR MATNR kwmeng INTO TABLE IT_VBAP&lt;/P&gt;&lt;P&gt;    FROM VBAP WHERE VBELN = P_VBELN.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Get the value by which SAP increments the POSNR&lt;/P&gt;&lt;P&gt;  SELECT SINGLE INCPO INTO lv_incr FROM TVAK WHERE AUART = P_ORD_TYP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Get the last item record&lt;/P&gt;&lt;P&gt;  sort it_vbap by vbeln ascending posnr descending.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  read table it_vbap into wa_vbap index 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Get the item number that SAP will assign&lt;/P&gt;&lt;P&gt;  lv_itm_num = lv_incr + wa_vbap-posnr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For new items that are to be added.&lt;/P&gt;&lt;P&gt;CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'&lt;/P&gt;&lt;P&gt;        EXPORTING&lt;/P&gt;&lt;P&gt;          INPUT  = input_matnr&lt;/P&gt;&lt;P&gt;        IMPORTING&lt;/P&gt;&lt;P&gt;          OUTPUT = lt_so_itm_in-material.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      lt_so_itm_in-ITM_NUMBER = lv_itm_num.&lt;/P&gt;&lt;P&gt;      APPEND lt_so_itm_in.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      lt_so_itm_inx-updateflag = c_i.&lt;/P&gt;&lt;P&gt;      lt_so_itm_inx-material   = c_x.&lt;/P&gt;&lt;P&gt;      lt_so_itm_inX-ITM_NUMBER = lv_itm_num.&lt;/P&gt;&lt;P&gt;      APPEND lt_so_itm_inx.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      lt_so_sch_in-ITM_NUMBER = lv_itm_num.&lt;/P&gt;&lt;P&gt;      lt_so_sch_in-REQ_QTY    =  lv_MENGE.&lt;/P&gt;&lt;P&gt;      append lt_so_sch_in.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      lt_so_sch_in-ITM_NUMBER = lv_itm_num.&lt;/P&gt;&lt;P&gt;      lt_so_sch_inx-UPDATEFLAG = c_i.&lt;/P&gt;&lt;P&gt;      lt_so_sch_inx-REQ_QTY    =  c_x.&lt;/P&gt;&lt;P&gt;      append lt_so_sch_inx.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      lv_itm_num = lv_itm_num + lv_incr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*The BAPI call looks like below&lt;/P&gt;&lt;P&gt; CLEAR: lt_so_rtn[], lt_so_rtn.&lt;/P&gt;&lt;P&gt;    CALL FUNCTION 'BAPI_SALESORDER_CHANGE'&lt;/P&gt;&lt;P&gt;      EXPORTING&lt;/P&gt;&lt;P&gt;        salesdocument    = lv_sodoc&lt;/P&gt;&lt;P&gt;        order_header_inx = lst_so_hdr_inx&lt;/P&gt;&lt;P&gt;      TABLES&lt;/P&gt;&lt;P&gt;        return           = lt_so_rtn&lt;/P&gt;&lt;P&gt;        order_item_in    = lt_so_itm_in&lt;/P&gt;&lt;P&gt;        order_item_inx   = lt_so_itm_inx&lt;/P&gt;&lt;P&gt;        SCHEDULE_LINES   = lt_so_sch_in&lt;/P&gt;&lt;P&gt;        SCHEDULE_LINESx  = lt_so_sch_inx.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    READ TABLE lt_so_rtn WITH KEY type = c_e.&lt;/P&gt;&lt;P&gt;    IF sy-subrc &amp;lt;&amp;gt; 0.         "No errors found&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;    Transaction Commit&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;      CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'&lt;/P&gt;&lt;P&gt;        EXPORTING&lt;/P&gt;&lt;P&gt;          wait = 'X'.&lt;/P&gt;&lt;P&gt;    endif.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Apr 2009 19:24:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/help-regarding-bapi-salesorder-change/m-p/4993678#M1163061</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-04-20T19:24:55Z</dc:date>
    </item>
  </channel>
</rss>

