‎2008 Jun 24 10:10 AM
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
‎2008 Jun 24 10:18 AM
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
‎2008 Jun 24 10:18 AM
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.
‎2008 Jun 24 10:39 AM
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
‎2008 Jun 24 10:18 AM
Just use: WRITE:/ TEMP. (and use SKIP to move to another line).
Regards,
John.
‎2008 Jun 24 10:18 AM
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
‎2008 Jun 24 10:22 AM
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)
‎2008 Jun 24 12:29 PM
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
‎2008 Jun 24 12:43 PM
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
‎2008 Jun 24 12:48 PM
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.