cancel
Showing results for 
Search instead for 
Did you mean: 

Addition & increment logic in script

Former Member
0 Kudos

1. There is a field (counter) in a layout where it needs to incremented automatically

eg: where the counter entries in layout should increase as it proceeds like Starts from 1, increases by 1..

2. BSID-ZFBDT + BSID-ZBD1T.. how to write a code for it in test editor do v need to write in print prog even .. If si how to proceed..

please culd u any guys help me...............

related ones wil be reward prompltly..........

Accepted Solutions (0)

Answers (2)

Answers (2)

former_member196280
Active Contributor
0 Kudos

TO change the value of counter inside SAPscript

&SAPSCRIPT-COUNTER_1(+)& "Increases by 1

&SAPSCRIPT-COUNTER_1(+)& " Decreases by 1

Regards,

SaiRam

Former Member
0 Kudos

Hi,

1. You can use the standard SAP Script Symbol - SAPSCRIPT-COUNTER_x( x = 0 .. 9). There are 10 counter variables that can be used in the layout for counting purpose. You can use '+' or '-' formatting options to increment or decrement a counter value.

You can also use DEFINE control command to set a counter value.

2. As one is a date field and another a numeric field you can carry out the following steps.

a. Get the format in yyyy/dd/mm . You can use a FM for this.

b. Remove '/' or '.' or '-' in the date value.

c. Add the 2 fields into a third field of type BSID-ZFBDT

d. You need not format the output. it will be displayed in the mm/dd/yyyy format only.

All this is needed to be done in the print program. Then you can simply print this field in the layout.