‎2008 Apr 12 11:41 AM
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.
‎2008 Apr 12 2:01 PM
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.
‎2008 Apr 12 11:58 AM
Hi Pallavi
1.
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
Loop at itab.
move 'a' to itab-a.
move 'b' to itab-b.
endloop.
‎2008 Apr 12 12:08 PM
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
‎2008 Apr 12 2:01 PM
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.