05-18-2006 6:28 AM
how can i get the following output in sapscript:
1 5 10
2 6 11
3 7 12
4 8 13
thanks in advance..
regards
sourav
05-18-2006 6:29 AM
05-18-2006 6:33 AM
Try using this.
V1 = 1
Do n times. " (n = No. of Rows)
V1,,V1n,,V1(2n),,V1+(3n)....
V1 = V1 + 1.
Enddo.
05-18-2006 6:39 AM
<b>Changing the Value of a Counter</b>
You can increase or decrease the value of a SAPSCRIPT-COUNTER_x (x=0.. 9) counter variable by 1, before the current counter value is printed.
Syntax:
&SAPSCRIPT-COUNTER_x(+)& Increases by 1 the contents
of the counter variable x
(x=0.. 9)
&SAPSCRIPT-COUNTER_x(-)& Decreases by 1 the contents
of the counter variable x
(x=0.. 9)
If you want to change the value of a counter variable without actually printing the new value, use this formatting option together with an additional option to set the output length to 0 (see above). If you want to set a counter variable to some specific value, use the DEFINE control command.
Assume that &SAPSCRIPT-COUNTER_1& initially has the value 2.
&SAPSCRIPT-COUNTER_1& -> 2
&SAPSCRIPT-COUNTER_1(+)& -> 3
&SAPSCRIPT-COUNTER_1(-)& -> 2
&SAPSCRIPT-COUNTER_1(-)& -> 1
&SAPSCRIPT-COUNTER_1(+0)& ->
&SAPSCRIPT-COUNTER_1(+)& -> 3
regards
vinod
05-18-2006 7:26 AM
05-18-2006 8:58 AM
Hi Sourav,
I didnt know exactly whether we can use DO...ENDDO in Script Editor. But for your requirement you can do the same with Driverprogram/Printprogram.
<b>The code in DriverProgram is as follows::</b>
<b>data:
v type syindex, "index number in loop
a type syindex, "1st column value
b type syindex, "2nd column value
c type syindex. "3rd column value
do N times. "n is the number of rows
v = sy-index.
a = v.
b = v + 4.
c = v + 8.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
WINDOW = 'MAIN'
ELEMENT = 'DISPLAY_COUNT'.
enddo.</b>
<b>In your scripit editor the code is as follows::</b>
<b>/: &a&,,&b&,,&c&</b>
Thanks,
Vinay