2007 May 07 10:45 AM
hi ...
can any one help me in understanding subroutines using all ( tables, raising, using , changing ) parameters in both call by refrence and call by value method... with sample code....
thank u
Ginni
hi ...
can any one help me in understanding subroutines using all ( tables, raising, using , changing ) parameters in both call by refrence and call by value method... with sample code....
thank u
Ginni
2007 May 07 10:51 AM
Hi,
To help you understand better, just check this simple subroutine which uses using and changing parameters.
REPORT z_aris_test_12.
DATA: gv_export1(20) TYPE c VALUE 'Apple',
gv_export2(20) TYPE c VALUE 'Banana',
gv_flag TYPE flag VALUE 'X'.
START-OF-SELECTION.
PERFORM check_values USING gv_export1 gv_export2
CHANGING gv_flag.
&----
*& Form check_values
&----
text
----
-->%IMPORT1 text
-->%IMPORT2 text
-->%FLAG text
----
FORM check_values USING %import1 %import2
CHANGING %flag.
IF %import1 <> 'Apple'.
MOVE space TO %flag.
ENDIF.
IF %import2 <> 'Banana'.
MOVE space TO %flag.
ENDIF.
ENDFORM. "check_values
END-OF-SELECTION.
IF gv_flag = 'X'.
WRITE: 'Success!'.
ELSE.
WRITE: 'Fail!'.
ENDIF.
Hope it helps...
P.S. Please award points if it helps...
2007 May 07 10:51 AM
Hi
Subroutines are mainly used for reusability of code.
PERFORM <name> USING < fields>
Tables it_VBAK
Changing v_kunnr.
form <name> USING < fields>
Tables t_VBAK type VBAK
Changing p_kunnr.
......code...
endform...
Fields are passed by Value and Internal Tables are always passed by reference.
Three ways of calling subroutines:
call by value ..
call by reference
call by value and reference.
See the SAP documentation.
Reward points if useful
Regards
Anji
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |