‎2007 Apr 26 3:59 PM
Hi Experts,
One simple doubt,
I made a loop itab into wa,
manipulated the first field of (either changed or added a new value, if its initial) wa.
MODIFY itab.
So,
1) Can I take it for granted that, the changes will take place/apply, surely, for the very first (which is fetched to wa from itab), record of the <u><b>itab</b></u>, bcoz I used MODIFY?
I mean, SAP automatically, knows that, it has to make the changes to the corresponding equal record of the <u><b>itab</b></u>, which is fetched/resided in wa, SAP do not disturrb other records!
Is my assumption is correct?
ThaNQ.
‎2007 Apr 26 4:20 PM
Hi Sridhar,
modify itab. is equivalent to
modify itab index sy-tabix.If you use modify itab without any index, it may result run time erros in some situations...
for example
loop at itab.
read table itab2 with key <>...
modify itab.
endloop.this may go for a toss becuase the the sy-tabix now is not of the current record of itab.
It is the current record or itab2.
In such cases you have to do this.
loop at itab.
lv_tabix = sy-tabix.
read table itab2 with key <>...
modify itab index lv_tabix.
endloop.
‎2007 Apr 26 4:01 PM
use
MODIFY ITAB FROM WA.
WA will recognize the key fields from internal table and updates the same record in internal table, this is the besy way to modify internal table
Message was edited by:
Chandrasekhar Jagarlamudi
‎2007 Apr 26 4:01 PM
Hi
Refer the link..
http://help.sap.com/saphelp_nw2004s/helpdata/en/fc/eb35eb358411d1829f0000e829fbfe/content.htm
Hope this will solve your problem.
Award points if it helps.
-Gaurang
‎2007 Apr 26 4:04 PM
Hi Sridhar,
U r question i right, when u use Modify itab from wa, the SAP automatically understands that u want to update that records , but it also maintains the integrity of records.
I think u r question is solved .
Plz rewards points if question is solved.
Regards
Message was edited by:
Pritha Agrawal
‎2007 Apr 26 4:06 PM
‎2007 Apr 26 4:11 PM
hi sridhar,
well, sap knows that the updation(change) has to be done to the current row.
still, as the loop keeps running, it will update the other rows also.
so, to change one particular row, u can use the MODIFY statement within some condition(s) to determine the required(s) where u want to make the changes
loop....
if <condition>
modify.....
endif.
endloop.
thanks,
vijay.
‎2007 Apr 26 4:14 PM
‎2007 Apr 26 4:20 PM
Hi Sridhar,
modify itab. is equivalent to
modify itab index sy-tabix.If you use modify itab without any index, it may result run time erros in some situations...
for example
loop at itab.
read table itab2 with key <>...
modify itab.
endloop.this may go for a toss becuase the the sy-tabix now is not of the current record of itab.
It is the current record or itab2.
In such cases you have to do this.
loop at itab.
lv_tabix = sy-tabix.
read table itab2 with key <>...
modify itab index lv_tabix.
endloop.