How to find Events for a standard SAP transaction:
1. Go to Tcode: SE37
2. 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.
In simple words the event name is the value of the variable I_FBEVE.
10. So by this process you get the entire list of Events that are hit while execution of any standard process in SAP.
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:
1. Go to Tcode FQEVENTS.
2. Click on the binocular sign as shown below and enter the event name.
Note: If at any point the event name search shows not entries found then first click on ‘All Entries’ button and then again do the search.
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.
Detailed Steps:
1. 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:
3. Right Click on the object name of the function group and select copy as below
4. 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’.
5. Assign Package and TR and save the function group.
6. Click on the tick sign.
7. Then deselect the function modules and do not copy any of the function modules.
8. 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.
9. Now you want to create your custom FM
10. Go to Tcode SE37
11. Paste the standard FM name and click on the Copy button as shown in the screen shot below:
12. Enter a ‘ZFM_’ in front of the FM name, and enter the Custom FG you created as shown below. However you can give any name starting with z or y.
13. Click on Copy
14. Click on Tick
15. You can see the success message as shown below
16. Again in SE37 screen enter your custom FM name and click Change.
17. Click on tick
18. You can Change or Append the code in our custom FM
19. In the above screen you can provide your code.
20. Save and Activate the FM.
Assigning the Custom FM to SAP Event
Detailed Steps
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.
Testing:
Detailed Steps:
1. Enter Tcode SE37 and open your custom function module.
2. Put 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.
Credits:
Post a Comment