2007 Oct 16 10:39 AM
i want 2 know wether it return a value r not....................bcoz some 1 said it returns and rest of them said it only change the value in the address (it doesnt mean that it return's a value),,,,,,,,
2007 Oct 16 10:48 AM
yaa it can return a value.
If you want to return a changed output parameter from a subroutine to the calling program only after the subroutine has run successfully, use CHANGING for the <pass> option of the FORM and PERFORM
If you want to keep the value of a local data object after exiting the subroutine, you must use the STATICS statement to declare it instead of the DATA statement. With STATICS you declare a data object that is globally defined, but only locally visible from the subroutine in which it is defined.
STATICS f_text TYPE f_word VALUE 'INIT'.
Reward points if useful,
Thanks,
Usha
i want 2 know wether it return a value r not....................bcoz some 1 said it returns and rest of them said it only change the value in the address (it doesnt mean that it return's a value),,,,,,,,
2007 Oct 16 10:41 AM
Hi,
It depends on the way the coding is done.
Could you please paste the code.
Best regards,
Prashant
2007 Oct 16 10:48 AM
yaa it can return a value.
If you want to return a changed output parameter from a subroutine to the calling program only after the subroutine has run successfully, use CHANGING for the <pass> option of the FORM and PERFORM
If you want to keep the value of a local data object after exiting the subroutine, you must use the STATICS statement to declare it instead of the DATA statement. With STATICS you declare a data object that is globally defined, but only locally visible from the subroutine in which it is defined.
STATICS f_text TYPE f_word VALUE 'INIT'.
Reward points if useful,
Thanks,
Usha
2007 Oct 16 11:04 AM
hi usha
ur answer open my blocks but i hav another doubt that wether form return a value r it change the value which present in the particular address
2007 Oct 16 11:17 AM
Hi Subu.
<b> in case of CALL BY REFERENCE:</b>
Subroutines (Forms) do not return the Values explicitly.
But they will change the value of the Actual Parameter directly
Eg:
PERFORM F_CALC USING X Y.
FORM F_CALC USING A B. "Pass by ref
A = 10. "changes the value of Actual Parameter X
ENDFORM.
<b> in case of CALL BY VALUE AND RESULT:</b>
Subroutines (Forms) do return the Values to actual parameters.
Eg:
PERFORM F_CALC USING X Y.
FORM F_CALC CHNAGING VALUE(A) VALUE(B). "Pass by Value and result
A = 10. "Returns the value to X only if Form is executed completely
ENDFORM.
REWARD IF HELPFUL.
2007 Oct 16 11:22 AM
hi
good
pls go through this
A subroutine is a block of code introduced by FORM and concluded by ENDFORM.
FORM <subr> [USING ... [VALUE(]<pi>[)] [TYPE <t>|LIKE <f>]... ]
[CHANGING... [VALUE(]<pi>[)] [TYPE <t>|LIKE <f>]... ].
...
ENDFORM.
<subr> is the name of the subroutine. The optional additions USING and CHANGING define the parameter interface. Like any other processing block, subroutines cannot be nested. You should therefore place your subroutine definitions at the end of the program, especially for executable programs (type 1). In this way, you eliminate the risk of accidentally ending an event block in the wrong place by inserting a FORM...ENDFORM block.
http://help.sap.com/saphelp_46c/helpdata/en/9f/db976935c111d1829f0000e829fbfe/content.htm
reward point if helpful,
thanks
mrutyun^
2007 Oct 16 11:51 AM
hi usha,varma,Mrutyunjaya
tks 4 ur kindness, now my doubt was cleared..........
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |