‎2006 Jun 29 8:43 PM
Hi All!
I'm a new ABAP learner. First of all this forums seems to be a very valuable resource for starters like me. I have a small rather silly problem. I want to write data from an internal table which is declared indirectly in the following manner:
TYPES : BEGIN OF TEMP,
A TYPE I,
B TYPE I,
END OF TEMP.
DATA : TEMP1 TYPE TEMP. " using a structure obj as HL
DATA : ITAB TYPE TEMP1 OCCURS 3.
DO 3 TIMES.
TEMP1-A = SY-INDEX.
TEMP1-B = SY-INDEX * 10.
APPEND TEMP1 TO ITAB.
ENDDO.
From here I want to write the values from ITAB.
can someone help me with this?
‎2006 Jun 29 8:48 PM
Hi
LOOP AT ITAB INTO TEMP1.
WRITE: / TEMP1-A,
TEMP1-B.
ENDLOOP.
Max
‎2006 Jun 29 8:47 PM
Welcome srikanth.
TYPES : BEGIN OF TEMP,
A TYPE I,
B TYPE I,
END OF TEMP.
DATA : TEMP1 TYPE TEMP. " using a structure obj as HL
DATA : ITAB TYPE TEMP1 OCCURS 3.
DO 3 TIMES.
TEMP1-A = SY-INDEX.
TEMP1-B = SY-INDEX * 10.
APPEND TEMP1 TO ITAB.
ENDDO.
After append you can write itab in this way.
<b>loop at itab.
write itab-a, itab-b.
endloop.</b>
Regds
Manohar
Message was edited by: Manohar Reddy
‎2006 Jun 29 8:57 PM
Well thanks for the quick reply Manohar!
Unfortunately this did'nt work as I have tried before. The reason is the internal table ITAB does not have a direct header line so it cannot have attributes A and B so we can't use ITAB-A and ITAB-B here.
‎2006 Jun 29 9:02 PM
This works good for me.
types : begin of temp,
a type i,
b type i,
end of temp.
data : temp1 type temp. " using a structure obj as HL
<b>data : itab type temp occurs 3.</b>
do 3 times.
temp1-a = sy-index.
temp1-b = sy-index * 10.
append temp1 to itab.
enddo.
<b>loop at itab into temp1.
write:/ temp1-a, temp1-b.
endloop.</b>
Regards,
Rich Heilman
‎2006 Jun 29 9:04 PM
‎2006 Jun 29 9:05 PM
‎2006 Jun 29 9:06 PM
‎2006 Jun 29 8:48 PM
Hi
LOOP AT ITAB INTO TEMP1.
WRITE: / TEMP1-A,
TEMP1-B.
ENDLOOP.
Max
‎2006 Jun 29 9:00 PM
Thanks Max and Rich!
Looks like u have given me the right solution. I will try this.
Thanks once aagain.
Regards,
Sri.
‎2006 Jun 29 9:02 PM
‎2006 Jun 29 8:49 PM