2012 Oct 10 5:59 AM
Hi Experts,
Inrenal table data:
A B C
------------------
2p 01 x
2p 01 y
2p 01 z
Now i'm looping above internal table for displaying data using write statements
Expected Output:
--------------------------
2p 01 x
y
z
Rewards if helpful.
Thank you.
Regards,
BALAJI.
Moderator Message: Basic question. Please read the sap documentation.
Message was edited by: Kesavadas Thekkillath
2012 Oct 10 6:12 AM
Try this code :
Report Ytest.
data : begin of itab OCCURS 0,
a type char2,
b type char2,
c type char1,
end of itab.
data : begin of itab1 OCCURS 0,
a type char2,
b type char2,
c type char1,
end of itab1.
itab-a = '2p'. itab-b = '01'. itab-c = 'X'. append itab.
itab-a = '2p'. itab-b = '01'. itab-c = 'Y'. append itab.
itab-a = '2p'. itab-b = '01'. itab-c = 'Z'. append itab.
sort itab by a b.
loop at itab.
at new b.
itab1-a = itab-a.
itab1-b = itab-b.
endat.
itab1-c = itab-c.
append itab1.
clear itab1.
endloop.
loop at itab1.
write : / itab1-a,itab1-b,itab1-c.
endloop.
Regards,
Gagan
2012 Oct 10 6:32 AM
2012 Oct 10 6:22 AM
Hi Balaji,
Try this out
Loop at internal_table into work area
At New B
Write : / A
Endat
Endloop
This is just a pseudo code.
For more detials you can refer to
http://wiki.sdn.sap.com/wiki/display/ABAP/Control+Level+Statements+in+ABAP
Here you can find many examples of at new inside loop.
Hope it helps
Rgds,
Sandeep Katoch
2012 Oct 10 6:34 AM
Loop at it into wa.
at new A.
Write : wa-A , wa-B.
endat.
Write: wa-C.
endloop.
Try like this.
I think U need to handel AT New * and formatiing also u need to do.
But this Logic Will Work For U