cancel
Showing results for 
Search instead for 
Did you mean: 

Increment logic in script

Former Member
0 Kudos

Hi All,

In the Script i am using the SAPSCRIPT-COUNTER_1.

I have assigned the value '0' to it.

But after that i want to increment it.i am using the command which is in bold.

But the value is not incremented.

/: DEFINE &COUNTER_1& = '0'

<b>&COUNTER_1(+)&</b>

Please Suggest me....

Regards,

Swathi

Accepted Solutions (1)

Accepted Solutions (1)

valter_oliveira
Active Contributor
0 Kudos

Hi Swathi K.

You can use a perform statement in SAPSCRIPT. You must create a program first and use it in your form.

It's like this:

IN SAPSCRIPT:

/: PERFORM <form_name> IN PROGRAM <program_name>
/: USING &VAR1&
/: CHANGING &VAR2&
/: ENDPERFORM

IN PROGRAM:

REPORT ZTEST.

FORM increment TABLES IN_PAR STUCTURE ITCSY
OUT_PAR STRUCTURE ITCSY.

DATA: value TYPE i.

READ TABLE IN_PAR WITH KEY ‘VAR1’.
CHECK SY-SUBRC = 0.
value = IN_PAR-VALUE + 1.

READ TABLE OUT_PAR WITH KEY ‘VAR2’.
CHECK SY-SUBRC = 0.
OUT_PAR-VALUE = value.

MODIFY OUT_PAR INDEX SY-TABIX.

ENDFORM.

Hope this helped.

Best regards.

Reward usefull ideas.

Valter Oliveira.

Answers (0)