Skip to Content
Technical Articles
Author's profile photo Kallol Chakraborty

Easy way to create custom country-specific replication classes in the PTP framework

Introduction

When you try to replicate a person from EC to ECPY, then you may face a lot of difficulties like dealing with Pay Frequencies, storing information in a new subtype of an infotype, manipulating the employee data after the parsing of the XML.

SAP has provided country-specific standard replication classes & BADIs infotype wise, for that purpose. But, they are having less flexibility.

I have come across a similar situation like this, So, I am writing this blog post so that, it can help others to achieve their requirements through custom classes.

Solution

First of all, we should know how the PTP framework works. In the PTP framework, there are two tables namely ‘HRSFEC_CNTRY’, which is an SAP standard table. The table contains country-specific replication classes.

Please check the below screenshot for further reference.

There is another table that SAP has kept for the customersHRSFEC_CNTRY_CC’. The table generally remains blank but this can be used according to our needs.

SAP has created this table ‘HRSFEC_CNTRY_CC’  for the countries for whom there is no replication class created. People can enter the country ISO code, the Replication Type & the name of the custom class to perform replication.

There are two important classes namely: ‘

  1. CL_HRSFEC_EE_MDR_BNDL_PROC
  2. CL_HRSFEC_EE_MDR_MAIN.

Class ‘CL_HRSFEC_EE_MDR_BNDL_PROC’ handles the incoming API response and saves the data in the infotype framework.

The class ‘CL_HRSFEC_EE_MDR_BNDL_PROC’ is called first when we try to replicate an employee through the report ‘RP_HRSFEC_PTP_EE_REPLICATION’(It sends the outgoing API call to Employee Central).

This class identifies the country/molga of the employee & calls the relevant class from HRSFEC_CNTRY/HRSFEC_CNTRY_CC  table.

If no country-specific relevant class is found, the main class ’CL_HRSFEC_EE_MDR_MAIN’ is called for replication.

If you notice properly, you will be able to see that  ’CL_HRSFEC_EE_MDR_MAIN’  is the superclass of all the country-specific classes.

In the case of the country-specific classes, the name of the classes is suffixed by the country ISO code.

General format: CL_HRSFEC_EE_MDR_MAIN_XX, where the XX is the Country ISO code.

So, for AE, the name will be CL_HRSFEC_EE_MDR_MAIN_AE.

BADI like ‘HRSFEC_B_CE_PROCESS_EMPLOYEE‘ can also be used to incase of custom requirements. All you have to do is to use the enhancement spot ‘HRSFEC_CE_MASTER_DATA_REPL’.

Please check the below screenshot for further details.

Now, if implementing these BADIs is not fulfilling your needs then, you can go with the option of overwriting the SAP standard class with the custom class.

To overwrite the standard class, you need to do the following steps.

  1. Create a custom class using code SE24.
  2. Make ’CL_HRSFEC_EE_MDR_MAIN’ as the superclass of the custom class. As a result of this, all the methods will be inherited in the custom class.
  3. Now, go to the editable mode by Ctrl+F1.
  4. Select the method in which you want to do the change & then click on redefine. As a result of this, you will be able to add codes to the method according to your needs & which will suppress the original code method of the superclass
  5. Activate the class & the methods.
  6. Go to SE16 & provide the table name: ‘HRSFEC_CNTRY_CC’.
  7. Click on Create entries & new entries & provide the name of the newly created custom class.
  8. Save the change in a customizing TR.

That’s it. It’s done. 🙂

Every time you try to replicate the employee the country-specific standard class will be bypassed & the methods of the custom class will be called accordingly.

If you are providing a custom class name in the customer table: ‘HRSFEC_CNTRY_CC’  for a country & if an entry regarding the same country exists in the standard table of SAP: ‘HRSFEC_CNTRY’ with the same replication type, the class in the customer table gets the priority first.

Thanks for reading!

Consider this post as a piece of information only. It is always better to go with the standards. 

If I have missed something, please feel free to add it in the comment section so that, this post can be useful to others.

