Академический Документы
Профессиональный Документы
Культура Документы
The present blog is only the adaptation of another one I wrote before. Unfortunately,
changing consulting jobs gives farewell to a SCN account to welcome a new one at the new
assignment. With that and not having a possibility that SAP consolidates content created by
the same individual, or having access to old SCN accounts, do not allow to easily update
blogs. Hopefully one day … one day.
Functional and technical SAP users sometimes do not have a SAP Developer Key, which
refrain them from having access to write basic ABAP code to explore particular scenarios,
themselves. BRFPlus is a tool still for which there is no needed a SAP Developer Key. That
fact provides some freedom to us, non-SAP-Developers, who still have basic SQL or SAP
Query experience.
Part 3, how to test out and how to call the function in an ABAP program.
Let’s begin.
1. The HR abouts.
In Part 2 of one of our previous blogs we explained in step 5 how the HR data is stored in
Solution Manager: 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 HR in general, data reflected in the Org Structure and displayed via transactions like
PPOMA_CRM, and is stored in tables HRP1000 and HRP1001, respectively. Let’s see with
an example.
1.1 To retrieve the records we start with a BP number (BP 233), which is stored in field
SHORT of table HRP1000. The entry found contains in field OBID the correspondent CP
(Central Person) number associated to that BP.
1.2 With that we can now search in table HRP1001 for a record which Object ID (OBJID)
matches the one we retrieved in the step before. From the records found, we pick up the one
with SCLAS = S (Position). From that record, we retrieve the content of field SOBID. That
is the S (Position) the BP holds.
1.3 Once more we search in table HRP1001, where ObjectID = the SOBID entry found
above. If among the records retrieved, there is an active entry (BEGDA and ENDA), with
SUBTY = A012, we conclude that the S (Position) we have is Manager of the Org Unit,
found in field SOBID.
Note: In other words, we followed 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.
The BRFPlus function receives a BP number and provides an output in a Boolean variable
confirming whether the entered BP is a Manager (1) or not (0).
2.2 Create a container where all your BRFPlus developments will be stored.
Provide some basic information, like package name and save and activate (always).
2.3 Create the Function.
With the cursor in the new folder, right click and create a function.
Note: Core objects in BRFPlus are functions. You can create many additional objects to
support a function like rules, actions, data objects, expressions, etc., but the only elements
that interact with the exterior (ABAP Programs, Services calls, etc.), are Functions.
Making objects Reusable is a very handy and saves a lot of time in the future.
We are not attaching all the screens, as there are many that question you if you want
to save the parent object. Always answer yes to those questions.
The key to populate most of the fields below is achieved by clicking the little triangles
on the side of the field to search or pick the possible value that fits your needs.
Keep in mind also the mapping you should enter almost every time. That is reflected
at the bottom of the picture below. It is quite easy to forget about mapping. You
always need to expand mapping if it is not displayed by default.
Note: This area is possible one of the trickiest pieces of BRF+. It is not straight forward how
to create the select statements and a lot of test and trial may be required up until you are able
to control the beast and know how to properly insert the correct SQLs statements. Just be
patient when doing the work fo the first time. It will eventually click in.
In Mapping assigned the select to Source Field SOBID, then Check, Save, and Activate.
If you press the Back button you will see that the 1st rule is completed. Let’s finish the same
way by Inserting the second rule.
The screen will look like this for now. Click on LOOK4MGR.
The processing is the same as before, so we only attach the final screen.
Go back the ruleset.
We continue completing the SQL statements to complete the exercise and test the solution.
Same way with the Else
Note: If by any chance a rule is not in the right order as in the case below, pick it up and
move it up or down:
Now that the rules are in the right execution order, check, save, and activate. Remember to
confirm any message to activate any depending or referenced objects.
Your Function is ready for testing. Double-click on it and press the Simulation button.
There are different flavors in the simulation that you may want to explore on your own in the
future. For now, let’s follow the happy path:
We will use the same BP we manually used at the beginning of this blog, so that we can
confirm the intermediate steps all come up to extract the same data. Note that you can also
import data from an external file to test your function.
The result shows that the entered BP is a Manager. The nice thing about the step by step
simulation is that you can see what happened at each step, the intermediate results and
evaluate if you need to fix something if the processing is broken somewhere between the
begin and the end.
As you can confirm also via transaction PPOMA_CRM, the BP 233 is a Manager, so the
function is correct. The little man with the hat represents a manager ob the object
immediately above.
We can also quickly testing the function with BP 663, which is not a manager, so the result
will be False. That BP is not a Manager.
There are various uses, among the three most common: you can Generate a Function Module
(RFC), a Web Service, or simply call the function from an ABAP Program.
You will need to add the code below to your ABAP program.
…
* Init BRFPlus
lo_factory = cl_fdt_factory=>if_fdt_factory~get_instance( ).
try.
lo_context = lo_function->get_process_context( ).
write / <ls_message>–text.
endloop. endtry.
* End of BRFPlus
http://www.sap-press.com/products/BRFplus-%E2%80%94-Business-Rule-Management-for-
ABAP-Applications.html
2. BRFPlus. There is this 1-2 days training in BRFplus you can get for free. Excellent
material, well organized. There are 3 sessions that tell you how that works.
http://scn.sap.com/docs/DOC-8824?rid=/webcontent/uuid/90754865-f283-2b10-6d9f-
b10f3c28c3a0
Enjoy,
Juan-Carlos