cancel
Showing results for 
Search instead for 
Did you mean: 

SAP script

Former Member
0 Kudos

Hi,

I would like to increment a value in SAP script itself not from driver program?

Please guide me...

Thanks in advance,

Selva...

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Please try with this:

&SAPSCRIPT-COUNTER_x& (x = 0.. 9):

These fields represent ten counter variables that you can use in your text and forms for any counting purposes. You can use the u2018+u2019 and u2018-u2019 formatting options to increment or decrement a counter before its value is printed. You can use the DEFINE control command to assign any specific value to a counter.

Regards,

Neenu.

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

I have a value in table field that is BONDYR = 2008,

I have to increment it into 2009.

Former Member
0 Kudos

if you have a limited range you can

use a multiple if statement or a case statement.

if &BONDYR& = '2008'

define &BONDYR& = '2009'

elseif &BONDYR& = '2009'

define &BONDYR& = '2010'

elseif &BONDYR& = '2010'

define......

.....

.....

endif

Not very sophisticated but it works.

Former Member
0 Kudos

from your change editor goto insert->symbols -> system symbols

and choose SAPSCRIPT

&SAPSCRIPT-COUNTER_0&

this will work untill your counter is <= 9. but for 10 or more it will print *.

so to avoid this use

&SAPSCRIPT-COUNTER_0(+1)&

u can replace 1 with 2,3,4 as per your requirement

Sid.

Edited by: Siddhartha Prakash on Oct 20, 2008 1:45 PM

Edited by: Siddhartha Prakash on Oct 20, 2008 1:46 PM