Implementing a Regular ( Normal ) Function Module and Calling it inside a program
- In the previous parts, we have discussed the various tabs of a function module.
- In this part we will write the logic for a regular function module and will call it inside a program.
Requirement :-
- Suppose, I want to display Sales order data from VBAK table based on the input Sales Document Number.
Solution :-
-
Step 1 :- Go to SE37 transaction code and create a function module.
-
Step 2 :- Now, In the Import tab, we need to pass the importing parameter.
-
We have to pass range of Sales Document number therefore we will have to pass the Range table of Sales Document number in this importing parameter.
-
I will simply pass this range table in the import tab.
-
-
Step 3 :- Go to export tab and pass the exporting parameter.
- Since, we want to export a list of data, therefore I will create a associated type for it from SE11 transaction code.
Structure :-
Table Type :-
-
Step 4 :- Now, pass this table type as a associated table type for the export paameter.
-
Step 5 :- Now write the logic in the source code tab.
Calling Regular function Module to our Program :-
-
Step 1 :- Go to SE38 transaction code ( ABAP Editor ) and create a executable program for the same.
-
Step 2 :- Create a type structure and corresponding internal table.
-
Step 3 :- Create a select option for the sales document number.
-
Step 4 :- Click on the pattern button and call the function module and import the internal table data.
-
Step 5 :- Display the result in form of ALV using factory and display method of CL_SALV_TABLE class.
Execute the Code :-
-
Press F8.
Comments
Post a Comment