1. Create a function group. Before customizing a function, create a function group. Se37, go to function builder, and choose goto ---> function groups ---> Create group.
2. Enter the create function group and enter the corresponding name and remarks. Note that the name must start with "Z". Otherwise, the system prompts that you do not have the permission to perform the operation. Enter the access key. This may be because SAP has a set of rules. What we define is to start with "Z.
3. Click the green check box. The prompt is as follows:
4. Create your own function. Enter the corresponding function name and press create to continue.
5. Select the function group. Here I select the created zfmkg50. And fill in short text.
6. Here I will describe the functions implemented by this function. Pass in the and B values of the integer type, and then return the result of their addition. The following import defines the input parameters.
7. define the type of a value. Note that this associated type will pop up and select "Search for data elements ".
8. Enter and select "data type ".
9. Select int4. Check and return.
10. As shown in the following figure, I am not quite sure what this is for. It is estimated that we should choose the proper length.
11. The default value is 0.
12. Define B in the same way.
13. Final Result
14. Define the output result, which is defined at the export.
15. The input and output parameters are defined, and the specific implementation code is defined in the source code.
16. check whether it is correct. Activate it.
17. Call this function demonstration. se38 enters the ABAP editor and defines a program: ztestcallfm50,
18. Enter the Complete title and select executed program. Status and SAP standard production program.
19. Check and enter
20. Write the specific implementation code under report ztestcallfm50g. Of course, it also provides a shortcut. You can use the "pattern" button to call the function in a conversational manner.
21. In the pop-up dialog box, select the ztestfm50 function you just created.
22. The system automatically fills in some code.
23. On this basis, I complete the functions I want to implement.
24. check whether it is correct. Activate it. Run or F8 again to check the result. Note that you should not put the function in the edit State in another session; otherwise, the call is wrong.
The functions provided here are simple, but they only illustrate the process of calling a function in BW.