<?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 Re: inserting Condition price using BAPI_SALESORDER_CHANGE in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/inserting-condition-price-using-bapi-salesorder-change/m-p/5302576#M1222922</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi,&lt;/P&gt;&lt;P&gt;check below sample code, very important here is to set variable&lt;/P&gt;&lt;P&gt;LOGIC_SWITCH-COND_HANDL = 'X'.&lt;/P&gt;&lt;P&gt;regards, darek&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
  REFRESH: order_conditions_in, order_conditions_inx, order_items_in.
  DATA: pos_main LIKE vbap OCCURS 0 WITH HEADER LINE,
        pos_sub  LIKE vbap OCCURS 0 WITH HEADER LINE,
        zzkonv   LIKE konv OCCURS 0 WITH HEADER LINE,
        zzvbak   LIKE vbak.

  SELECT SINGLE * FROM vbak INTO zzvbak WHERE vbeln EQ salesdocument.
  CHECK sy-subrc EQ 0.

  SELECT * FROM vbap INTO TABLE pos_main WHERE vbeln EQ salesdocument.
  CHECK sy-subrc EQ 0.

  SELECT * FROM konv INTO TABLE zzkonv WHERE knumv EQ zzvbak-knumv.
  CHECK sy-subrc EQ 0.

  pos_sub[] = pos_main[].
  LOOP AT pos_main.
    CHECK not pos_main-posex is initial.
    read table order2_conditions_in
        with key itm_number = pos_main-posnr.
    CHECK sy-subrc EQ 0.
    order_conditions_in = order2_conditions_in.
    LOOP AT pos_sub WHERE uepos = pos_main-posnr.
      order_conditions_in-itm_number = pos_sub-posnr.
      MOVE-CORRESPONDING order_conditions_in TO order_conditions_inx.
      LOOP AT zzkonv WHERE
          kposn = pos_sub-posnr AND
          kschl = order_conditions_in-cond_type.
      ENDLOOP.
      IF sy-subrc EQ 0.
        order_conditions_in-COND_ST_NO  = zzkonv-stunr.
        order_conditions_in-COND_COUNT  = zzkonv-zaehk.
        MOVE-CORRESPONDING order_conditions_in TO order_conditions_inx.

        order_conditions_in-CONDORIGIN  = 'C'.
        order_conditions_in-cond_no     = zzkonv-knumh.
        order_conditions_in-COND_UPDAT  = 'X'.
        CLEAR: order_conditions_in-CURRENCY.
        APPEND order_conditions_in.

        order_conditions_inx-UPDATEFLAG = 'U'.
        order_conditions_inx-COND_VALUE = 'X'.
        order_conditions_inx-COND_P_UNT = ''.
        APPEND order_conditions_inx.
      ELSE.
        order_conditions_inx-UPDATEFLAG = 'I'.
        CLEAR: order_conditions_in-CURRENCY,
               order_conditions_in-COND_COUNT.
        APPEND order_conditions_in.
        APPEND order_conditions_inx.
      ENDIF.
    ENDLOOP.
  ENDLOOP.

  DATA: LOGIC_SWITCH LIKE  BAPISDLS.
  LOGIC_SWITCH-COND_HANDL = 'X'.
  order_header_inx-updateflag = 'U'.
  CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
    EXPORTING
      salesdocument    = salesdocument
      order_header_inx = order_header_inx
      LOGIC_SWITCH     = LOGIC_SWITCH
    TABLES
      return           = return
      conditions_in    = order_conditions_in
      conditions_inx   = order_conditions_inx.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 07 Mar 2009 10:46:02 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2009-03-07T10:46:02Z</dc:date>
    <item>
      <title>inserting Condition price using BAPI_SALESORDER_CHANGE</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/inserting-condition-price-using-bapi-salesorder-change/m-p/5302575#M1222921</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;I have been asked to develop a ZVa02 transaction. For that, I want to insert condition price using the BAPI_SALESORDER_CHANGE. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please let me know, what are all the inputs I need to give.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rajan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 07 Mar 2009 10:27:00 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/inserting-condition-price-using-bapi-salesorder-change/m-p/5302575#M1222921</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-03-07T10:27:00Z</dc:date>
    </item>
    <item>
      <title>Re: inserting Condition price using BAPI_SALESORDER_CHANGE</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/inserting-condition-price-using-bapi-salesorder-change/m-p/5302576#M1222922</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi,&lt;/P&gt;&lt;P&gt;check below sample code, very important here is to set variable&lt;/P&gt;&lt;P&gt;LOGIC_SWITCH-COND_HANDL = 'X'.&lt;/P&gt;&lt;P&gt;regards, darek&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
  REFRESH: order_conditions_in, order_conditions_inx, order_items_in.
  DATA: pos_main LIKE vbap OCCURS 0 WITH HEADER LINE,
        pos_sub  LIKE vbap OCCURS 0 WITH HEADER LINE,
        zzkonv   LIKE konv OCCURS 0 WITH HEADER LINE,
        zzvbak   LIKE vbak.

  SELECT SINGLE * FROM vbak INTO zzvbak WHERE vbeln EQ salesdocument.
  CHECK sy-subrc EQ 0.

  SELECT * FROM vbap INTO TABLE pos_main WHERE vbeln EQ salesdocument.
  CHECK sy-subrc EQ 0.

  SELECT * FROM konv INTO TABLE zzkonv WHERE knumv EQ zzvbak-knumv.
  CHECK sy-subrc EQ 0.

  pos_sub[] = pos_main[].
  LOOP AT pos_main.
    CHECK not pos_main-posex is initial.
    read table order2_conditions_in
        with key itm_number = pos_main-posnr.
    CHECK sy-subrc EQ 0.
    order_conditions_in = order2_conditions_in.
    LOOP AT pos_sub WHERE uepos = pos_main-posnr.
      order_conditions_in-itm_number = pos_sub-posnr.
      MOVE-CORRESPONDING order_conditions_in TO order_conditions_inx.
      LOOP AT zzkonv WHERE
          kposn = pos_sub-posnr AND
          kschl = order_conditions_in-cond_type.
      ENDLOOP.
      IF sy-subrc EQ 0.
        order_conditions_in-COND_ST_NO  = zzkonv-stunr.
        order_conditions_in-COND_COUNT  = zzkonv-zaehk.
        MOVE-CORRESPONDING order_conditions_in TO order_conditions_inx.

        order_conditions_in-CONDORIGIN  = 'C'.
        order_conditions_in-cond_no     = zzkonv-knumh.
        order_conditions_in-COND_UPDAT  = 'X'.
        CLEAR: order_conditions_in-CURRENCY.
        APPEND order_conditions_in.

        order_conditions_inx-UPDATEFLAG = 'U'.
        order_conditions_inx-COND_VALUE = 'X'.
        order_conditions_inx-COND_P_UNT = ''.
        APPEND order_conditions_inx.
      ELSE.
        order_conditions_inx-UPDATEFLAG = 'I'.
        CLEAR: order_conditions_in-CURRENCY,
               order_conditions_in-COND_COUNT.
        APPEND order_conditions_in.
        APPEND order_conditions_inx.
      ENDIF.
    ENDLOOP.
  ENDLOOP.

  DATA: LOGIC_SWITCH LIKE  BAPISDLS.
  LOGIC_SWITCH-COND_HANDL = 'X'.
  order_header_inx-updateflag = 'U'.
  CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
    EXPORTING
      salesdocument    = salesdocument
      order_header_inx = order_header_inx
      LOGIC_SWITCH     = LOGIC_SWITCH
    TABLES
      return           = return
      conditions_in    = order_conditions_in
      conditions_inx   = order_conditions_inx.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 07 Mar 2009 10:46:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/inserting-condition-price-using-bapi-salesorder-change/m-p/5302576#M1222922</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-03-07T10:46:02Z</dc:date>
    </item>
    <item>
      <title>Re: inserting Condition price using BAPI_SALESORDER_CHANGE</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/inserting-condition-price-using-bapi-salesorder-change/m-p/5302577#M1222923</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, &lt;/P&gt;&lt;P&gt;The following is working code for updating pricing conditions.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;U need to give the step_nr, item_nr, cond_count and cond_type so the correct conditon will be updated. If no condition exists for the given parameters, a new condition will be created.&lt;/P&gt;&lt;P&gt;U can find these parameters for a particular condition type in table KONV.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;amp;----&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;*&amp;amp; Form saveTransactionJOCR&lt;/P&gt;&lt;P&gt;&amp;amp;----&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;text &lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;--&amp;gt; p1 text &lt;/P&gt;&lt;P&gt;&amp;lt;-- p2 text &lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------------" /&gt;&lt;P&gt;FORM saveTransactionJOCR .&lt;/P&gt;&lt;P&gt;data: salesdocument like BAPIVBELN-VBELN,&lt;/P&gt;&lt;P&gt;order_header_inx like bapisdh1x,&lt;/P&gt;&lt;P&gt;order_header_in like bapisdh1,&lt;/P&gt;&lt;P&gt;return type standard table of bapiret2 with header line,&lt;/P&gt;&lt;P&gt;conditions_in type standard table of bapicond with header line,&lt;/P&gt;&lt;P&gt;conditions_inx type standard table of bapicondx with header line,&lt;/P&gt;&lt;P&gt;logic_switch like BAPISDLS,&lt;/P&gt;&lt;P&gt;step_nr like conditions_in-cond_st_no,&lt;/P&gt;&lt;P&gt;item_nr like conditions_in-itm_number,&lt;/P&gt;&lt;P&gt;cond_count like conditions_in-cond_count,&lt;/P&gt;&lt;P&gt;cond_type like conditions_in-cond_type.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;salesdocument = wa_order_information-VBELN.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOGIC_SWITCH-COND_HANDL = 'X'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;order_header_inx-updateflag = 'U'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;conditions &lt;/P&gt;&lt;P&gt;clear conditions_in[].&lt;/P&gt;&lt;P&gt;clear conditions_inx[].&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;clear: step_nr,&lt;/P&gt;&lt;P&gt;item_nr,&lt;/P&gt;&lt;P&gt;cond_count,&lt;/P&gt;&lt;P&gt;cond_type.&lt;/P&gt;&lt;P&gt;step_nr = '710'.&lt;/P&gt;&lt;P&gt;item_nr = '000000'.&lt;/P&gt;&lt;P&gt;cond_count = '01'.&lt;/P&gt;&lt;P&gt;cond_type = 'ZCP2'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CONDITIONS_IN-ITM_NUMBER = item_nr.&lt;/P&gt;&lt;P&gt;conditions_in-cond_st_no = step_nr.&lt;/P&gt;&lt;P&gt;CONDITIONS_IN-COND_COUNT = cond_count.&lt;/P&gt;&lt;P&gt;CONDITIONS_IN-COND_TYPE = cond_type.&lt;/P&gt;&lt;P&gt;CONDITIONS_IN-COND_VALUE = 666.&lt;/P&gt;&lt;P&gt;CONDITIONS_IN-CURRENCY = 'EUR'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;append conditions_in.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CONDITIONS_INX-ITM_NUMBER = item_nr.&lt;/P&gt;&lt;P&gt;conditions_inx-cond_st_no = step_nr.&lt;/P&gt;&lt;P&gt;CONDITIONS_INX-COND_COUNT = cond_count.&lt;/P&gt;&lt;P&gt;CONDITIONS_INX-COND_TYPE = cond_type.&lt;/P&gt;&lt;P&gt;CONDITIONS_INX-UPDATEFLAG = 'U'.&lt;/P&gt;&lt;P&gt;CONDITIONS_INX-COND_VALUE = 'X'.&lt;/P&gt;&lt;P&gt;CONDITIONS_INX-CURRENCY = 'X'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;append conditions_inx.&lt;/P&gt;&lt;P&gt;&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 = salesdocument&lt;/P&gt;&lt;P&gt;ORDER_HEADER_IN = order_header_in&lt;/P&gt;&lt;P&gt;ORDER_HEADER_INX = order_header_inx&lt;/P&gt;&lt;P&gt;LOGIC_SWITCH = logic_switch&lt;/P&gt;&lt;P&gt;TABLES&lt;/P&gt;&lt;P&gt;RETURN = return&lt;/P&gt;&lt;P&gt;CONDITIONS_IN = conditions_in&lt;/P&gt;&lt;P&gt;CONDITIONS_INX = conditions_inx&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if return-type ne 'E'.&lt;/P&gt;&lt;P&gt;commit work and wait.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDFORM. " saveTransactionJOCR&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope this works for u too.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Asit Purbey.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Asit Purbey on Mar 9, 2009 6:34 AM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 Mar 2009 05:34:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/inserting-condition-price-using-bapi-salesorder-change/m-p/5302577#M1222923</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-03-09T05:34:34Z</dc:date>
    </item>
  </channel>
</rss>

