Application Development and Automation 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: 
Read only

HR_MAINTIAN_MASTERDATA

Former Member
0 Likes
3,263

Using Fm HR_MAINTAIN_MASTERDATA to create new hire.

I get an error stating that IT0003 is not creating

Is there any workaround to avoid this error?

Its working when i create infotypes 0000 and 0002 in one go and then if i create 0001 new employee is created,

But want to create 0000,0001 and 0002 at one go.

The error iam getting is ' No data available for A 00069949 0003'

where 00069949 is pernr

Any help

Regards

vijaya

Hi Neesha

Since there are some restrictions to this BAPI, the gurus are suggesting not to use it. If you still want to go ahead with it, let me know. Will share some sample code with you.

Regards,

Harsh

17 REPLIES 17
Read only

Former Member
0 Likes
3,104

Hi Vijay

Did you resplve this I am getting the same error !! .. any info you could give would be appreciated.

Thanks

Damien

Read only

KK07
Contributor
0 Likes
3,104

Hi vijaya,

I think you are getting this error because IT 0003 is maintained by the systm itself,we cannot maintain the infotype 0003. for better results you can make use of LSMW.Hoping that you are creating the employess for the first time..!

cheers,

KK

Read only

Former Member
0 Likes
3,104

Hi,

Use program RPUTRBK0 to update IT0003 status, any field in IT0003 can be updated very easily.

go to SE38->RPUTRBK0->excute , fill in fields as required to update IT0003.

Regards

Baabu

Read only

Former Member
0 Likes
3,104

Did U try creating the record by changing the order of Infotypes ....

PA0000 , PA0002 , PA0001 .. when passing data to HR_MAINTAIN_MASTERDATA

Read only

Former Member
0 Likes
3,104

Hi All,

The input to this FM is pernr, so if the pernr is not yet generated then we can not use it. I think its only used for fast upload where employee no is already existing.

We should use LSMW for employee create.

Br/Manas

Read only

0 Likes
3,104

@ Srini Vas

I tried the order suggested and no joy ..

@ Manas

It works for inro types 0000 and 0002 without pernr provided only when tyying to also do 0001 it fails with the message outlined in the original post.

One point to note when creating 0000 and 0002. using the FM HR_MAINTAIN_MASTERDATA. It does generate the pernr. It also populates the infotypes 0000 and 0002 that can be viewed through transaction pa20. But if I click the "Assignment Overview" button for the Employee I see there was an exception raised:

Runtime Errors UNCAUGHT_EXCEPTION

Except. CX_HRPA_MISSING_PERSONID

Date and Time 17.04.2009 16:34:49

Short text

An exception occurred that was not caught.

What happened?

The exception 'CX_HRPA_MISSING_PERSONID' was raised, but it was not caught

anywhere along

the call hierarchy.

Since exceptions represent error situations and this error was not

adequately responded to, the running ABAP program

'CL_HRCCE_PERSON_READER========CP' has to be

terminated.

Error analysis

An exception occurred that is explained in detail below.

The exception, which is assigned to class 'CX_HRPA_MISSING_PERSONID', was not

caught in

procedure "OVERVIEW_CE" "(FORM)", nor was it propagated by a RAISING clause.

Since the caller of the procedure could not have anticipated that the

exception would occur, the current program is terminated.

The reason for the exception is:

Technical Person ID (CP) Missing for Personnel Number 06000386

Missing RAISING Clause in Interface

Program SAPMP50A_CE

Include SAPMP50A_CE

Row 403

Module type (FORM)

Module Name OVERVIEW_CE

Trigger Location of Exception

Program CL_HRCCE_PERSON_READER========CP

Include CL_HRCCE_PERSON_READER========CM004

Row 26

Module type (METHOD)

Source Code Extract

Line SourceCde

1 METHOD get_personid.

2

3 DATA personid_pernr TYPE personid_pernr.

4 DATA hrpersonee TYPE hrpersonee_s.

5

6

7 READ TABLE a_personid_by_pernr_tab INTO personid_pernr

8 WITH TABLE KEY pernr = p_pernr.

9

10 IF sy-subrc IS NOT INITIAL.

11 IF lines( a_personid_by_pernr_tab ) >= c_max_buffer_size.

12 * ensure that buffer will not use up to much memory

13 * ensure that virtual relations are not lost

14 a_personid_by_pernr_tab = a_saved_relations.

15 ENDIF.

16

17

18 * entry not buffered --> fill buffer

19 CALL FUNCTION 'HR_PERSONEE_GETPERSON'

20 EXPORTING

21 iv_employee_id = p_pernr

22 iv_with_authority = space

23 IMPORTING

24 es_hrpersonee = hrpersonee.

25 IF hrpersonee-personid IS INITIAL.

>>>>> RAISE EXCEPTION TYPE cx_hrpa_missing_personid

27 EXPORTING

28 textid = cx_hrpa_missing_personid=>cx_hrpa_missing_perso

29 tclas = cl_hrpa_tclas=>tclas_employee

30 pernr = p_pernr.

31 ENDIF.

32

33 personid_pernr-pernr = p_pernr.

34 personid_pernr-personid = hrpersonee-personid.

35 * do not fill other buffer table because we may be missing

36 * some entries

37 INSERT personid_pernr INTO TABLE a_personid_by_pernr_tab.

38 ENDIF.

39

40 p_personid = personid_pernr-personid.

41 ENDMETHOD. "GET_PERSONID

    • If anyone can help I will open a new thread to award points as I think I have taken over this thread !!

Thanks

Damien

Read only

0 Likes
3,104

In overview it checks if the pernr(P) exists in HRP1001 ...

If it does'n it raises this exception . ...

Read only

0 Likes
3,104

Hi Srini ... Maybe a basic question but do u think this exception is related to the problem with the addition of the 0001 infotype ? Thanks Damien ..

Read only

0 Likes
3,104

Hi Damien,

The original post, posted by Vijaya, was as part of investigation i was also involved in.

We tried all possibilities, calling the FM by changing the order of infotypes 0000,0001,0002,0003 etc, nothing worked. in some of the order we tried, we had to call the FM twice.

first to generate the personnel number, and second, pass the newly generated personnel number and excute the same FM again this way infotype0003 was populated. but in reality its not a fesible approach.

The 0003, is a secondary infotype,which automatically gets generated during the new hire process from GUI(pa40), same is not possible using this FM.

what we finally did was to perform a screen recording of pa30 newhire process from tcode: SHDB, and then converting that recording into FM (from the menu options to convert the recording into FM).

This worked beautifully.

however, there was one suggestion given by [Suresh Datti|https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.sdn.businesscard.sdnbusinesscard?u=t%2bxghz16eaf%2fa1mn%2fxxpmw%3d%3d] to try the below option, which we dint get to try..maybe of some help to you..do check out.

I guess the Infotype View Indicator(VIEKN) might be causing the error. You can try deleting the entry for the particular country in the feature IVWID.

I would also suggest you take a look at the function module RSM_PROCESS_ACTIONS that SAP uses for external hiring.

~Suresh

Regards

hruser

Read only

0 Likes
3,104

Thanks for the info Hruser . I have done a BDC as suggested on transaction pa30. published this as an FM. Now in my interface in PI I have successfully used this in a synchronous interface for the creation of employees. I have opened thread:

reply and I will award points ! ..

thanks

damien

Read only

0 Likes
3,104

Hi Damien,

I finally gave up using HR_MAINTAIN_MASTERDATA and HR_INFOTYPE_OPERATION to create new employee as I am updating 5 infotypes. I want to achieve the same thing but for my scenario, I will need to update the hidden field PERID from PA0002 as well using an uploaded excel file. Mind sharing some samples or giving me some tips on how to achieve this?Appreciate it alot.

Read only

0 Likes
3,104

Can this help?

BAPI_HRMASTER_SAVE_REPL_MULT

regs,

Harsh

Read only

0 Likes
3,104

According to the Documentation, it says it has restriction. Am yet to test this but isnt it replicating the HR data?

"If your Human Resources Management System is linked by ALE to an Accounting System, you are advised for technical reasons not to use the BAPI because synchronous validation would lead to a COMMIT. This would prevent a ROLLBACK if a posting error occurs.

If data is posted using the BAPI, ALE change pointers are not written."

Read only

0 Likes
3,104

Hi Harsh,

Any tips or sample code tht i can refer 2?Kinda need this solution urgently been holding on this for far too long...any advise?

Read only

0 Likes
3,104

Hi Neesha

Since there are some restrictions to this BAPI, the gurus are suggesting not to use it. If you still want to go ahead with it, let me know. Will share some sample code with you.

Regards,

Harsh

Read only

0 Likes
3,104

Hi Harsh,

It would be of great help if you could share the source code for tht BAPI?

Read only

0 Likes
3,104
* This will be common for all Infotypes.
        W_BAPIHROBJ-PLAN_VER = C_01.
        W_BAPIHROBJ-OBJ_TYPE = C_P.
        W_BAPIHROBJ-OBJ_ID = W_INPUT-PERNR.
        W_BAPIHROBJ-PROOF = ''.
        W_BAPIHROBJ-OPERATOR = C_U.
        APPEND W_BAPIHROBJ TO T_BAPIHROBJ.
        CLEAR W_BAPIHROBJ.

        W_BAPIHRINF-PLAN_VER = C_01.
        W_BAPIHRINF-OBJ_TYPE = C_P.
        W_BAPIHRINF-OBJ_ID = W_INPUT-PERNR.
        W_BAPIHRINF-INFOTYPE = C_0000.
        CLEAR W_BAPIHRINF-SUBTYPE.
        W_BAPIHRINF-FROM_DATE = G_DT.
        W_BAPIHRINF-TO_DATE = W_FP-ENDDA.
        APPEND W_BAPIHRINF TO T_BAPIHRINF.
        CLEAR W_BAPIHRINF.

        W_BAPIHR0000-OBJ_ID = W_INPUT-PERNR.
        W_BAPIHR0000-INFOTYPE = C_0000.
        W_BAPIHR0000-TO_DATE = W_FP-ENDDA.
        W_BAPIHR0000-FROM_DATE = G_DT.
        W_BAPIHR0000-CHANGED_ON = SY-DATUM.
        W_BAPIHR0000-CHANGED_BY = SY-UNAME.
        W_BAPIHR0000-ACTION_TYPE = W_INPUT-ACTTYPE.
        W_BAPIHR0000-ACTION_REASON = C_01.
        IF W_INPUT-EMP_STAT = C_1.
          W_BAPIHR0000-EMPLOYMENT_STATUS = C_3.
        ELSEIF W_INPUT-EMP_STAT = C_2.
          W_BAPIHR0000-EMPLOYMENT_STATUS = C_1.
        ENDIF.
        APPEND W_BAPIHR0000 TO T_BAPIHR0000.
        CLEAR W_BAPIHR0000.

  W_BAPIHR0001-OBJ_ID = W_INPUT-PERNR.
  W_BAPIHR0001-INFOTYPE = C_0001.
  W_BAPIHR0001-TO_DATE = L_TODT.
  W_BAPIHR0001-FROM_DATE = L_FROMDT.
  W_BAPIHR0001-CHANGED_ON = SY-DATUM.
  W_BAPIHR0001-CHANGED_BY = SY-UNAME.
  W_BAPIHR0001-SORT_NAME = L_FULLNAME+0(29).
  W_BAPIHR0001-FORMATTED_NAME = L_FULLNAME+0(39).
  W_BAPIHR0001-POSITION = W_FP-PLANS.
*  w_bapihr0001-position = '00000000'.
  W_BAPIHR0001-PERSONNEL_SUBAREA = L_BUKRS. "w_input-bukrs.
  W_BAPIHR0001-PAYROLL_AREA = W_FP-ABKRS.
*  w_bapihr0001-payroll_area = c_99.
  IF L_MSTBR IS NOT INITIAL.
    W_BAPIHR0001-SUPERVISOR_AREA = L_MSTBR. "w_input-opr_mgr_locsys_id.
  ELSE.
    SORT T_PATAB BY PERNR.
    READ TABLE T_PATAB INTO W_PATAB WITH KEY PERNR = W_INPUT-FIRSTPORT_ID
                                             ENDDA = W_FP-ENDDA.
*                                             endda = '99991231'.
    IF SY-SUBRC = 0.
      W_BAPIHR0001-SUPERVISOR_AREA = W_PATAB-MSTBR.
    ENDIF.
  ENDIF.
  W_BAPIHR0001-PERS_AREA = L_BUKRS."w_input-bukrs.
  W_BAPIHR0001-EMPLOYEE_GROUP = W_FP-PERSG.
*  w_bapihr0001-employee_group = 'Z'.
  W_BAPIHR0001-EMPLOYEE_SUBGROUP = W_FP-PERSK.
*  w_bapihr0001-employee_subgroup = 'ZZ'.
  IF W_INPUT-BUKRS IS NOT INITIAL.
    W_BAPIHR0001-COMP_CODE = L_BUKRS. "w_input-bukrs.
  ENDIF.
*  w_bapihr0001-costcenter = l_kostl."w_input-kostl.
  APPEND W_BAPIHR0001 TO T_BAPIHR0001.
  CLEAR W_BAPIHR0001.

        CALL FUNCTION 'BAPI_HRMASTER_SAVE_REPL_MULT'
          TABLES
            HR_OBJECT_HEADER          = T_BAPIHROBJ
            HR_INFOTYPE_HEADER        = T_BAPIHRINF
            EMPLOYEE_PERSONNEL_ACTION = T_BAPIHR0000
  EMPLOYEE_organisational_assignment = T_BAPIHR0001

            RETURN                    = T_BAPIRET2.

This is the sample code to for filling the 00 and 01 infotypes. You can add accordingly the infotypes you need. Let me know in case of any issues.

Regards,

Harsh