SE387 FM Step

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 13

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.


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.

Test BAPI in Function Builder (SE37) Using Test


Sequences
September 11, 2013 ABAP Workbench 0

How to test a create/change BAPI that requires a database commit in function


builder?

Let us test a BAPI (BAPI_GOODSMVT_CREATE) that requires a database


commit without writing any code. First go to functional builder (SE37), enter
the name of the BAPI and select the menu Function Module –> Test –> Test
Sequences
Enter the BAPI names i.e. BAPI_GOODSMVT_CREATE and
BAPI_TRANSACTION_COMMIT that we want to execute in a sequence and
press execute.
As soon as execute is pressed, test environment for BAPI
BAPI_GOODSMVT_CREATE will be triggered. Enter the appropriate input for
the BAPI and execute.

The BAPI will create the material document.


At this point the material document is not yet stored in database since
database commit is not yet issued. Go to MB03 and try to display the material
document 4900324182/2013.

Go back to SE37 and press BACK.

As soon as back button is pressed, test environment for


BAPI_TRANSACTION_COMMIT will be triggered. Just execute to issue the
database commit.

Now go to MB03 and check the material document.

You might also like