Nested internal table (urgent)
Could anybody can tell me how to access nested internal table.
I've successfully declared it.
Within a loop at itab1 I want to add data (records) to the itab2 which is component of my itab1.
Any example to share?
Thanks,
Tien
se38: DEMO_DATA_PROCESS_INT_TABLES_2
This program does only READ not UPDATE / INSERT.
Do you have others examples?
Thanks.
Sorry, Carsten. Your example do work.
Thanks for your help.
Hi,
Below segment of code will help you out.
LOOP itab1.
* Move ITAB1 to fields to ITAB2
MOVE itab1-fname1 TO itab2.
MOVE itab1-fnameN TO itab2.
APPEND itab2.
CLEAR itab2.
ENDLOOP.
The above case, the ITAB1 should have atleast 1 record.
Good Luck !
sapgreat
One of the points with internal tables within internal tables is they CAN NOT have a header line. So you have to use a work area.
_________________
MattG.
Search
SAPfans
hai all,
well try this code and have fun
data: begin of itab occurs 0,
name(20) type c,
age type i,
address(20) type c,
end of itab.
data: begin of itab1 occurs 0,
name(20) type c,
age type i,
end of itab1.
itab-name = 'pindropsilence'.
itab-age = 23.
itab-address = 'India'.
append itab.
itab-name = 'pindropsilence1'.
itab-age = 24.
itab-address = 'syndi'.
append itab.
itab-name = 'pindropsilence3'.
itab-age = 25.
itab-address = 'vindi'.
append itab.
loop at itab.
move-corresponding itab to itab1.
append itab1.
endloop.
loop at itab1.
write:/ itab1-name,itab1-age.
endloop.
this code works absolutely fine like a metro rail.
here some things r very important to know.
1. data types of the variables of internal tables should be same.
2. length of the both internal table variables should be same.
move-corresponding is the main syntax here its like finidng out what is there in one man and what is in another if he does not have anything that assign him the whatever u have
pindropsilence thanking u all,
keep smiling always