2008 Jul 11 10:10 AM
Hii,
Can anyone give me the complete information about subroutines. How, PERFORM (Using and changing), FORM are used.
thanks,
raj
Hii,
Can anyone give me the complete information about subroutines. How, PERFORM (Using and changing), FORM are used.
thanks,
raj
2008 Jul 11 10:11 AM
Hi,
Pls Go through the following link,you will get Deatil description on subrouitne
http://help.sap.com/saphelp_46c/helpdata/en/9f/db975c35c111d1829f0000e829fbfe/content.htm
http://help.sap.com/saphelp_nw70/helpdata/en/9f/db982c35c111d1829f0000e829fbfe/content.htm
SAMPLE Code
http://abaplovers.blogspot.com/2008/03/sap-abap-tutorial-on-subroutines.html
Regards,
Sujit
2008 Jul 11 10:11 AM
hi,
check out these links.
http://help.sap.com/saphelp_nw70/helpdata/en/9f/db982c35c111d1829f0000e829fbfe/content.htm
http://sap.ittoolbox.com/documents/popular-q-and-a/macro-vs-subroutine-1594#
regards
Sumit Agarwal
2008 Jul 11 10:12 AM
Hi,
Check the following link
[http://help.sap.com/saphelp_46c/helpdata/en/9f/db976935c111d1829f0000e829fbfe/content.htm]
regards,
Anirban Bhattacharjee
2008 Jul 11 10:14 AM
All are modularization techniques but typically the INCLUDE is for data structures, the PERFORM is for ABAP/4 subroutines and function modules are for non-ABAP/4 subroutines.
By Value:When the subroutine is called ,the formal parameters are copies of the actual parameters(with their own storage location)
By Value and Result : the formal parameters have a separate storage location .At the end of subroutine the value of the formal parameter is passed to the storage location of the actual parameter
Assigned
By Reference: when called the formal parameters are not allocated separate storage locations. Instead the address of the actual parameter is passed. Changes to the values of the formal parameters therefore have a direct effect on the assigned main program fields.
PERFORM <name> USING <a1> <a2> <a3> <a4>
FORM <name > [TABLES <table name>] USING VALUE (<f1>) CHANGING VALUE (<f2>)
Include:
INCLUDE <name>
Function modules:
CALL FUNCTION u2018function nameu2019
EXPORTING u2026
IMPORTING u2026
The EXCEPTIONS parameter is a section in the CALL FUNCTION statement where exceptional situations can be processed.
CALL FUNCTION u2018function nameu2019
EXPORTINGu2026
IMPORTINGu2026
EXCEPTIONS NOT_FOUND = 3D1
NOT_VALID = 3D2
OTHERS = 3D3
CASE SY-SUBRC
WHEN 1
WHEN 2
Regards,
Rajasekhar Reddy
2008 Jul 11 10:19 AM
SAP Help for performs in:
[ABAP|http://help.sap.com/saphelp_nwpi71/helpdata/en/9f/db976935c111d1829f0000e829fbfe/frameset.htm]
[Sapscript|http://help.sap.com/saphelp_nwpi71/helpdata/en/d1/803279454211d189710000e8322d00/frameset.htm]
2008 Jul 11 10:19 AM
Hello,
In abap, there is a concept of modularization to increase the reusability of the code/function.So along with subroutines,i would suggest you to even have a little idea of all these techniques.Just check these links in the sequence.
Modularization
http://help.sap.com/saphelp_nw70/helpdata/en/9f/db970e35c111d1829f0000e829fbfe/content.htm
Now u can go through :-
http://help.sap.com/saphelp_nw70/helpdata/en/9f/db974f35c111d1829f0000e829fbfe/content.htm
Go through the topis,i.e, Function modules & subroutines
Regards,
Bhumika
2008 Jul 11 10:23 AM
Hi,
Yeah.Generally To avoid code redundancy we go for Subroutines. To complete a single complete process subroutines can be used.
an example will make u understand better.
DATA: itab TYPE STANDARD TABLE OF vbak,
field1 TYPE vbak-vbeln,
field2 TYPE vbap-posnr.
PERFORM get_data TABLES itab
USING field1
CHANGING field2
.
*&---------------------------------------------------------------------*
*& Form get_data
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->IT_TAB1 text
* -->IV_FIELD1 text
* -->OV_FIELD2 text
*----------------------------------------------------------------------*
FORM get_data TABLES it_tab1
USING iv_field1
CHANGING ov_field2
.
ENDFORM. "get_data
Here note that the *order of TABLES, USING, CHANGING should not be changed as USING, TABLES, CHANGING which will not work*
the values you pass throuhg USING cannot be changed inside the subroutine ( so its READ ONLY )
the tables should be passed in TABLES which can be changed
Cheers
Kothand
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |