Skip to Content
avatar image
Former Member

Increment logic in script

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    avatar image
    Former Member
    Sep 07, 2007 at 11:33 AM

    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.

    Add comment
    10|10000 characters needed characters exceeded