Application Development 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: 

WRITE statement question

Former Member
0 Kudos

Is it possible (using the WRITE statement) to write on the 1st line, then the 2nd line, then the 3rd line and then go back to the 1st line again?

I have got a report which I need to look like the following (¦ being the symbol for the column splits):

1100 ¦ 1200

_____¦______

5 ¦ 6

10 ¦ 54

I would like to write the 1100 columns first and then the 1200 column, but I am unsure if I can go back to the 1st line once I have written on more lines.

i.e.

WRITE (line1)(1) '1100'

WRITE (line2)(1) '----'

WRITE (line3)(1) '5'

WRITE (line4)(1) '10'

WRITE (line1)(6) '1200'

WRITE (line2)(6) '----'

WRITE (line3)(6) '5'

WRITE (line4)(6) '10'

Kind Regards

Carly

9 REPLIES 9

Former Member
0 Kudos

did u check the MODIFY LINE..... statement?

Former Member
0 Kudos

Hi

You can write the data using WRITE statement, any number of lines, any no of columns

after writing 1100, 1200 columns

going to first line, no problem scroll up the page and go..

But what's this requirement? really real scenario..

Reward points for useful Answers

Regards

Anji

Former Member
0 Kudos

write:

/10 '1100', sy-vline, 20 '1200'.

write sy-uline.

write:

/10 '5',sy-vline, 20 '6',

write:

/10 '10',sy-vline, 20 '54'.

regards,

Pavan P.

Pawan_Kesari
Active Contributor
0 Kudos

Is it possible (using the WRITE statement) to write

on the 1st line, then the 2nd line, then the 3rd line

and then go back to the 1st line again?

I have got a report which I need to look like the

following (¦ being the symbol for the column splits):

1100 ¦ 1200

_____¦______

5 ¦ 6

¦ 54

I would like to write the 1100 columns first and then

the 1200 column, but I am unsure if I can go back to

the 1st line once I have written on more lines.

i.e.

WRITE (line1)(1) '1100'

WRITE (line2)(1) '----'

WRITE (line3)(1) '5'

WRITE (line4)(1) '10'

WRITE (line1)(6) '1200'

WRITE (line2)(6) '----'

WRITE (line3)(6) '5'

WRITE (line4)(6) '10'

Kind Regards

Carly

This is case I will suggest you to prepare a internal table with all the calculation first and then print the records sequentially. This way you won't need to go back and print the values...

If at all it is needed then of course you can use statement

MODIFY LINE n OF CURRENT PAGE

See help on this statement...

Former Member
0 Kudos

Hi Carly,

Try this sample code,

It will help you.

data : temp(5) value 'viji'.

write : 10(4) temp.

uline.

write : 25(4) temp.

uline.

write : 50(4) temp.

uline.

write : 75(4) temp.

uline.

Thanks,

Reward If Helpful.

Former Member
0 Kudos

Hi Bond,

You can achieve this using BACK and RESERVE statements.

Check this sample code.

DATA:  TOWN(10)      VALUE 'New York',
       CUSTOMER1(10) VALUE 'Charly',
       CUSTOMER2(10) VALUE 'Sam',
       SALES1 TYPE I VALUE 1100,
       SALES2 TYPE I VALUE 2200.
RESERVE 2 LINES.
WRITE:  TOWN, CUSTOMER1,
      /       CUSTOMER2 UNDER CUSTOMER1.
BACK.
WRITE: 50 SALES1,
       /  SALES2 UNDER SALES1.

Thanks,

Vinay

Rashid_Javed
Contributor
0 Kudos

You can move the cursor back, check sap help for abap statement 'BACK'

This statement takes the cursor back to first line in current page.

DATA: title TYPE c LENGTH 3,

sname TYPE c LENGTH 20,

fname TYPE c LENGTH 20.

SKIP 5.

RESERVE 3 LINES.

WRITE: / 'Title',

/ 'Second name',

/ 'First name'.

BACK.

WRITE: /14 title INPUT,

/14 sname INPUT,

/14 fname INPUT.

Also you can use statement 'Skip to line n' where n is a number like 1,2,3........

Cheers

RJv

Former Member
0 Kudos

You can follow the following code.I think it will help you :-

write:

/10 '1100', sy-vline, 20 '1200'.

write sy-uline.

write:

/10 '5',sy-vline, 20 '6',

write:

/10 '10',sy-vline, 20 '54'.

Regards :-

Srikanta Gope

Former Member
0 Kudos

HI

Use UNDER Statement with WRITE.

WRITE (line1)(1) '1100' UNDER '----' UNDER (1) '5' UNDER '10'.

Reward me if its helpful.

Regards

Ravi