Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

form returns a value r not ????????????

Former Member
0 Likes
1,095

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),,,,,,,,

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,052

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),,,,,,,,

6 REPLIES 6
Read only

Former Member
0 Likes
1,052

Hi,

It depends on the way the coding is done.

Could you please paste the code.

Best regards,

Prashant

Read only

Former Member
0 Likes
1,053

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

Read only

0 Likes
1,052

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

Read only

0 Likes
1,052

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.

Read only

Former Member
0 Likes
1,052

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^

Read only

0 Likes
1,052

hi usha,varma,Mrutyunjaya

tks 4 ur kindness, now my doubt was cleared..........