Human Capital Management Blogs by SAP
Get insider info on HCM solutions for core HR and payroll, time and attendance, talent management, employee experience management, and more in this SAP blog.
cancel
Showing results for 
Search instead for 
Did you mean: 
paramitamukherj
Product and Topic Expert
Product and Topic Expert
Business Integration Builder tool which is commonly known as BIB is a framework which Integrates the Employee Master data from Success Factor Employee Central (EC) to SAP ERP HCM. Detailed documentation about Business Integration tool can be found here. 

One of the most faced issues during integration is the difference in the data model between the integrating systems. To resolve these differences, it is important that the source data is converted to the destination data format for a successful Employee master data replication. BIB framework is equipped with the ‘Value Conversion Rules’ within the transformation template group which converts the EC specific data to ERP specific data format.  

The details about the Value conversion rule can be found in the BIB guide here. This document explains the different operations (Arithmetic/String/Regular Expressions) which can be achieved using Value conversion rules and I would recommend you to also check the video to get a good understanding of the same.  

In this blog post, I will provide a custom report which you can implement in your ABAP HR(PA_SE_IN addon) system for testing the Value conversion Rules used in BIB before you create them in the transformation template. When the value conversions are created directly within the transformation template group, the only way to test the rules is to trigger an Employee replication. However with this report, you can now test the conversion rules before you create the same within the transformation templates. This will help in determining the correct value conversion rules needed for the conversion of EC fields during your BIB implementation project and reduce the manual effort. The value conversion rule logic implemented in BIB has been reused in this report to simulate the exact behavior.  

We will use similar fields in the report which is available in the BIB transformation template. However, a few fields are not required for simulation and hence we will not be using them in the report. The ones highlighted in the image will not be used in the report. 


The field PARAMETER_EC_FLD is the EC field ID which is used in the value conversion rule which helps to get the value of the field from the payload response during Employee replication. In the report, we will replace this field id with the EC value since we would be knowing this value during the simulation.  

The selection screen will be displayed as shown in the below image. Multiple value conversion rules can be maintained here and the execution will depend on the order of the rules maintained. The input parameter ‘EC value’ in the report(in the top) implies the EC value which should be converted to ERP data format. 

Note: The value conversion rules ‘Check and Remove’ and ‘Check and remove when doesn’t match’ have not been considered in the report since the purpose of these two rules are to ignore the record in case of a mismatch. 


I’ve provided a very basic selection screen. However it can be beautified based on your requirements. Please create an executable report in transaction SE38 and copy the code as shown below.  The values for texts are:































text-001  Test Conversion Rules 
text-002  Conversion Rule 
text-003  Parameter1 
text-004  Parameter2 
text-005  EC Field Value 
text-006  Enter the EC value which needs to be converted 
text-007  EC Value 

REPORT zconv_rule_test.

