cancel
Showing results for 
Search instead for 
Did you mean: 

Assigning a specific value to the sapscript counter variable

Former Member
0 Kudos

Hi all,

I am trying to use the sapscript counter variable in my sapscript but encounter the following warning.

My code looks like the following:

/: DEFINE &SAPSCRIPT-COUNTER_0& = 0

  • The new counter value is &SAPSCRIPT-COUNTER_0(+)&

The warning i get when i do the syntax check is:

Ambiguous symbol &SAPSCRIPT-COUNTER_0&

What is wrong with my syntax?

Appreciate any help i can get.

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

You can directly use the counter variable

&sapscript-counter_x&

if you want to reset the value back to 0 then you can use the syntax.

/: define &sapscript-counter_0& = 0.

regards

padma

Former Member
0 Kudos

Hi padma,

Thank you for your reply but i already have that line of code to reset to 0:

/: DEFINE &SAPSCRIPT-COUNTER_0& = 0

and that is the warning message i get:

Ambiguous symbol &SAPSCRIPT-COUNTER_0&

Former Member
0 Kudos

Hi,

If i am not wrong you are trying to reinitializing that standard variable. if that is the case one thing, in script we cannot assign values to variable other than at initializing time but here you don't have chance to initialize that variable because that is standard one. More over modifications to standard variable will give some warnings.

So try to use other than standard one as per your requirement.

Hope this will help you.

Regards,

Aswini.

Former Member
0 Kudos

Hi Aswini,

Based on your reply, i m using the following code:

/: DEFINE &COUNTER_0& = 0

/: &COUNTER_0& = &COUNTER_0& + 1

AS The value of the counter is &COUNTER_0&

When i do a checking of the text, i get the error "Command expected" on the second command.

What is wrong with my code? What is the right syntax?

Former Member
0 Kudos

Hi,

&SAPSCRIPT-COUNTER_x& is the pre defined symbol

you need not redefine that symbol again

you can use this symbol where ever you want

Regards

Jagadeesh