cancel
Showing results for 
Search instead for 
Did you mean: 

HR_MAINTAIN_MASTERDATA: Not Able to Create a New Hire Employee

Former Member
0 Kudos

I am trying to create a new hire employee. To do this, I use FM HR_MAINTAIN_MASTERDATA.

The requirement is to create new employee with data for IT0000 (Actions), IT0001 (Org Management) & IT0002 (Personal Data) only.

The FM is not working and the given error is "Fill in all required entry fields". When I use parameter DIALOG_MODE = 1 (stop on error), SAP stops on the infotype 0006 screen and prompts me to enter the required fields. The problem is I do not want to create employee data on infotype 0006 and the following screens after that. My intention is to create employee

data for infotype 0000, 0001 & 0002 only.

Any idea on the workaround for the problem above?

Filled the proposed_values tables with following fields:

      • IT0000 ***

'P0000-MASSN'

'P0000-MASSG'

'P0000-STAT1'

'P0000-STAT2'

      • IT0001 ***

'P0001-BUKRS'

'P0001-WERKS'

'P0001-BTRTL'

'P0001-ABKRS'

'P0001-PLANS'

'P0001-OTYPE'

      • IT0002 ***

'P0002-NACHN'

'P0002-VORNA'

'P0002-CNAME'

'P0002-TITEL'

'P0002-GESCH'

'P0002-GBDAT'

'P0002-NATIO'

'P0002-SPRSL'

'P0002-KONFE'

'P0002-FAMST'

'P0002-GBJHR'

'P0002-GBMON'

'P0002-GBTAG'

'P0002-NCHMC'

'P0002-VNAMC'

CALL FUNCTION 'HR_MAINTAIN_MASTERDATA'

EXPORTING

pernr = p_pernr

massn = '01'

actio = 'INS'

tclas = 'A'

begda = p_begda

endda = p_endda

*objps =

seqnr = '000'

*sprps =

*subty =

werks = 'US01'

persg = '1'

persk = 'EC'

plans = '00042933'

dialog_mode = '1'

luw_mode = '1'

no_existence_check = 'X'

*no_enqueue = 'X'

IMPORTING

return = lt_bapireturn

return1 = lt_bapireturn1

TABLES

proposed_values = lt_value.

Accepted Solutions (0)

Answers (9)

Answers (9)

Former Member
0 Kudos

In the methode VIEKN of the class CL_HRPA_VIEKN there is a test to see if PA0003 exists before it is created.

Use the enhancement to INSERT PA0003 at the begin and to DELETE PA0003 at the end.

METHOD viekn.

"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""$"$\SE:(1 ) Classe CL_HRPA_VIEKN, Méthode VIEKN, Début D

*$*$-Start: (1 )--------------------------------------------------------------------------------$*$*

ENHANCEMENT 1 ZDIH_APPLICATION_EXTERNE_CREAT.    "active version

DATA : lw_pa0003 TYPE pa0003.

DATA : fl_pa0003 TYPE flag.

CLEAR fl_pa0003.

*  If coming from Web dynpro

IF sy-cprog EQ 'SAPMHTTP' ANd pernr NE '00000000'.

*  Check if the infotype 3 already exists

  SELECT SINGLE * FROM pa0003 INTO lw_pa0003 WHERE pernr = pernr.

  IF sy-subrc NE 0.

    fl_pa0003 = 'X'.

    MOVE pernr TO lw_pa0003-pernr.

    MOVE '18000101' TO lw_pa0003-begda.

    MOVE '99991231' TO lw_pa0003-endda.

    MOVE '12' TO lw_pa0003-viekn.

    INSERT pa0003 FROM lw_pa0003.

  ENDIF.

  1. ENDIF.
  2. ENDENHANCEMENT.

*$*$-End: (1 )--------------------------------------------------------------------------------$*$*

----> original code of method <----

"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""$"$\SE:(2 ) Classe CL_HRPA_VIEKN, Méthode VIEKN, Fin D

*$*$-Start: (2 )--------------------------------------------------------------------------------$*$*

ENHANCEMENT 2 ZDIH_APPLICATION_EXTERNE_CREAT.    "active version

  IF sy-cprog EQ 'SAPMHTTP' AND pernr NE '00000000'.

    IF fl_pa0003 = 'X'.

      DELETE FROM PA0003 WHERE pernr = pernr.

    ENDIF.

  ENDIF.

  1. ENDENHANCEMENT.

*$*$-End: (2 )--------------------------------------------------------------------------------$*$*

  1. ENDMETHOD.
Former Member
0 Kudos

