2008 Apr 13 7:38 AM
I am a newbie in ABAP. Someone told me that Internal table is Array in ABAP.
Ok, now I need to do this:
How do I loop through a given internal table of name-value pairs?
Please teach me <REMOVED BY MODERATOR>
Edited by: Alvaro Tejada Galindo on Apr 14, 2008 5:45 PM
I am a newbie in ABAP. Someone told me that Internal table is Array in ABAP.
Ok, now I need to do this:
How do I loop through a given internal table of name-value pairs?
Please teach me <REMOVED BY MODERATOR>
Edited by: Alvaro Tejada Galindo on Apr 14, 2008 5:45 PM
2008 Apr 13 7:41 AM
Hi,
You can do as below :
"Assuming you have some data in the itab.
loop at itab.
write : / itab-field1, itab-field2, itab3-field3. etc.
endloop
Thanks,
Sriram Ponna.
2008 Apr 13 7:46 AM
Hi Dude,
Declare ur internal table as follows.
data: itab type table of mara with header line.
Select * from MARA into table itab .
loop at itab.
write: itab-matnr,..........
endloop.
Regards,
Nishant
2008 Apr 13 7:59 AM
wait wait...
look at your suggestion, do you assume that I already know the name of the field in the internal table?
actually i do not know what fields are available in the internal table (array). can you suggestion still work?
Please advice. i am really a newbie in abap.
2008 Apr 13 8:04 AM
Hi Dude,
Declare ur internal table as follows.
data: itab type table of mara with header line.
Select * from MARA into table itab .
loop at itab.
write: itab-matnr,..........
endloop.
(By double clicking on MARA, u can get field names)
Regards,
Nishant
2008 Apr 13 9:40 AM
Hi,
Try like this:
data : begin of itab occurs 0.
include structure lfa1.
data : end of itab.
select * from lfa1 into itab.
loop at itab.
write : itab.
endloop.
Thanks,
Sriram Ponna.
2008 Apr 14 8:17 AM
Sorry guys, I am given this information:
The internal table is MY_PARA type TT_MY_PARA of interface IF_PDL_APP
So now, how do I declare something in my ABAP to loop through the given internal table?
Please pardon my poor knowledge in ABAP. I am only an art graduate who just learnt WinXp last year.
Please help.
2008 Apr 14 8:27 AM
2008 Apr 14 8:30 AM
Hi,
I do not have any code.
I am only told that an Internal Table defined as
MY_PARA type TT_MY_PARA of interface IF_PDL_APP
contains the information I need.
So I am requesting you guys to give me an ABAP code to loop through the internal table.
Please help. <REMOVED BY MODERATOR>
Edited by: Alvaro Tejada Galindo on Apr 14, 2008 5:46 PM
2008 Apr 14 8:47 AM
hi,
TT_MY_PARA this is not standard table.
so, we don't the fields in it.
if u declere like "MY_PARA type TT_MY_PARA of interface IF_PDL_APP"
is my_para have only work area no body for that.
if u need an internal table body u can define like "type table of".
with out knowing the fields there is no use in looping..
first u must know the fields in internal table and then do print/changes to that values...
ex:
types: begin of ty_mara,
matnr type matnr,
ersda type ersda,
.........
end of ty_mara.
data: it_mara type table of ty_mara.
"for creating internal table body
data: wa_mara type ty_mara.
"for creating work area.
select matnr ersda .... into table it_mara from mara where<...>.
"select fetches the data from mara into u'r internal table.
loop at it_mara into wa_mara.
"here one record is moved from body to work area.
write 😕 wa_mara-matnr,wa_mara-ersda,..... .
" here we print the data in work area.
endloop.
regars,
chandu.
2008 Apr 14 8:44 AM
Hi,
First of all I welcome you in the wonderfull world of ABAP
I will not send you any solution since most of the others has already sent you some of example.
But instead I will give you a usefull transaction that helps me a lot when I have some porblem in ABAP.
it's ABAPDOCU transaction. It will provide you specific ABAP example code over all what is possible to find in ABAP
Have a look at it, and I thing that you will appreciate a lot this transaction
Regards and have fun
2008 Apr 14 8:52 AM
Thanks bro,
I typed ABAPDOCU but then I got "You are not authorized to use Transaction ABAPDOCU" error.
Anyway I tried my step:
LOOP at IF_PDL_APP~MYPARA
ENDLOOP.
When I compiled, I got this error message:
With "LOOP AT itab", one of the additions "INTO", "ASSIGNING", or 'TRANSPORTING NO FIELDS" is required in the OO context.
Please help.
Thanks
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |