It’s a typical ABAPer scenario: you need to create or update SAP data and you’re fairly certain there should be a standard function module around that data. So how do you go about finding that function module?
Most major objects have a BAPI wrapped around them. In these cases you can call the function module behind the BAPI methods from your ABAP program. To find the BAPI and related function modules use the transaction code BAPI. Browse through either the hierarchical or alphabetical list until you find the object of interest. Expand the object and you will see all the operations available for that object. Select one of the operations and a new window will appear with the details of that operation including (surprise!) the function module associated with that operation.
Sometimes you get lucky and the function module has an intuitive name. In this case, a quick search from SE37 will turn up some good possibilities. For example, searching for *USER* finds hundreds of function modules for every type of user-related operation you can think of.
Unfortunately, some objects do not have an associated BAPI, nor an easy-to-find function module name. Here’s a method that has worked for me in these situations:
Go to the screen whose functionality you are trying to recreate. In this example I was looking for a function module to create a PRT. The TCode to manually create a PRT is CF01.
Select Status from the System menu and look at the last 4 characters of the program name – in this case, CFST.
Now go to SE37 and click the function module search help. Put the 4 characters into the function group name and search.
You can also try searching for function modules (not function groups) using the pattern *CFST* or *CF_ST* (using the characters specific to your scenario).
In this case, I was able to find a less-than-intuitively-named function module to create PRTs.