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

internal tables

Former Member
0 Likes
434

Hi

could u please tell me what the following code does.

Loop at itab.

move 'a' to itab-a.

move 'b' to itab-b.

endloop.

and

What is the difference between occurs 0 and occurs 10.

Thanks in advance.

1 ACCEPTED SOLUTION
Read only

vinod_vemuru2
Active Contributor
0 Likes
418

Hi Pallavi,

Loop at itab.

move 'a' to itab-a.

move 'b' to itab-b.

endloop.

Ur internal table itab has fields a and b and is defined with header line(Since u r not using any wa). This loop will do nothing as functionalitywise. When u enter into first looppass

ur first record of the table will be moved to headerline itab. Now The MOVE statements will move the hard coded value a to field a and b to field b. Ur table content will not change since u r not using Modify statement. If u want to MODIFY the table content then do like below.

Loop at itab.

move 'a' to itab-a.

move 'b' to itab-b.

MODIFY itab.

endloop.

After this all records of ur internal table has value a in field a and b in field b.

Hope this clarified ur doubts.

Thanks,

Vinod.

3 REPLIES 3
Read only

venkat_o
Active Contributor
0 Likes
418

Hi Pallavi 1.

Loop at itab.
move 'a' to itab-a.
move 'b' to itab-b.
endloop.
You are just moving two different values to two different field of work area of internal tabl itab.if u want to append those two field into body of the internal table use APPEND itab. or if u want to modify the record of itab use MODIFY itab index sy-tabix transporting a b. 2.Occurs 0 The initial memory requirement defined during the creation of the internal table. 3.Occurs 10 Making 10 time The initial memory requirement defined during the creation of the internal table. Regards, Venkat.O

Read only

Former Member
0 Likes
418

Pallavi,

the piece of code

Loop at itab.

move 'a' to itab-a.

move 'b' to itab-b.

endloop.

Moves the values 'a' and 'b' to the header line itab of the internal table itab....

so after this ...the field a in the headerline will contain the value 'a' and the field b will contain the value 'b'

The occurs statement is for the initial memory requirement

Read only

vinod_vemuru2
Active Contributor
0 Likes
419

Hi Pallavi,

Loop at itab.

move 'a' to itab-a.

move 'b' to itab-b.

endloop.

Ur internal table itab has fields a and b and is defined with header line(Since u r not using any wa). This loop will do nothing as functionalitywise. When u enter into first looppass

ur first record of the table will be moved to headerline itab. Now The MOVE statements will move the hard coded value a to field a and b to field b. Ur table content will not change since u r not using Modify statement. If u want to MODIFY the table content then do like below.

Loop at itab.

move 'a' to itab-a.

move 'b' to itab-b.

MODIFY itab.

endloop.

After this all records of ur internal table has value a in field a and b in field b.

Hope this clarified ur doubts.

Thanks,

Vinod.