<?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: Modify statment is not modifng correct rows... in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/modify-statment-is-not-modifng-correct-rows/m-p/5794734#M1310576</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You cannot MODIFY the records in this manner...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rather what you can do is...instead of LOOPING ITAB2...you can loop ITAB_FINAL and pass the data...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Check below:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

LOOP AT ITAB_final ASSIGNING &amp;lt;fs_itab_final&amp;gt;.

* Read the data from ITAB based on some condition...
&amp;lt;fs_itab_final&amp;gt;-field1 = gs_itab-field1.
....................................................
....................................................

ENDLOOP.

* Now no need of modify, since you have used a field symbol

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 17 Jun 2009 14:49:17 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2009-06-17T14:49:17Z</dc:date>
    <item>
      <title>Modify statment is not modifng correct rows...</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/modify-statment-is-not-modifng-correct-rows/m-p/5794732#M1310574</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;              iam having ITAB1 with 100 records.Moving corresponding fields from itab1 to itab_final.Itab1 and itab_final have different structure.say itab_final is having 20 fields and itab is having 10 fields.when i move corresponding fields from itab1 to itab_final the respective 10 fields are filled with records.rest of fields(say10) itab_final i need to fetch by some select statment and ineed to do modfiy corresponding fields of itab_final.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="--------------------------------------------------------------------------------------------------------------------------------------------------" /&gt;&lt;P&gt;SELECT &lt;/P&gt;&lt;P&gt;               KFRST&lt;/P&gt;&lt;P&gt;               DATBI&lt;/P&gt;&lt;P&gt;               DATAB&lt;/P&gt;&lt;P&gt;               KBSTAT&lt;/P&gt;&lt;P&gt;               KNUMH  FROM A901 INTO TABLE ITAB2&lt;/P&gt;&lt;P&gt;               FOR ALL ENTRIES IN ITAB1&lt;/P&gt;&lt;P&gt;               WHERE KNUMH = ITAB1-KNUMH.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;        LOOP AT ITAB2 INTO LS_ITAB2.&lt;/P&gt;&lt;P&gt;        &lt;/P&gt;&lt;P&gt;          ITAB_final-KFRST  = LS_ITAB2-KFRST.&lt;/P&gt;&lt;P&gt;          ITAB_final-DATBI  = LS_ITAB2-DATBI.&lt;/P&gt;&lt;P&gt;          &lt;/P&gt;&lt;P&gt;          &lt;STRONG&gt;MODIFY ITAB_final INDEX SY-INDEX TRANSPORTING KFRST DATBI&lt;/STRONG&gt; .&lt;/P&gt;&lt;P&gt;        ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here My question is how i can find the exact record in itab_final and fill the itab2 field using read statment.&lt;/P&gt;&lt;P&gt;My modfiy statment with sy-index is not modfiy correct row.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regrads,&lt;/P&gt;&lt;P&gt;Sri&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Jun 2009 14:42:07 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/modify-statment-is-not-modifng-correct-rows/m-p/5794732#M1310574</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-06-17T14:42:07Z</dc:date>
    </item>
    <item>
      <title>Re: Modify statment is not modifng correct rows...</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/modify-statment-is-not-modifng-correct-rows/m-p/5794733#M1310575</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Define a work area for itab_final and read that table with the common key fields that you have between those two tables&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;LOOP AT ITAB2 INTO LS_ITAB2.

*ITAB_final-KFRST = LS_ITAB2-KFRST.
*ITAB_final-DATBI = LS_ITAB2-DATBI.

*MODIFY ITAB_final INDEX SY-INDEX TRANSPORTING KFRST DATBI .
read table itab_final into ls_final with key field1 = ls_itab2-field1
                                          field2 = ls_itab2-field2.
*now 
ITAB_final-KFRST = LS_ITAB2-KFRST.
ITAB_final-DATBI = LS_ITAB2-DATBI.

modify itab_final from ls_final.

ENDLOOP.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: riki frisky on Jun 17, 2009 10:47 AM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Jun 2009 14:46:38 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/modify-statment-is-not-modifng-correct-rows/m-p/5794733#M1310575</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-06-17T14:46:38Z</dc:date>
    </item>
    <item>
      <title>Re: Modify statment is not modifng correct rows...</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/modify-statment-is-not-modifng-correct-rows/m-p/5794734#M1310576</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You cannot MODIFY the records in this manner...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rather what you can do is...instead of LOOPING ITAB2...you can loop ITAB_FINAL and pass the data...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Check below:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

LOOP AT ITAB_final ASSIGNING &amp;lt;fs_itab_final&amp;gt;.

* Read the data from ITAB based on some condition...
&amp;lt;fs_itab_final&amp;gt;-field1 = gs_itab-field1.
....................................................
....................................................

ENDLOOP.

* Now no need of modify, since you have used a field symbol

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Jun 2009 14:49:17 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/modify-statment-is-not-modifng-correct-rows/m-p/5794734#M1310576</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-06-17T14:49:17Z</dc:date>
    </item>
    <item>
      <title>Re: Modify statment is not modifng correct rows...</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/modify-statment-is-not-modifng-correct-rows/m-p/5794735#M1310577</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sorry got confused by your question. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;the solution is as follows.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;SELECT
