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: 

sapscript

Former Member
0 Kudos

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

5 REPLIES 5

Former Member
0 Kudos

sorry the last col wil read like

9

10

11

12

thanks

sourav

Former Member
0 Kudos

Try using this.

V1 = 1

Do n times. " (n = No. of Rows)

V1,,V1n,,V1(2n),,V1+(3n)....

V1 = V1 + 1.

Enddo.

vinod_gunaware2
Active Contributor
0 Kudos

<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

Former Member
0 Kudos

thanks sandip n vinod, i wil chk it...

Former Member
0 Kudos

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