10-22-2007 6:47 PM
Hi experts,
I have a internal table.
Iam priniting values like this:
loop at itab.
at first.
write:/ ename, empno,sal.
end at.
write:/ ita-ename,itab-empno,itab-sal.
endloop.
So here i am writting header first.
I want to display the item exactly under each herader part. Can any body tell me how to do this. I want to display like this:
ename empno sal
abcd 1234 3000
defgh 9876 4000.
Regards
10-22-2007 6:50 PM
Hi,
Please try this ...
loop at itab.
at first.
write: / 01 ename, 10 empno, 20 sal.
endat.
write: / 01 itab-ename, 10 itab-empno, 20 itab-sal.
endloop.
Regards,
Ferry Lianto
10-22-2007 6:50 PM
Hi,
Please try this ...
loop at itab.
at first.
write: / 01 ename, 10 empno, 20 sal.
endat.
write: / 01 itab-ename, 10 itab-empno, 20 itab-sal.
endloop.
Regards,
Ferry Lianto
10-22-2007 6:50 PM
Ravi,
Check this example...
DATA: carrid TYPE spfli-carrid,
connid TYPE spfli-connid.
WRITE: 10 'Carrier', 40 'Connection'.
ULINE.
SELECT carrid connid
FROM spfli
INTO (carrid,connid).
WRITE: / carrid UNDER 'Carrier',
connid UNDER 'Connection'.
ENDSELECT.
Chandra.
10-22-2007 6:55 PM
Hi,
Try this..
data: v_ename(30) value 'Emp Name'.
data: v_empno(30) value 'Emp Num'.
data: v_sal(30) value 'Sal'.
loop at itab.
at first.
write:/ V_ENAME, V_EMPNO, V_SAL.
end at.
write:/ ita-ename UNDER v_ename,
itab-empno UNDER v_empno,
itab-sal UNDER v_sal.
endloop.
Thanks
Naren
10-22-2007 6:57 PM
You can use UNDER option for WRITE.
Check this out.
<b>
WRITE with option ... UNDER g </b>
Output of the field f begins at the column from which the field g was output. If this happens in the same output line, the output of the field g is overwritten.
After UNDER, the field g must be written exactly as the reference field in the previous WRITE statement, i.e. with an offset and length if necessary. The exception to this rule is if g is a text symbol. In this case, the reference field is determined by the number of the text symbol (not by the text stored there).
Example
Align output to the reference fields:
FIELD-SYMBOLS <FNAME>.
ASSIGN 'First Name' TO <FNAME>.
WRITE: /3 'Name'(001), 15 <FNAME>, 30 'RoomNo', 40 'Age'(002).
...
WRITE: / 'Peterson' UNDER 'Name'(001),
'Ron' UNDER <FNAME>,
'5.1' UNDER 'RoomNo',
(5) 24 UNDER TEXT-002.
This produces the following output (numbers appear right-justified in their output fields!):
Name First Name RoomNo Age
Peterson Ron 5.1 24
Hope this helps.
ashish
10-23-2007 9:24 AM