‎2007 Jun 23 6:22 AM
hi experts
I have a internal table with one row of records + header records, due to my programe my header data was changed, but i want to modify the modification in the body of internal table.
wht is syntax for tht?
give small example.
point will sure
Gowri
‎2007 Jun 23 6:24 AM
Hi
DATA: l_index type sy-tabix.
loop at itab.
l_index = sy-tabix.
itab-field1 = 53. "changing the value.
modify itab index l_tabix.
endloop.
Note: sy-tabix value will be changed if any Loop statement or READ TABLE statement is given.
So, its good practise to either use field-symbols or store index value in some variable.
Check the new code using field-symbols.
FIELD-SYMOLS: <itab> type itab.
loop at itab assigning <itab>.
<itab>-field1 = 53.
endloop.
"No modify statement is required. Hence more optimized solution.
Regards
Navneet
Message was edited by:
Navneet Saraogi
‎2007 Jun 23 6:24 AM
Hi
DATA: l_index type sy-tabix.
loop at itab.
l_index = sy-tabix.
itab-field1 = 53. "changing the value.
modify itab index l_tabix.
endloop.
Note: sy-tabix value will be changed if any Loop statement or READ TABLE statement is given.
So, its good practise to either use field-symbols or store index value in some variable.
Check the new code using field-symbols.
FIELD-SYMOLS: <itab> type itab.
loop at itab assigning <itab>.
<itab>-field1 = 53.
endloop.
"No modify statement is required. Hence more optimized solution.
Regards
Navneet
Message was edited by:
Navneet Saraogi
‎2007 Jun 23 6:25 AM
hi,
chk out the foll code.
loop at itab.
itab-field1 = 'aa'.
modify itab index sy-tabix. " or modify itab.
endloop.
regards,
Navneeth K.
‎2007 Jun 23 6:29 AM
type modify in the code window and cursor point to that and press F1 when u get the window modify itab
you can get servaral helps
Rewards if Helpful.
‎2007 Jun 23 6:34 AM
Hi Gowri ,
Use the modify command , since what i understand is you are using a internal table with header line so the modify statement will do.
Regrads
Arun
‎2007 Jun 23 6:49 AM
i dont know by which way you are accessing the table.
if it is in loop at and endloop..
loop at itab.
itab-f1 = 'ABC'.
modify itab.
endloop.
here index sy-tabix is not necessary....
if you are accessing by read table statement...
read table itab with key f1 = 'ABC'.
if sy-subrc = 0.
itab-f1 = 'DEF'.
modify itab index sy-tabix.
endif.
here sy-tabix is necessary...
regards
shiba dutta