‎2007 Jun 18 1:31 PM
hi gurus,
till now i was using form(or subroutine)
like this
form.
the code
....
...
endform.
but i got a assignment in which
CALLING is done
tables i_mess.
changing fields-pernr
fields-workdate
DECLARATION
Tables it_mess structure name
Changing p_pernnr type name-pernr
p_wdate type name-workdate
please help me and explan me what is happenning in this and why one use the type of subroutine.
thanks regrads
anuj
‎2007 Jun 18 1:44 PM
HI,
You list these parameters after USING or CHANGING without the VALUE addition:
FORM <subr> USING ... <pi> [TYPE <t>|LIKE <f>] ...
CHANGING ... <pi> [TYPE <t>|LIKE <f>] ...
The formal parameter occupies no memory of its own. During a subroutine call, only the address of the actual parameter is transferred to the formal parameter. The subroutine works with the field from the calling program. If the value of the formal parameter changes, the contents of the actual parameter in the calling program also change.
For calling by reference, USING and CHANGING are equivalent. For documentation purposes, you should use USING for input parameters which are not changed in the subroutine, and CHANGING for output parameters which are changed in the subroutine.
To avoid the value of an actual parameter being changed automatically, you must pass it by value.
http://help.sap.com/saphelp_sm32/helpdata/en/9f/db979035c111d1829f0000e829fbfe/content.htm
http://help.sap.com/saphelp_nw04/helpdata/en/9f/db984635c111d1829f0000e829fbfe/content.htm
Regards
Sudheer