2008 Dec 08 6:50 PM
PERFORM GET_CURR IN PROGRAM ZREPORT1
USING &S_DATE&
USING &RF140-STIDA&
USING &RF140-WRSHB&
USING &SS_VAL1&
USING &SS_VAL2&
CHANGING &S_VAL1&
CHANGING &S_VAL2&
ENDPERFORM.
Every time it goes to the above perform and for the first time I get back &S_VAL1& and &S_VAL2&..
But next time I want to pass &SS_VAL1& and &SS_VAL2& with help of using.
how do I assighn/set values to
S_VAL1 to SS_VAL1 and
S_VAL2 to SS_VAL2... in SAP script.?
Any ideas?
2008 Dec 09 11:45 AM
Hi,
For the first time you want SS_VAL1(2) will be blank and then from 2nd time they will be populated with S_VAL1(2) respectively???
If my understanding is correct then do like:
In Script:
DEFINE &WA_FLAG& = ' '.
PERFORM SET_FLAG IN PROGRAM ZREPORT1
CHANGING &WA_FLAG&.
if &WA_FLAG& = 'X'
DEFINE &S_VAL1& = ' '.
DEFINE &S_VAL2& = ' ' .
PERFORM GET_CURR IN PROGRAM ZREPORT1
USING &S_DATE&
USING &RF140-STIDA&
USING &RF140-WRSHB&
CHANGING &S_VAL1&
CHANGING &S_VAL2&
ENDPERFORM.
DEFINE &SS_VAL1& = &S_VAL1&
DEFINE &SS_VAL2& = &S_VAL2&
else.
PERFORM GET_CURR_NEW IN PROGRAM ZREPORT1
USING &S_DATE&
USING &RF140-STIDA&
USING &RF140-WRSHB&
USING &SS_VAL1&
USING &SS_VAL2&
CHANGING &S_VAL1&
CHANGING &S_VAL2&
ENDPERFORM.
DEFINE &SS_VAL1& = &S_VAL1&
DEFINE &SS_VAL2& = &S_VAL2&
endif.In Program
FORM SET_FLAG.
As in this we will be getting one record at a time so for the very first record set it to 'X" and then "Y"
so to know its first record or the subsequent ones declare
data:g_int type 1 globally in the program.
if g_int = 0.
<Set WA_FLAG = 'X'>
else.
<Set WA_FLAG = 'Y'>
endif.ENDFORM.
PERFORM GET_CURR IN PROGRAM ZREPORT1
USING &S_DATE&
USING &RF140-STIDA&
USING &RF140-WRSHB&
USING &SS_VAL1&
USING &SS_VAL2&
CHANGING &S_VAL1&
CHANGING &S_VAL2&
ENDPERFORM.
Every time it goes to the above perform and for the first time I get back &S_VAL1& and &S_VAL2&..
But next time I want to pass &SS_VAL1& and &SS_VAL2& with help of using.
how do I assighn/set values to
S_VAL1 to SS_VAL1 and
S_VAL2 to SS_VAL2... in SAP script.?
Any ideas?
2008 Dec 08 7:02 PM
Hi,
Try this..
In the subroutine create a statics variable...so that the value is retained for the next call of the subroutine...
Ex..
FORM FORM1 ...
STATICS : V_MYVALUE TYPE CHAR10.
IF V_MYVALUE IS INITIAL.
* First time.
ELSE.
V_MYVALUE = 'TEST'.
* Subsequent times.
ENDIF.
ENDFORM.By doing this way...we don't have to assign the values in sapscript..
Thanks
Naren
2008 Dec 09 11:45 AM
Hi,
For the first time you want SS_VAL1(2) will be blank and then from 2nd time they will be populated with S_VAL1(2) respectively???
If my understanding is correct then do like:
In Script:
DEFINE &WA_FLAG& = ' '.
PERFORM SET_FLAG IN PROGRAM ZREPORT1
CHANGING &WA_FLAG&.
if &WA_FLAG& = 'X'
DEFINE &S_VAL1& = ' '.
DEFINE &S_VAL2& = ' ' .
PERFORM GET_CURR IN PROGRAM ZREPORT1
USING &S_DATE&
USING &RF140-STIDA&
USING &RF140-WRSHB&
CHANGING &S_VAL1&
CHANGING &S_VAL2&
ENDPERFORM.
DEFINE &SS_VAL1& = &S_VAL1&
DEFINE &SS_VAL2& = &S_VAL2&
else.
PERFORM GET_CURR_NEW IN PROGRAM ZREPORT1
USING &S_DATE&
USING &RF140-STIDA&
USING &RF140-WRSHB&
USING &SS_VAL1&
USING &SS_VAL2&
CHANGING &S_VAL1&
CHANGING &S_VAL2&
ENDPERFORM.
DEFINE &SS_VAL1& = &S_VAL1&
DEFINE &SS_VAL2& = &S_VAL2&
endif.In Program
FORM SET_FLAG.
As in this we will be getting one record at a time so for the very first record set it to 'X" and then "Y"
so to know its first record or the subsequent ones declare
data:g_int type 1 globally in the program.
if g_int = 0.
<Set WA_FLAG = 'X'>
else.
<Set WA_FLAG = 'Y'>
endif.ENDFORM.
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |