Thursday, 31 May 2012

on Leave a Comment

Function Module


Step-by-Step approach in creating a Function Module

1.       Open SE37 transaction.
Go to Goto à Function groups à Create group. 

 
2.       Give the function group name and short text. And click on Save. 
 
3.       Save this function group as local object. 
 
4.       Then open the transaction se80 and select the ‘Function group’ from the drop down list.  Enter the function group name. Press Enter. 
 
5.       Right click on ZSSR and press activate. 
 
6.       Then you will get the following screen. Press Enter. 
 
7.       Go to the transaction se37 again and click on create. 
 
8.       Now it will ask for the function group. Enter the function group and give the short text. Press Save. 
 
9.       Click on the Attributes tab and give the short text. 
 
10.   Click on the Import tab and enter the Parameter name, Type and Reference type of variables A and B. 
 
11.   Click on Export tab and enter the Parameter name, Type and reference type of RES. 




12.     Click on Exceptions tab and enter the Exception and short text for that exception. 
 
13.     Now click on the Source code tab and write the following lines as shown bellow. 
 
14.     Press syntax check button or Ctrl+F2. 
 
15.     Now press on Activate button or press Ctrl+F3. 
 
16.     Press Enter. 
 
17.     Now Press on Test button or Press F8. 


"     If you’re done, the just SAVE and ACTIVATE. Now execute TCODE Se38 and create a simple program to load this function. To load the function just click on the PATTERN button in the ABAP editor toolbar, and then type in the function name and click OK.     "



18.     Enter values for A and B. And press Execute or F8. 
19.     The following screen will be displayed with result. 
 
20.     If you enter A value as 5. it will throw exception. 
21.     Output with Exception. 
 
22.     Now create and enjoy more Function Modules.














0 comments:

Post a Comment