Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Write statement

Former Member
0 Likes
676

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

1 ACCEPTED SOLUTION
Read only

ferry_lianto
Active Contributor
0 Likes
657

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

5 REPLIES 5
Read only

ferry_lianto
Active Contributor
0 Likes
658

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

Read only

former_member187255
Active Contributor
0 Likes
657

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.

Read only

Former Member
0 Likes
657

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

Read only

Former Member
0 Likes
657

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

Read only

0 Likes
657

Hi all,

thanks