Greetings.

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.

Scenario.

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.

Let’s begin.

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.

HRP1000_3.gif

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.

HRP1000_3.gif

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.

HRP1001_4.gif

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.

BRFPLUS_8.gif

Provide some basic information, like package name and save and activate (always).

BRFPLUS_9.gif

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.

BRFPLUS_A.gif

BRFPLUS_B.gif

Select the Tab Signature and add the Import Parameter.

BRFPLUS_I.gif

BRFPLUS_J.gif

Now add the Export Variable.

BRFPLUS_K.gif

BRFPLUS_L.gif

Things should look like this.

BRFPLUS_M.gif

Back to the tab Properties, Select Function and Event and click the little square below and select create [expression]

BRFPLUS_C.gif

The top expression that we are about to create is the gate we enter into the HRP tables.  It is the first select statement.

BRFPLUS_N.gif

NoteIs 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.

BRFPLUS_P.gif

Save your changes for now.   The 1st type of the retrieval is completed.

Press the back button of the object to continue.

BRFPLUS_Q.gif

Now we are creating a Ruleset.

BRFPLUS_R.gif

BRFPLUS_S.gif

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.

BRFPLUS_T.gif

BRFPLUS_U.gif

BRFPLUS_V.gif

BRFPLUS_W.gif

BRFPLUS_X.gif

and so on and so forth, until.

BRFPLUS_Y.gif

Select from the available fields FINALOBJECT2, open up Sho Mapping and add the missing field.

BRFPLUS_Z.gif

Save.

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.

BRFPLUS2_1.gif

BRFPLUS2_2.gif

BRFPLUS2_3.gif

The process is the same as before, so we only attach the final screen.

BRFPLUS2_7.gif

BRFPLUS2_8.gif

The final screens, testing an example of call from an ABAP program are found in Part 2.

http://scn.sap.com/community/it-management/alm/solution-manager/blog/2014/01/24/basic-brfplus-example-to-confirm-if-an-employee-is-a-team-lead-manager-or-not-part-2

To report this post you need to login first.

1 Comment

You must be Logged on to comment or reply to a post.

  1. Jocelyn Dart

    Hi Juan-Carlos,  A nice example.  Of course it would be good to see this implemented in a more advanced example using perhaps a call to RH_GET_LEADING_POSITION from BRF+ instead.

    As a SCN Moderator, I’m wondering why you originally posted this to the Solution Manager space? I’m sure it would gain higher recognition if you posted it to the Business Rules Management space. You might want to consider moving it?

    Rgds,

    Jocelyn

    (0) 

Leave a Reply