Today I thought to share with you a detailed screen by screen implementations of custom FM in SAP Events in SAP ISU. No step will be jumped and screenshot will be provided for every minute points. It will be taken care that if you try to implement this in your system and find something missing in the literature, you can always refer to the screenshots.
From this blog you will get to know:
- How to find Events for any standard SAP application.
- How to implement custom Function Module for the event.
Wish you a very Happy Read !!!!
Step by step process:
First process: How to find Events for a standard SAP transaction:
- Go to Tcode: SE37
- Enter function module name: FKK_FUNC_MODULE_DETERMINE
3. Click on Display
4. Go to line number 32 and place a BreakPoint.
5. We will find the events that are hit during Installment Plan creation. (Tcode FPR1)
6. Go to SAP eassy access screen and Enter Tcode FPR1 and press enter.
Note: If you want to find the events that are hit in any intermediate process in any standard transaction (I mean to say not exactly after entry of the Tcode) then follow the same process as stated below but keep pressing F8 until your desired screen is hit.
7. The system will open a debugger session and the function module FKK_FUNC_MODULE_DETERMINE.
8. Double click on the variable I_FBEVE (as per the above screen shot 1107 is the event number). The value of this variable is the events hit at that time.
9. Press F8 and if there is any other event that is being hit then the debugger will stop at this particular event and the value of the variable I_FBEVE will change to the event name.
10. So by this process you get the entire list of Events that are hit while execution of any standard process in SAP.
Second Process: Implementing Custom Code:
After determining the event name, the next step is to implementing your custom code in the event so that customer’s enhanced requirements can be complemented and the custom code can be executed while execution of the standard TCODE.
Steps are as follows:
- Go to Tcode FQEVENTS.
- Click on the binocular sign as shown below and enter the event name.
3. Double click on the Event name
4. The event opens on the right sub-screen: It has two tabs: Documentation and Function modules. From the documentation you will get to know about how and when the event is hit and what are expected if custom enhancements are implemented.
5. In the Function Module tab: You will get the sample function module for each and every event in SAP. The second portion is the Standard Function module. This function module is the SAP provided FM for the event and the logic of this function module can be changed or appended. The sample function module will generally be blank and the standard FM will have some code in it.Now I will explain in detail how to create own custom function module for the SAP event and configure the same to the event.
- Enter Tcode SE80
2. From the drop down select function module3. Enter the standard FM from the event (if standard FM is not present then paste here the Sample FM)4. The function group will be displayed automatically as shown below:
5. Right Click on the object name of the function group and select copy as below
6. In the next screen which appears, enter your custom function group name, just enter ‘ZFG_’ in front of the standard FG name. Provide a FG text. Click on ‘Copy’.
7. Assign Package and TR and save the function group.
8. Click on the tick sign.
9. Then deselect the function modules and do not copy any of the function modules.
10. As seen in the above screen the object name of your custom FG is seen with the objects that are copied from the standard function module.
11. Now you want to create your custom FM
12. Go to Tcode SE37
13. Paste the standard FM name and click on the Copy button as shown in the screen shot below:
15. Click on Copy
16. Click on Tick
17. You can see the success message as shown below
19. Click on tick
21. In the above screen you can provide your code.
22. Save and Activate the FM.
Third Process: Assigning the vustom FM to SAP Event
1. Go to the FQEVENTS screen as shown above go to the Function Modules sub-screen, and press the change pencil button as shown below.
2. The following screen appears as shown below:
3. Click on new entries.
4. Enter the sequence number as 0 and the custom function module name which you have created, in the above steps.
5. Save and assign it to a Customizing TR.
6. After assigning the custom FM to the event you will find the activated sign, (torch) have shifted in front of the Installation specific function module.
7. Go to the tcode SE80 enter the custom function group which you created.
8. Right click on the object (FG) and activate the FG.
By this you have completed assigning the custom function module to the Event.
Now it’s time to test whether your custom function module is executed or not while executing the standard Tcode.
- Enter Tcode SE37 and open your custom function module.
- Pout a break point on the starting of the executable line of your custom function module
3. Enter Tcode FPR1 and press ENTER.
4. Second screen appears, ‘Create Installment Plan: Initial Screen’
5, Enter the required fields namely: Contract Account, Currency, Reconciliation key, and other fields will be auto-populated as per configuration as the above screen.
6. The next screen is as shown below.
The code is right into your custom FM.
So this was all I had to share with you……
See you soon in some other topic…
Until then have some good food, plenty of water, plant trees and save the mother nature !!!!