Found the solution to my problem as stated above. FM HR_MAINTAIN_MASTERDATA can be use to create a new hire employee with the correct settings and configurations:

1. Set the importing parameter "no_existence_check = 'X'" for FM "HR_MAINTAIN_MASTERDATA".

2. In config, maintain the infogroup for new hire action. In this case, infotype only IT0001 & IT0002 should be maintained in the infogroup for new hire action.

3. Maintain user parameter ID of the SAP HR User (transaction: SU3) so that user will be able to see the appropriate infotype menu:

- UGR = <usergroup value> =<country grouping value>

- USR = <usergroup value> =<country grouping value>

Former Member
0 Kudos

Hi,

Your thread was so helpful for me, In my client we are planning for mass hiring through WD, so I came across these functional modules, many of my doubts got cleared after reading the thread.

we were planning for BAPI & FM combination to upload a flat file, if so what are the necessary things i need to take care?

Another doubt is, now in my client there are different sectors, they have different User parameters (UGR), how this can be achieved? after settings done in SU3, how technical consultant has to handle this?

Kindly let me know

Regards

Anto

former_member226519
Active Contributor
0 Kudos

you have to use an action type that processes infotypes 0000 0001 0002 only.

ask PA customizing guys for an action type, infogroup and/or user group (parameter UGR)

Former Member
0 Kudos

Hi,

For Org. assignment.

use this FM.

HR_INFOTYPE_OPERATION.

Regards

Kalpesh K. Mehta

Former Member
0 Kudos

Hi Kalpee,

FM HR_INFOTYPE_OPERATION cannot be used for creating new hire employee as it always checks for employee existence. However, FM HR_MAINTAIN_MASTERDATA has the "no_existence_check" parameter which can be set for creating new employee.

bryan_cain
Contributor
0 Kudos

IIRC you need to create infortype 0003 (using that same FM) before you can create infotype 0000. That being said, I believe you're better off doing a BDC to create employees. Trying to fight with those FMs isn't worth the effort - I don't believe SAP intended for developers to hire employees using those FMs - only to update them.

Former Member
0 Kudos

Hi,

Try with this BAPI,

BAPI_HRMASTER_SAVE_REPL_MULT

it will work.

Regards

Kalpesh K. Mehta

Former Member
0 Kudos

Hi Kalpee,

Tried BAPI_HRMASTER_SAVE_REPL_MULT and it did create records in IT0000, IT0001 & IT0002. However, i found out that this BAPI just directly updates to the infotypes without any validation. For example, i provide an invalid company code (BUKRS) and personnel area (WERKS), the BAPI still updates without any proper validation.

Filled in the following fields in each tables for the BAPI:

HR_OBJECT_HEADER

plvar, otype, objid, opera

HR_INFOTYPE_HEADER

plvar, otype, objid, infty, begda, endda

EMPLOYEE_PERSONNEL_ACTION

pernr, infty, endda, begda, massn, massg, stat1, stat2

EMPLOYEE_ORG_ASSIGNMENT

pernr, infty, endda, begda, bukrs, werks, persg, persk, gsber, plans, otype

EMPLOYEE_PERSONAL_DATA

pernr, infty, endda, begda, nachn, vorna, titel, gesch, gbdat, natio, sprsl, konfe, famst

Am i missing out anything that might lead to the absence of the validation for the BAPI above?

Former Member
0 Kudos

Hi YTL,

FM 'HR_MAINTAIN_MASTERDATA' follows the action selected in IT0000. If the action's info group contains infotypes other than IT0000,0001 and 0002 you need to go to HR and request them to create an action with info group containing only these infotypes.

Another work around without config change would involve changing standard user exit available for IT(EXIT_SAPFP50M_002) and exit the processing for other infotypes. Set flag before calling this FM and pass the same value to memory ID. In the exit, read the memory ID and check for flag. If the flag is set, exit the processing for employee.

Regards,

Syam.

Edited by: syamsundr on Jan 16, 2012 11:33 AM

Former Member
0 Kudos

HI YTL,

The FM HR_MAINTAIN_MASTERDATA works as per the config set in the info group for new hire, If it is made any info type to be maintained while perticular action is runned you have to maintain that as well, It seems that in your case IT0006 should be maintained so it is throughing error.

Solutions:

1.Pass the some dummy values to all the mandatory info types that needs to be maintained or

2. Change the Config settings for that info type.

Hope first should be feasible

Thanks

Teja.

nabheetscn
Active Contributor
0 Kudos

For making 0006 optional check your hr config..i remember we have used this fm in the past and we faced similar problem..so config was to be changed

Nabheet