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 issue with /

Former Member
0 Likes
959

I come from C, and if I'm not wrong, the following doesn't work alike ABAP:

WRITE /.
  WRITE TEMP.

According to my understanding, in the code above I order the program to move the cursor to the next line. Then I ask it to write the contents of TEMP, but without moving from this line to another. But the output prints the contents on a line below the new one obtained after the

WRITE / .

Why does this happen ?

Thanks,

Avraham

9 REPLIES 9
Read only

Former Member
0 Likes
922

Hi,

go through this link , you can find the details abt the write statement.

http://help.sap.com/saphelp_nw04/helpdata/en/9f/db9e1635c111d1829f0000e829fbfe/content.htm

In first write (write: / .)you set the cursor to the next line and in the next write (write: temp.)

your writing the content of the variable temp.

In abap the statements get execute line by line, so first write executed then then next one.

you can check by writing the statement reverse.

example:

DATA v8(7) TYPE n value '1234567'.
WRITE: v8 .
WRITE:/.

Regards

Adil

Edited by: Syed Abdul Adil on Jun 24, 2008 11:20 AM

Read only

Former Member
0 Likes
922

Hi,

Thought provoking question.

WRITE /.

Effect : This statement has the same effect as the statement SKIP.

so if we use write /, it will skip a line in the output.

reward if helpful,

regards,

teja.

Read only

0 Likes
922

So then, Teja, why doesn't the following statement give me the same output as

WRITE: /, TEMP.

:

WRITE / TEMP.

The statement above works just as if I were in C.

But for some reason the 1st statement above inserts a new line, and yet prints TEMP on another new line. That's what I don't get.

P.S: It's good to remark that

WRITE: / v6, v7.

will print the contents of v6 and v7 on the same line, meaning the answer can't be "every WRITE statement alone prints in a new line".

I didn't check the code someone posted above stating I will get the difference yet. Will do that when I have more free time here.

Thanks for trying to help.

Avraham

Edited by: Avraham Kahana on Jun 24, 2008 11:40 AM

Read only

Former Member
0 Likes
922

Just use: WRITE:/ TEMP. (and use SKIP to move to another line).

Regards,

John.

Read only

Former Member
0 Likes
922

hi check this code from help.

WRITE   '--'.
WRITE / '|'.

SKIP TO LINE 1.
ULINE AT 5(6).
NEW-LINE.
WRITE 10 '|'.

SKIP TO LINE 4.
WRITE: '|        |',
     / '----------'. 

u would be able to find the difference


SKIP TO LINE 3.
ULINE AT 2(1).
WRITE 4  '-'.
WRITE 6  '--'.
WRITE 9  '---'.
ULINE AT 12(4).

SKIP TO LINE 1.
POSITION 18.
WRITE '|'.

SKIP TO LINE 3.
DO 4 TIMES.
  NEW-LINE.
  POSITION 18.
  WRITE '|'.
ENDDO.

Regards,

priya

Read only

GauthamV
Active Contributor
0 Likes
922

hi,

WRITE /.

WRITE TEMP.

the above will work this way.

WRITE /.

this will print a empty line.(in second row)

WRITE TEMP.

this will print temp data next to empty line.(in third row)

Read only

Former Member
0 Likes
922

Hi Avraham,

No, every WRITE Statement does not trigger a new line, that is a Write statement does not mean that it writes in a new line. We should specify to it to write in new line.

eg:

write:/ 'Hello'.

write: 'World'.

The output would be 'Hello World'.

If we want to get World in new line, we should write as,

write:/ 'Hello'.

write:/ 'World'.

Hope this helps you,

Regards,

Chnadra Sekhar

Read only

Former Member
0 Likes
922

Hi Avraham ,

in ABAP, '/ ' operator generates a new-line only with respect to its pervious line in the LIST. in your code, you used it in 1st line . So it doesn't get any reference With respect to which it will drop the line.

write: 'Hello'.

write: /'Avraham'.

will write 'Avraham' in 2nd line as it get the reference of 'Hello'.

if you want to start your 1st output line from 2nd row in the list, use skip.

skip.

write:'Avraham',

Reward if find helpful.

Anirban Bhattacharjee

Read only

Former Member
0 Likes
922

Hai Avraham!!

WRITE /. will produce a line feed.

WRITE TEMP. will output the value of TEMP on the next

line.

But if u use WRITE / TEMP.

--> It outputs the value of TEMP on the next line if there are any output lines before it.

--> It outputs the value of TEMP on the first line of the list if there are no output lines before it.