SELECTION-SCREEN BEGIN OF BLOCK bb WITH FRAME TITLE text-006.
SELECTION-SCREEN BEGIN OF LINE.
PARAMETER pv_value TYPE string VISIBLE LENGTH 20 OBLIGATORY.
SELECTION-SCREEN COMMENT (20text-007 FOR FIELD pv_value.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK bb.

SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
SELECTION-SCREEN BEGIN OF LINE.
PARAMETERS pv_rule TYPE ecpao_conversion_rule AS LISTBOX VISIBLE LENGTH 15.
SELECTION-SCREEN COMMENT (15text-002 FOR FIELD pv_rule.
PARAMETERS p_1 TYPE ecpao_conversion_parameter.
SELECTION-SCREEN COMMENT (10text-003 FOR FIELD p_1.
PARAMETERS p_2 TYPE ecpao_conversion_parameter.
SELECTION-SCREEN COMMENT (10text-004 FOR FIELD p_2.
PARAMETERS ec_field TYPE string VISIBLE LENGTH 10.
SELECTION-SCREEN COMMENT (15text-005 FOR FIELD ec_field.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK b1.

SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME.
SELECTION-SCREEN BEGIN OF LINE.
PARAMETERS pv_rule1 TYPE ecpao_conversion_rule AS LISTBOX VISIBLE LENGTH 15.
SELECTION-SCREEN COMMENT (15text-002 FOR FIELD pv_rule.
PARAMETERS p_11 TYPE ecpao_conversion_parameter.
SELECTION-SCREEN COMMENT (10text-003 FOR FIELD p_1.
PARAMETERS p_21 TYPE ecpao_conversion_parameter.
SELECTION-SCREEN COMMENT (10text-004 FOR FIELD p_2.
PARAMETERS ecfield1 TYPE string VISIBLE LENGTH 10.
SELECTION-SCREEN COMMENT (15text-005 FOR FIELD ec_field.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK b2.

SELECTION-SCREEN BEGIN OF BLOCK b3 WITH FRAME.
SELECTION-SCREEN BEGIN OF LINE.
PARAMETERS pv_rule2 TYPE ecpao_conversion_rule AS LISTBOX VISIBLE LENGTH 15.
SELECTION-SCREEN COMMENT (15text-002 FOR FIELD pv_rule.
PARAMETERS p_12 TYPE ecpao_conversion_parameter.
SELECTION-SCREEN COMMENT (10text-003 FOR FIELD p_1.
PARAMETERS p_22 TYPE ecpao_conversion_parameter.
SELECTION-SCREEN COMMENT (10text-004 FOR FIELD p_2.
PARAMETERS ecfield2 TYPE string VISIBLE LENGTH 10.
SELECTION-SCREEN COMMENT (15text-005 FOR FIELD ec_field.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK b3.

SELECTION-SCREEN BEGIN OF BLOCK b4 WITH FRAME.
SELECTION-SCREEN BEGIN OF LINE.
PARAMETERS pv_rule3 TYPE ecpao_conversion_rule AS LISTBOX VISIBLE LENGTH 15.
SELECTION-SCREEN COMMENT (15text-002 FOR FIELD pv_rule.
PARAMETERS p_13 TYPE ecpao_conversion_parameter.
SELECTION-SCREEN COMMENT (10text-003 FOR FIELD p_1.
PARAMETERS p_23 TYPE ecpao_conversion_parameter.
SELECTION-SCREEN COMMENT (10text-004 FOR FIELD p_2.
PARAMETERS ecfield3 TYPE string VISIBLE LENGTH 10.
SELECTION-SCREEN COMMENT (15text-005 FOR FIELD ec_field.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK b4.

TYPESBEGIN OF ty_valconv,
rule       TYPE ecpao_conversion_rule,
parameter1 TYPE ecpao_conversion_parameter,
parameter2 TYPE ecpao_conversion_parameter,
ecfield    TYPE string,
END OF ty_valconv.

DATAtt_valconv TYPE STANDARD TABLE OF ty_valconv.
DATAls_valconv TYPE ty_valconv.
DATAvalue TYPE string.

DATA lv_ec_fld_string TYPE string.
DATA lv_filler TYPE string.
DATA lv_regex TYPE string.
DATA lv_adjust_len TYPE int2.
DATA lv_string_len TYPE int2.
DATA lv_string1 TYPE string.
DATA lv_string2 TYPE string.
DATA lv_splitter TYPE string.
DATA lv_masked_string TYPE char20.

value pv_value"Value from EC field

*First Conversion Rule
ls_valconv-rule pv_rule.
ls_valconv-parameter1 p_1.
ls_valconv-parameter2 p_2.
ls_valconv-ecfield ec_field.
APPEND ls_valconv TO tt_valconv.

*Second conversion Rule
ls_valconv-rule pv_rule1.
ls_valconv-parameter1 p_11.
ls_valconv-parameter2 p_21.
ls_valconv-ecfield ecfield1.
APPEND ls_valconv TO tt_valconv.

*Third Conversion Rule
ls_valconv-rule pv_rule2.
ls_valconv-parameter1 p_12.
ls_valconv-parameter2 p_22.
ls_valconv-ecfield ecfield2.
APPEND ls_valconv TO tt_valconv.

*Fourth Conversion Rule
ls_valconv-rule pv_rule3.
ls_valconv-parameter1 p_13.
ls_valconv-parameter2 p_23.
ls_valconv-ecfield ecfield3.
APPEND ls_valconv TO tt_valconv.

CLEARls_valconv.

LOOP AT tt_valconv INTO ls_valconv.

IF NOT ls_valconv-rule IS INITIAL.

IF ls_valconv-rule BETWEEN '01' AND '10'.
*    TRY.
CALL METHOD cl_ecpao_value_conversion=>if_ecpao_value_conversion~perform_arith_conv
EXPORTING
conv_rule ls_valconv-rule
parameter ls_valconv-parameter1
CHANGING
value     value.
*     CATCH cx_sy_conversion_error .
*     CATCH cx_sy_arithmetic_error .
*    ENDTRY.
cl_demo_output=>write_datavalue ).
ENDIF.

*  WRITE: 'The converted value is' , value.

IF ls_valconv-rule EQ 11.                "Replace with Regex
lv_regex  ls_valconv-parameter1.
IF ls_valconv-ecfield IS NOT INITIAL.
lv_filler ls_valconv-ecfield.
ELSE.
lv_filler ls_valconv-parameter2.
ENDIF.
CONDENSE lv_regex.
REPLACE ALL OCCURRENCES OF REGEX lv_regex IN value WITH lv_filler.
REPLACE ALL OCCURRENCES OF '<nbsp>' IN  value WITH ' <nbsp>'.
IF sy-subrc 0.
REPLACE ALL OCCURRENCES OF '<nbsp>' IN value WITH ''.
ENDIF.
cl_demo_output=>write_datavalue ).
ENDIF.

IF ls_valconv-rule EQ 12.                           "Concatenate/Suffix
IF ls_valconv-ecfield IS NOT INITIAL.
lv_ec_fld_string ls_valconv-ecfield.
ELSE.
lv_ec_fld_string ls_valconv-parameter2.
ENDIF.
CONDENSE lv_ec_fld_string.
lv_filler ls_valconv-parameter1.
CONCATENATE value lv_ec_fld_string INTO value SEPARATED BY lv_filler RESPECTING BLANKS.
REPLACE ALL OCCURRENCES OF '<nbsp>' IN  value WITH ' <nbsp>'.
IF sy-subrc 0.
REPLACE ALL OCCURRENCES OF '<nbsp>' IN value WITH ''.
ENDIF.
cl_demo_output=>write_datavalue ).
ENDIF.

IF ls_valconv-rule EQ 13.                             "Adjust to length
lv_filler ls_valconv-parameter2.
lv_string_len strlenvalue ).
lv_adjust_len ls_valconv-parameter1.      "possible conversion exception
IF lv_string_len LT lv_adjust_len.
lv_adjust_len lv_adjust_len lv_string_len.
DO lv_adjust_len TIMES.
CONCATENATE value lv_filler INTO value RESPECTING BLANKS.
ENDDO.
REPLACE ALL OCCURRENCES OF '<nbsp>' IN  value WITH ' <nbsp>'.
IF sy-subrc 0.
REPLACE ALL OCCURRENCES OF '<nbsp>' IN value WITH ''.
ENDIF.
lv_adjust_len lv_adjust_len + lv_string_len.
ENDIF.
value value+0(lv_adjust_len).
cl_demo_output=>write_datavalue ).
ENDIF.

IF ls_valconv-rule EQ '14'.                            "Prefix
IF ls_valconv-ecfield IS NOT INITIAL.
lv_ec_fld_string ls_valconv-ecfield.
ELSE.
lv_ec_fld_string ls_valconv-parameter2.
ENDIF.
CONDENSE lv_ec_fld_string.
lv_filler ls_valconv-parameter1.
CONCATENATE lv_ec_fld_string value INTO value SEPARATED BY lv_filler RESPECTING BLANKS.
REPLACE ALL OCCURRENCES OF '<nbsp>' IN  value WITH ' <nbsp>'.
IF sy-subrc 0.
REPLACE ALL OCCURRENCES OF '<nbsp>' IN value WITH ''.
ENDIF.
cl_demo_output=>write_datavalue ).
ENDIF.

IF ls_valconv-rule EQ '15'"Full simple replace

IF ls_valconv-ecfield IS NOT INITIAL.
lv_filler ls_valconv-ecfield.
ELSE.
lv_filler ls_valconv-parameter2.
ENDIF.
value lv_filler.
REPLACE ALL OCCURRENCES OF '<nbsp>' IN  value WITH ' <nbsp>'.
IF sy-subrc 0.
REPLACE ALL OCCURRENCES OF '<nbsp>' IN value WITH ''.
ENDIF.
cl_demo_output=>write_datavalue ).
ENDIF.

IF ls_valconv-rule EQ '16'.  "Split before
lv_splitter ls_valconv-parameter1.
CHECK lv_splitter IS NOT INITIAL.
REPLACE ALL OCCURRENCES OF '<nbsp>' IN  lv_splitter WITH ' <nbsp>'.
IF sy-subrc 0.
REPLACE ALL OCCURRENCES OF '<nbsp>' IN lv_splitter WITH ''.
ENDIF.
SPLIT value AT lv_splitter INTO lv_string1 lv_string2.
value lv_string1.
cl_demo_output=>write_datavalue ).
ENDIF.

IF ls_valconv-rule EQ '17'.  "Split after
lv_splitter ls_valconv-parameter1.
CHECK lv_splitter IS NOT INITIAL.
REPLACE ALL OCCURRENCES OF '<nbsp>' IN  lv_splitter WITH ' <nbsp>'.
IF sy-subrc 0.
REPLACE ALL OCCURRENCES OF '<nbsp>' IN lv_splitter WITH ''.
ENDIF.
SPLIT value AT lv_splitter INTO lv_string1 lv_string2.
IF lv_string2 IS NOT INITIAL.
value lv_string2.
ELSE.
value lv_string1.
ENDIF.
cl_demo_output=>write_datavalue ).
ENDIF.

IF ls_valconv-rule EQ '18'.   "edit with mask
lv_string1 ls_valconv-parameter1.
WRITE value USING EDIT MASK lv_string1 TO lv_masked_string.
value lv_masked_string.
REPLACE ALL OCCURRENCES OF '<nbsp>' IN  value WITH ' <nbsp>'.
IF sy-subrc 0.
REPLACE ALL OCCURRENCES OF '<nbsp>' IN value WITH ''.
ENDIF.
cl_demo_output=>write_datavalue ).
ENDIF.

IF ls_valconv-rule EQ '31'.                              "Check and replace
IF ls_valconv-ecfield IS NOT INITIAL.
lv_ec_fld_string ls_valconv-ecfield.
ENDIF.

IF lv_ec_fld_string ls_valconv-parameter1.
value ls_valconv-parameter2.
ENDIF.
cl_demo_output=>write_datavalue ).
ENDIF.
ENDIF.
ENDLOOP.

CALL METHOD cl_demo_output=>displayvalue ).

 

Now we will test this Report with some dummy data.  

For example, the EC national id has the value 753-76-9300. In ERP, the value should be ID753769300. In order to format this, we will use the conversion rules below. 

  1. Replace using patterns with string/EC field which will convert the data to 753769300.

  2. Prepend with string which will add the string ‘ID’ to the previously converted value and the result will be ID753769300. 



The output will be:


You can now test the different conversion rules( available in the Business Integration builder(BIB) ) directly with this report and implement the same in the transformation template(s) within your transformation template group. The simulation provided with this report will significantly reduce the testing effort during BIB implementation.

I hope you find this blog post useful. If you have any questions, request you to put the same in the comments section.

You can also check my other blog post to learn about how to troubleshoot during employee master data replication using BIB:

 

Thanks and Regards,

Paramita
2 Comments