on 2005 May 25 12:10 PM
for the code
-
do 5 times.
hide sy-index.
wrtie sy-index.
enddo.
at line-selection.
write sy-index.
-
o/p is
1
2
3
4
5
-
if one clicks on 3 we get 4 on so on..can anyone xplain the logic behind this.
Hi Henry,
this will be run:
( set hide behind write)
DO 5 TIMES.
WRITE: / sy-index.
HIDE sy-index."<----
ENDDO.
AT LINE-SELECTION.
WRITE sy-index.
regards Andreas
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi ,
I don't think set hide behind write is the only problem.If you removed <b>/</b> in write statement,we won't get desired result.
Check this it won't work
DO 5 TIMES.
WRITE: sy-index.<b>"<--check here-</b>
HIDE sy-index.
ENDDO.
AT LINE-SELECTION.
WRITE sy-index.
So either if you want to use hide behind write , you should use <b>/</b> in write as Andreas mentioned.
Or you should use skip or Uline command as I suggested.
Anyway you cannot write everything in same horizontal line.
Output should be vertical .
Hi Henry,
from Abap-docu:
...
HIDE <f>.
This statement places the contents of the variable <f> for the current output line (system field SY-LINNO) into the HIDE area. The variable <f> must not necessarily appear on the current line.
To make your program more readable, <b>always place the HIDE statement directly after the output statement</b> for the variable <f> or after the last output statement for the current line.
...
have a look here:
http://help.sap.com/saphelp_47x200/helpdata/en/9f/dba42335c111d1829f0000e829fbfe/frameset.htm
regards Andreas
Hi Henry,
As I already replied,it is because in your original code you mentioned the sy-index to be in the same line.
Usually,the purpose of AT Line-selection is pick that line.That's why it is taking the sy-index in your code as 5.
But in my code and Andreas code , we are displaying the output vertically.
And in the below mentioned code,I think while processing write statement itself since it needs to process both sy-index and '/' , it is incrementing sy-index by one.
do 3 times.
hide sy-index.
write : / sy-index.
enddo.
at line-selection.
write sy-index.
Write sy-index and Hide should be consecutive.
The behaviour of write 😕 sy-index is it first process / and then sy-index.
In Andreas coding, he has written write and then hide.
While processing the write 😕 sy-index, it is first processing hide and then / and then sy-index.
In my coding, I have written hide and then write(without /).Here also it is consecutive.
But in the coding you mentioned , you have written hide and then write (with /).It is processing hide and then / and then sy-index.In this case Hide and Write sy-index are not consecutive.That's why you get the output incremented by one.
Hope this is clear.
For more information about HIDE and At Line-selection,check this.
http://www.sts.tu-harburg.de/teaching/sap_r3/ABAP4/hide.htm
Check this also.It will also work fine since write sy-index and Hide are consecutive.
do 3 times.
hide sy-index.
write sy-index.
new-line.
enddo.
at line-selection.
write sy-index.
Regards,
J.Jayanthi
Message was edited by: Jayanthi Jayaraman
Hi Henry,
If your problem is solved,could you please close the thread and reward points for the helpful answers.
For problem in assigning points,you can send a mail to the person marilyn.pratt@sap.com stating the problem.He will do the needful.
Regards,
J.Jayanthi
Message was edited by: Jayanthi Jayaraman
User | Count |
---|---|
105 | |
9 | |
8 | |
6 | |
5 | |
5 | |
4 | |
4 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.