<?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: NEW INSERT WITH MODIFY in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/new-insert-with-modify/m-p/12113991#M1973771</link>
    <description>&lt;P&gt;Please use the CODE button to format your code so that it's shown in a more user-friendly format (colorized).&lt;/P&gt;</description>
    <pubDate>Wed, 23 Oct 2019 18:47:22 GMT</pubDate>
    <dc:creator>Sandra_Rossi</dc:creator>
    <dc:date>2019-10-23T18:47:22Z</dc:date>
    <item>
      <title>NEW INSERT WITH MODIFY</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/new-insert-with-modify/m-p/12113988#M1973768</link>
      <description>&lt;P&gt;Hi i am new to SAP have a doubt , can anyone clarify it.. I have this program &lt;/P&gt;
  &lt;P&gt;Here need to change Pname(record from AC TO TC) i used modify but not working... &lt;/P&gt;
  &lt;P&gt;TYPES: BEGIN OF ty_product,&lt;/P&gt;
  &lt;P&gt; pid(10) TYPE c, &lt;/P&gt;
  &lt;P&gt; pname(20) TYPE c,&lt;/P&gt;
  &lt;P&gt; pamount TYPE i, &lt;/P&gt;
  &lt;P&gt; END OF ty_product. &lt;/P&gt;
  &lt;P&gt;DATA: it TYPE TABLE OF ty_product,&lt;/P&gt;
  &lt;P&gt; wa TYPE ty_product. DATA:&lt;/P&gt;
  &lt;P&gt; gv_tabix TYPE sy-tabix.&lt;/P&gt;
  &lt;P&gt; * Index1 wa-pid = 'IFB1'. &lt;/P&gt;
  &lt;P&gt;wa-pname = 'WASHING MACHINE'.&lt;/P&gt;
  &lt;P&gt; wa-pamount = 31000.&lt;/P&gt;
  &lt;P&gt; INSERT wa INTO TABLE it. *&lt;/P&gt;
  &lt;P&gt; Index2 wa-pid = 'IFB2'.&lt;/P&gt;
  &lt;P&gt; wa-pname = 'FRIDGE'. &lt;/P&gt;
  &lt;P&gt;wa-pamount = 32000.&lt;/P&gt;
  &lt;P&gt; INSERT wa INTO TABLE it. &lt;/P&gt;
  &lt;P&gt;*Index3 wa-pid = 'IFB3'. &lt;/P&gt;
  &lt;P&gt;wa-pname = 'AC'.&lt;/P&gt;
  &lt;P&gt; wa-pamount = 35000. &lt;/P&gt;
  &lt;P&gt;INSERT wa INTO TABLE it.&lt;/P&gt;
  &lt;P&gt; LOOP AT it INTO wa. &lt;/P&gt;
  &lt;P&gt; IF sy-subrc = 0. &lt;/P&gt;
  &lt;P&gt; gv_tabix = sy-tabix. &lt;/P&gt;
  &lt;P&gt;MODIFY it FROM wa INDEX gv_tabix TRANSPORTING pname . &lt;/P&gt;
  &lt;P&gt; wa-pname = 'TV'. * MODIFY it FROM wa INDEX 3 TRANSPORTING pname.&lt;/P&gt;
  &lt;P&gt; * READ TABLE it INTO wa INDEX gv_tabix. &lt;/P&gt;
  &lt;P&gt;* MODIFY it FROM wa INDEX 3 TRANSPORTING pname .&lt;/P&gt;
  &lt;P&gt; WRITE: / wa-pid , wa-pname , wa-pamount. &lt;/P&gt;
  &lt;P&gt; ELSE.&lt;/P&gt;
  &lt;P&gt; WRITE: 'No record found'.&lt;/P&gt;
  &lt;P&gt; ENDIF.&lt;/P&gt;
  &lt;P&gt; ENDLOOP.&lt;/P&gt;</description>
      <pubDate>Wed, 23 Oct 2019 11:50:15 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/new-insert-with-modify/m-p/12113988#M1973768</guid>
      <dc:creator>divsmart</dc:creator>
      <dc:date>2019-10-23T11:50:15Z</dc:date>
    </item>
    <item>
      <title>Re: NEW INSERT WITH MODIFY</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/new-insert-with-modify/m-p/12113989#M1973769</link>
      <description>&lt;P&gt;First of all, make sure your code is reviewed.&lt;/P&gt;&lt;P&gt;As far as your code is concerned, make the below change. (It's a basic change, which will get the desired output for you, but not advisable to full extent, in case we modify inside loop)&lt;/P&gt;&lt;P&gt;Inside your loop&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;IF sy-subrc = 0.
    gv_tabix = sy-tabix.
    IF wa-pname = 'AC'.
      wa-pname = 'TV'.
      MODIFY it FROM wa INDEX gv_tabix TRANSPORTING pname .
    ENDIF.
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 23 Oct 2019 12:03:13 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/new-insert-with-modify/m-p/12113989#M1973769</guid>
      <dc:creator>mohit_dev</dc:creator>
      <dc:date>2019-10-23T12:03:13Z</dc:date>
    </item>
    <item>
      <title>Re: NEW INSERT WITH MODIFY</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/new-insert-with-modify/m-p/12113990#M1973770</link>
      <description>&lt;P&gt;Hello &lt;A href="https://answers.sap.com/users/512120/divsmart.html"&gt;senthil gajendran&lt;/A&gt;,&lt;/P&gt;&lt;P&gt;Kindly use the CODE button to paste the code lines.&lt;/P&gt;&lt;P&gt;About the solution, The sequence in which you have written the code is wrong. Before you write MODIFY statement you should have assigned the value in Work area. What you have done is you are modifying the the table before the value is assigned.&lt;/P&gt;&lt;P&gt;By doing the below code change your code should work. To explain you are modifying the internal table from work area which is holding the value that needs to be changed. &lt;/P&gt;&lt;P&gt;By mentioning the TRANSPORTING Keyword you are explicitly mentioning which field needs to be changed. Hope you understood the concepts.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;wa-pname = 'TV'. 
MODIFY it FROM wa INDEX gv_tabix TRANSPORTING pname .
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Regards!&lt;/P&gt;</description>
      <pubDate>Wed, 23 Oct 2019 12:11:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/new-insert-with-modify/m-p/12113990#M1973770</guid>
      <dc:creator>former_member1716</dc:creator>
      <dc:date>2019-10-23T12:11:53Z</dc:date>
    </item>
    <item>
      <title>Re: NEW INSERT WITH MODIFY</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/new-insert-with-modify/m-p/12113991#M1973771</link>
      <description>&lt;P&gt;Please use the CODE button to format your code so that it's shown in a more user-friendly format (colorized).&lt;/P&gt;</description>
      <pubDate>Wed, 23 Oct 2019 18:47:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/new-insert-with-modify/m-p/12113991#M1973771</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2019-10-23T18:47:22Z</dc:date>
    </item>
  </channel>
</rss>