KFRST
DATBI
DATAB
KBSTAT
KNUMH FROM A901 INTO TABLE ITAB2
FOR ALL ENTRIES IN ITAB1
WHERE KNUMH = ITAB1-KNUMH.

loop at itab1 into ls_itab1.

read table itab2 into ls_itab2 with key knumh = ls_itab1-knumh. 
ITAB_final-KFRST = LS_ITAB2-KFRST.
ITAB_final-DATBI = LS_ITAB2-DATBI.
move-corresponding ls_itab1 to ls_final.
append ls_final to itab_final.

endloop.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This will work, no need of modify statement.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Jun 2009 14:53:05 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/modify-statment-is-not-modifng-correct-rows/m-p/5794735#M1310577</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-06-17T14:53:05Z</dc:date>
    </item>
    <item>
      <title>Re: Modify statment is not modifng correct rows...</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/modify-statment-is-not-modifng-correct-rows/m-p/5794736#M1310578</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Riki,&lt;/P&gt;&lt;P&gt;            my itab_final is table type and not having any key fields.So how can i read without key field.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;rEGARDS,&lt;/P&gt;&lt;P&gt;sRI&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Jun 2009 14:54:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/modify-statment-is-not-modifng-correct-rows/m-p/5794736#M1310578</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-06-17T14:54:57Z</dc:date>
    </item>
    <item>
      <title>Re: Modify statment is not modifng correct rows...</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/modify-statment-is-not-modifng-correct-rows/m-p/5794737#M1310579</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;try this way..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Use SY-tabix not Sy-index...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

LOOP AT ITAB2 INTO LS_ITAB2.
 
  Read table itab_final into ls_final with key field1 = ls_itab2-field1
                                          field2 = ls_itab2-field2.
  If sy-subrc = 0.
     ITAB_final-KFRST = LS_ITAB2-KFRST.
     ITAB_final-DATBI = LS_ITAB2-DATBI.
     modify itab_final from ls_final index sy-tabix TRANSPORTING KFRST DATBI.
   ENDIF.
 
ENDLOOP.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Prabhudas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Jun 2009 14:56:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/modify-statment-is-not-modifng-correct-rows/m-p/5794737#M1310579</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-06-17T14:56:57Z</dc:date>
    </item>
    <item>
      <title>Re: Modify statment is not modifng correct rows...</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/modify-statment-is-not-modifng-correct-rows/m-p/5794738#M1310580</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Check any common fields are ther between the two table Itab and itab_final.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;else try this way..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
LOOP AT ITAB2 INTO LS_ITAB2.
 
  Read table itab_final into ls_final with key field1 = ls_itab2-field1
                                          field2 = ls_itab2-field2.
  If sy-subrc = 0.
     ITAB_final-KFRST = LS_ITAB2-KFRST.
     ITAB_final-DATBI = LS_ITAB2-DATBI.
     modify itab_final from ls_final index sy-tabix TRANSPORTING KFRST DATBI.
  ELSE.
     Move-corresponding fields of LS_ITAB2 to ITAB_final.            "Add this 
     append.
  ENDIF.
 
ENDLOOP.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Jun 2009 14:58:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/modify-statment-is-not-modifng-correct-rows/m-p/5794738#M1310580</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-06-17T14:58:45Z</dc:date>
    </item>
    <item>
      <title>Re: Modify statment is not modifng correct rows...</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/modify-statment-is-not-modifng-correct-rows/m-p/5794739#M1310581</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Before MODIFYING, you will have to first READ ITAB_FINAL by matching the fields from ITAB2 so that you get the correct record.&lt;/P&gt;&lt;P&gt;If the read is successful then sy-subrc value will be 0 and sy-tabix will contain the particular row number of ITAB_FINAL which you want to modify.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So now you can modify using INDEX as sy-tabix instead of sy-index.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Ankur Parab&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 Jun 2009 05:03:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/modify-statment-is-not-modifng-correct-rows/m-p/5794739#M1310581</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-06-18T05:03:42Z</dc:date>
    </item>
    <item>
      <title>Re: Modify statment is not modifng correct rows...</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/modify-statment-is-not-modifng-correct-rows/m-p/5794740#M1310582</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi ,&lt;/P&gt;&lt;P&gt;Kinly Chk this,&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
data:
w_index type i.

LOOP AT ITAB2 INTO LS_ITAB2.

ITAB_final-KFRST = LS_ITAB2-KFRST.
ITAB_final-DATBI = LS_ITAB2-DATBI.

add 1 to w_index.
MODIFY ITAB_final INDEX w_index TRANSPORTING KFRST DATBI .

ENDLOOP.

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Mdi.Deeba&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 Jun 2009 05:11:13 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/modify-statment-is-not-modifng-correct-rows/m-p/5794740#M1310582</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-06-18T05:11:13Z</dc:date>
    </item>
  </channel>
</rss>