Assigned Tags

      13 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Barin DESAI
      Barin DESAI

      Hi Kallol

      So the objective of the blog here is to provide flexibility in the update of data from EC to ECP or S4 where you are advising to use country based methods to add flexible logic where required.

      Can this be the purpose of this blog?

      thanks

      barin

      Author's profile photo Kallol Chakraborty
      Kallol Chakraborty
      Blog Post Author

      Dear Barin DESAI,

      Thanks for checking my blog post ?

      The objective of the blog here is to provide more flexibility in the update of data from EC to ECPY by using country-based methods.

      Thanks,

      Kallol

      Author's profile photo Barin DESAI
      Barin DESAI

      Glad to hear back Kallol.

       

      Can you please suggest some scenarios where this approach will provide flexibility.

      Author's profile photo Kallol Chakraborty
      Kallol Chakraborty
      Blog Post Author

      Dear Barin DESAI ,

      Sorry for replying late.

      You can use this method to create custom classes for the countries for whom there are no standard SAP replication classes defined. Even, if you want more control over the existing methods of the standard class, you can create & new one & redefine the methods of it as per your needs.

      Regards,

      Kallol

      Author's profile photo narayana gayam
      narayana gayam

      Thank you Kallol , it is more informative

      Author's profile photo BALASUBRAMANIAN AP
      BALASUBRAMANIAN AP

      Nice blog and I liked it very much...but pls give some sample scenario's on this in another blog...which may be more useful

      Author's profile photo Kallol Chakraborty
      Kallol Chakraborty
      Blog Post Author

      Dear BALASUBRAMANIAN AP ,

      Thank you for reading my blogpost.

      You can use this method to create custom classes for the countries for whom there are no standard SAP replication classes defined. Even, if you want more control over the existing methods of the standard class, you can create & new one & redefine the methods of it as per your needs.

      Regards,

      Kallol

      Author's profile photo BALASUBRAMANIAN AP
      BALASUBRAMANIAN AP

      I am fan of your blog posts…I appreciate your initiative on teaching others..I read this reply in your reply of Barin Desai…

      I want to know for which country version, you have done this?

      For example, take Indian Payroll Scenario…whether standard classes would suffice to fulfill or we need to use custom class?

      Take another example, say Country version of Srilanka, there is no standard payroll available…would you suggest to go for such a scenario, to use custom classes?

      Author's profile photo Kallol Chakraborty
      Kallol Chakraborty
      Blog Post Author

      Dear BALASUBRAMANIAN AP ,

      Sorry for replying late.

      I have created the class for Spain due to some custom requirements.

      For India, you can use the standard class provided by SAP: CL_HRSFEC_EE_MDR_MAIN_IN.

      Replication%20class%20for%20India

      Replication class for India

      You can check the table: HRSFEC_CNTRY, which contains all the standard replication classes.

      For Sri Lanka, there is no standard replication class. You have to create a new custom class having the superclass  'CL_HRSFEC_EE_MDR_MAIN'.

       

      Regards,

      Kallol

      Author's profile photo BALASUBRAMANIAN AP
      BALASUBRAMANIAN AP

      Thank you for sharing..

      Author's profile photo Hari Bhaskar Bhoopathy
      Hari Bhaskar Bhoopathy

      Dear Kallol Chakraborty

      Thanks for the explanation.

      I was desperately looking for informations on implementing payroll for non-supported countries.

      In my case, it's the country Bahrain. I am trying to replicate my Bahrain employee from EC system into the ECP system. (Note Bahrain is not yet supported in the SAP EC Payroll)

      I have exactly followed your blog steps, but unfortunately, I am still receiving the error:

      Replication of employee data has failed for Id XXXXXX (265) for BH

      Message No. HRSFEC_SERVICES263

      Can you please advice

       

      Author's profile photo Kallol Chakraborty
      Kallol Chakraborty
      Blog Post Author

      Dear Hari Bhaskar Bhoopathy

       

      Thanks for checking the blog post.

       

      Sorry for replying late. I am not having access to the SF system now. So, I can't check now.

      I will suggest to check with an ABAPer. This seems to be a minor issue related to the MOLGA check.

      Please check whether the proper MOLGA is getting fetched or not.

      You can do some manipulation in the method also if needed.

      If the issue still persists, please share the screenshot of the error/dump details.

       

      Regards,

      Kallol

      Author's profile photo Hari Bhaskar Bhoopathy
      Hari Bhaskar Bhoopathy

      Hi Kallol Chakraborty

      It worked. I have corrected my country code in the Odata API Query configuration.

      Thanks for your support