For the functional and technical SAP users working with CRM or ChaRM, sometimes the fact that they do not have a Developer Key refrains them from having access to write basic ABAP code to get by in some scenarios. BRFPlus is a new tool still for which you do not need a developer key. That fact gives some kind of freedom to us, the non-developers, who have some basic SQL or SAP Query experience.
1. We have a need to confirm is an Employee (EE) in the form of BP is a Manager of an Org. Unit. We want to use BRFPlus to retrieve in a boolean variable if the EE is Manager (1) or not (0).
2. We want to know how to add the BRFPlust call within an ABAP program.
Part 1. will show how to create the BRF+ Function.
Part 2. will show how to test it out and how to call it from an ABAP program.
1. Our BRFPlus Function.
The HR relationship from A012 determines if a EE is Manager.
In Part 2 of one of our previous blogs we explain in step 5 how the HR data is stored for ChaRM in our system http://scn.sap.com/community/it-management/alm/solution-manager/blog/2014/01/22/sap-crmsolman-charm-multiple-target-agents-via-sap-workflow–minimal-abap-development–part-2
In essence the HR data that reflects the Org Structure found in transaction PPOMA_CRM is stored in tables HRP1000 and HRP1001. Let’s follow with an example.
1.1 To retrieve the records for our case, we start with a BP number (BP ending with 28), which is stored in field SHORT of table HRP1000. The entry found contains in field SOBID the correspondent CP (Central Person) number associated to that BP.
1. 2.With that, we search table HRP1001 for a record which Object ID matches the one we retrieve from the step above. We refine that search looking for a SCLAS field = S (Position). From the found record we retrieve the contents of a field SOBID. That is the S (Position) the BP holds.
1.3 With that we search again in table HRP1001, where ObjectID = the SOBID entry found above. If in that table there is an active entry (BEGDA and ENDA) with SUBTY = A012, that S (Position) is Manager of the Org Unit in field SOBID.
Note: In other words, we follow the path CP-S-O (Central Person to Position to Org. Unit), to get to know if a BP is Manager of an Org. Unit.
Let’s provide the screen shots of the BRFPlus function we created to satisfy that. The BRFPlus function receives a BP number and provides in an output boolean variable whether the entered BP is a Manager (1) or not (0).
Launch transaction BRFPLUS.
The first thing you need to do is to create a container where all your BRFPlus developments will be stored.
Provide some basic information, like package name and save and activate (always).
With the cursor in the new folder, right click and create a function. BTY, the core object in BRFPlus are functions. You can create any additional object, like rules, actions, data objects, expressions, etc., but the only element that interact with the exterior are Functions.
Select the Tab Signature and add the Import Parameter.
Now add the Export Variable.
Things should look like this.
Back to the tab Properties, Select Function and Event and click the little square below and select create [expression]
The top expression that we are about to create is the gate we enter into the HRP tables. It is the first select statement.
Note: Is Reusableis a very useful, because you can then use this expression in any other BRF+ function in the future.
Note: We are not attaching all the screens, as there are many that ask you if you want to save the parent object. Always answer yes to those ones. Parent because we started with the function and now we are jumping to an expression, which switches to another screen, so BRF+ needs to make sure the work is saved as we progress.
Now, create the 1st data retrieval. As you have created all the parameters and variables, do not type in the empty oxes, but rather select the little triangles besides each field to select the correspondent object from the DB.
Also, keep in mind the mapping you must enter, which is reflected at the bottom of the picture. It is quite easy to forget about it, as you have to expand (SHow Mapping), to have access to it.
Save your changes for now. The 1st type of the retrieval is completed.
Press the back button of the object to continue.
Now we are creating a Ruleset.
We are adding two rules, one to retrieve teh S (Position), and the other one to confirm that S is a Manager or Not.
This area is possible one of the trickets ones BRF+ has. It is not straight forward hwo to create the select statements and a lot of test and try was required until we were able to know how to properly insert the correct SQLs. Be patient yourself whend doing the same.
Click the Insert Rule button > Create.
and so on and so forth, until.
Select from the available fields FINALOBJECT2, open up Sho Mapping and add the missing field.
If you press the Back button you will see that the 1st rule is completed. Let’s finish the same way Inserting the second rule.
The process is the same as before, so we only attach the final screen.
The final screens, testing an example of call from an ABAP program are found in Part 2.