Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Doubt in Internal table

Former Member
0 Likes
671

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

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
651

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

5 REPLIES 5
Read only

Former Member
0 Likes
652

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

Read only

Former Member
0 Likes
651

hi,

chk out the foll code.

loop at itab.

itab-field1 = 'aa'.

modify itab index sy-tabix. " or modify itab.

endloop.

regards,

Navneeth K.

Read only

Former Member
0 Likes
651

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.

Read only

Former Member
0 Likes
651

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

Read only

Former Member
0 Likes
651

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