Function Module with Import Parameter in SAP


Creating a Function Module with Import Parameter in SAP

Best SAP ABAP Latest Course

SAP ABAP Fundamentals

SAP ABAP Interview Questions – Real Time

Before creating the Function Module first create the Function Group. (Go to Function Group).

Step 1: Go to T-code SE37. Enter the name of the Function Module and create. Enter the name of Function Group you created before and Short text of the Function Module. Click on Save Button.

Step 2: A pop-up will display, click on the button.

Step 3: Under the Attributes tab, you can change the Short Text, if you want.

Step 4: Under the Import tab, create a parameter as shown below.

Step 5: Under the Table tab, create a table parameter as shown below.

Step 6: Under the Exceptions tab, create an Exceptions Parameter with short text as shown below.

Step 7: Under the Source Code tab, write the code as shown below.

FUNCTION ZFUNCMOD1.
*”———————————————————————-
*”*”Local Interface:
*” IMPORTING
*” REFERENCE(I_POSNR) TYPE VBAP-POSNR
*” TABLES
*” T_VBAP STRUCTURE VBAP
*”———————————————————————-

SELECT * FROM VBAP INTO TABLE T_VBAP UP TO 50 ROWS
WHERE POSNR = I_POSNR.

ENDFUNCTION.

 

Step 8: Click on save  button and activate it.

 
Step 9: Now click on button and enter the value in Import Button and click on the button.

Step 10: Output is in Table parameter. To view the output click on button .