Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Needed Function Module/Method to read currently assigned PERNR for external Person ID

0 Kudos

Hi Experts,

I need to fetch the currently assigned PERNR(Personnel Number) for an external person ID irrespective of the PERNR status.

I have tried with FM 'CRIF_GET_EMPLOYEE_FOR_USER' and method 'CL_HRTMC_CP_BASIC_UTILITIES=>CONVERT_IDS' but both were not helpful.

these are helpful only when the PERNR is ACTIVE.

But if the CURRENT ASSIGNED PERNR is inactive/withdrawn, I need to fetch that PERNR.

Please help me here.

Many Thanks in Advance,

Maruthi

4 REPLIES 4

former_member195270
Active Participant
0 Kudos

you are required to read infotype 0000 actions and with  empoyment status you can fetch inactive / withdrawn pernr.

0 Kudos

Infotype 0000 will return me the PERNR status if I know the PERNR. But in my case, I have an External ID with two PERNRs assigned. One with status Withdrawn and the other with Inactive.

Current status of the Person is Inactive meaning, PERNR 2 is assigned.

So how to read the PERNR 2 with External ID. I have only Person ID.

In general, How to fetch the currently assigned PERNR for an External Person ID.

0 Kudos

Hi,

You can try using method GET_PERNR_TAB_FOR_PERSONID_EXT of class CL_HRCCE_PERSONID

Something along this line:

DATA:
     lo_person_id   TYPE REF TO cl_hrcce_personid,
     lv_pernr           TYPE pernr_d,
     lv_perid            TYPE personid_ext,
     lv_personid      TYPE personid,
     lt_pernr             TYPE pccet_pernr,
     ls_pernr            TYPE pcce_pernr.
 
   lv_perid = iv_personid.
 
   CREATE OBJECT lo_person_id.

      TRY.
         lo_person_id->get_pernr_tab_for_personid_ext(
                         EXPORTING personid_ext = lv_perid
                         IMPORTING pernr_tab        = lt_pernr ).

       CATCH cx_hrpa_violated_assertion.
         RETURN.
     ENDTRY.

     lv_pernr = iv_pernr.
     READ TABLE lt_pernr INTO ls_pernr WITH KEY table_line = lv_pernr.

....

Hope this helps.

Sougata.

former_member182041
Active Contributor
0 Kudos

Hi,

You could try in reverse approach as below:

For trial purpose, let's say you know the pernr for the external id.
Put that pernr in table HRP1001 by selecting OTYPE as P and OBJID as the pernr.

Out of many records, check the record with SCLAS as 'CP'.
Check the value in field SOBID with SCLAS value as 'CP'. Do let  me know if the external
id's value is in SOBID. Thanks!

Regards,

Kumud