cancel
Showing results for 
Search instead for 
Did you mean: 

create a new employee

Former Member

Hello,

we want use HR_MAINTAIN_MASTERDATA for create a new employee.

after lunch this FM we insert new PERNR code and some different data but after execution we cannot see any new entry in PA30 or PA40.

Any suggestion?

thanks

Alex

Accepted Solutions (1)

Accepted Solutions (1)

Former Member

yes, shrinivas is right, we hire successfully using HR_MAINTAIN_MASTERDATA.You must ensure that the parameter NO_EXISTENCE_CHECK is set to 'X'. Pass the multiple infotypes data in the Tables paramter proposed_values by adding new lines

and when u get that far of hiring, u may even face same problem as [this |;one..so follow the resolution provided in the same thread.

Answers (4)

Answers (4)

SGConsulting
Discoverer
0 Kudos

in my case the turning point was put the istructions:

SET PARAMETER ID 'PBR' FIELD werks.

SET PARAMETER ID 'PRG' FIELD PERSG.

SET PARAMETER ID 'PKR' FIELD PERSK.

SET PARAMETER ID 'SUB' FIELD MASSN.

before the function:

CALL FUNCTION 'HR_INFOTYPE_OPERATION'

EXPORTING infty = '0000'

NUMBER = p0000-pernr

now the program is able to create a employee e modify infotype.

REPORT z_r_bda_upload.


PARAMETERS: pernr TYPE p0000-pernr.
PARAMETERS: begda TYPE p0000-begda DEFAULT sy-datum.
PARAMETERS: endda TYPE p0000-endda DEFAULT '99991231'.
PARAMETERS: massn TYPE p0000-massn.


PARAMETERS: persg TYPE p0001-persg.
PARAMETERS: bukrs TYPE p0001-bukrs.
PARAMETERS: werks TYPE p0001-werks.
PARAMETERS: persk TYPE p0001-persk.
PARAMETERS: btrtl TYPE p0001-btrtl.


PARAMETERS: nachn TYPE p0002-nachn.
PARAMETERS: vorna TYPE p0002-vorna.
PARAMETERS: gesch TYPE p0002-gesch.


TABLES : p0000, p0001, p0002.


DATA: g_return  TYPE bapireturn1,
      infty_key TYPE bapipakey.


DATA : BEGIN OF i_p0000 OCCURS 0,
  pernr LIKE p0000-pernr,
  begda LIKE p0000-begda,
  endda LIKE p0000-endda,
  massn LIKE p0000-massn,
END OF i_p0000.


DATA : BEGIN OF i_p0001 OCCURS 0,
  pernr LIKE p0001-pernr,
  begda LIKE p0001-begda,
  endda LIKE p0001-endda,
  persg LIKE p0001-persg,
  werks LIKE p0001-werks,
  bukrs LIKE p0001-bukrs,
  persk LIKE p0001-persk,
  btrtl LIKE p0001-btrtl,
END OF i_p0001.


DATA : BEGIN OF i_p0002 OCCURS 0,
  pernr LIKE p0002-pernr,
  begda LIKE p0002-begda,
  endda LIKE p0002-endda,
  nachn LIKE p0002-nachn,
  vorna LIKE p0002-vorna,
  gesch LIKE p0002-gesch,
END OF i_p0002.


********** infotype 0000  ******************************


i_p0000-pernr = pernr.
i_p0000-begda = begda.
i_p0000-endda = endda.
i_p0000-massn = massn.
APPEND i_p0000.
MOVE-CORRESPONDING i_p0000 TO p0000.


CLEAR g_return.
CALL FUNCTION 'BAPI_EMPLOYEE_ENQUEUE'
EXPORTING
  NUMBER = p0000-pernr
IMPORTING
  RETURN = g_return.


CLEAR g_return.
CLEAR infty_key.




SET PARAMETER ID 'PBR' FIELD werks.
SET PARAMETER ID 'PRG' FIELD PERSG.
SET PARAMETER ID 'PKR' FIELD PERSK.
SET PARAMETER ID 'SUB' FIELD MASSN.


CALL FUNCTION 'HR_INFOTYPE_OPERATION'
EXPORTING
  infty         = '0000'
  NUMBER        = p0000-pernr
  validityend   = p0000-endda
  validitybegin = p0000-begda
  record        = p0000
  operation     = 'INS'
IMPORTING
  RETURN        = g_return
  KEY           = infty_key.


CALL FUNCTION 'BAPI_EMPLOYEE_DEQUEUE'
EXPORTING
  NUMBER = p0000-pernr.


********** infotype 0001  ******************************
IF infty_key-employeeno IS NOT INITIAL.


  i_p0001-pernr = infty_key-employeeno.
  i_p0001-begda = begda.
  i_p0001-endda = endda.
  i_p0001-persg = persg.
  i_p0001-werks = werks.
  i_p0001-bukrs = bukrs.
  i_p0001-persk = persk.
  i_p0001-btrtl = btrtl.


  APPEND i_p0001.
  MOVE-CORRESPONDING i_p0001 TO p0001.


  CLEAR g_return.


  CALL FUNCTION 'BAPI_EMPLOYEE_ENQUEUE'
  EXPORTING
    NUMBER = p0001-pernr
  IMPORTING
    RETURN = g_return.


  CLEAR g_return.
  CLEAR infty_key.


  CALL FUNCTION 'HR_INFOTYPE_OPERATION'
  EXPORTING
    infty         = '0001'
    NUMBER        = p0001-pernr
    validityend   = p0001-endda
    validitybegin = p0001-begda
    record        = p0001
    operation     = 'INS'
  IMPORTING
    RETURN        = g_return
    KEY           = infty_key.


  CALL FUNCTION 'BAPI_EMPLOYEE_DEQUEUE'
  EXPORTING
    NUMBER = p0001-pernr.




********** infotype 0002  ******************************
  IF infty_key-employeeno IS NOT INITIAL.


    i_p0002-pernr = i_p0001-pernr.
    i_p0002-begda = begda.
    i_p0002-endda = endda.
    i_p0002-nachn = nachn.
    i_p0002-vorna = vorna.
    i_p0002-gesch = gesch.
    APPEND i_p0002.
    MOVE-CORRESPONDING i_p0002 TO p0002.


    CLEAR g_return.


    CALL FUNCTION 'BAPI_EMPLOYEE_ENQUEUE'
    EXPORTING
      NUMBER = p0002-pernr
    IMPORTING
      RETURN = g_return.


    CLEAR g_return.
    CLEAR infty_key.


    CALL FUNCTION 'HR_INFOTYPE_OPERATION'
    EXPORTING
      infty         = '0002'
      NUMBER        = p0002-pernr
      validityend   = p0002-endda
      validitybegin = p0002-begda
      record        = p0002
      operation     = 'INS'
    IMPORTING
      RETURN        = g_return
      KEY           = infty_key.


    CALL FUNCTION 'BAPI_EMPLOYEE_DEQUEUE'
    EXPORTING
      NUMBER = p0002-pernr.


  ENDIF.
ENDIF.


florianweiss
Discoverer
0 Kudos

Hello, use PA48 and send data before with FM HR_PREPARE_NEW_EE.

Bye

Florian

Former Member
0 Kudos

Hi

U can create the new employees record by making a Hiring action. in this action make a infogroup which contains different infotypes.

Path:

SPRO> Personal Management> Per. Admi.> Customizing Procedures> Actions

Do the customization and make a action then execute the action in PA40 then only u can hire the employee.

Thanks

Former Member
0 Kudos

i cannot use this way.

data for employee creation comes from an external system and i'm using XI for integrate this scenario.

this is very important

Former Member
0 Kudos

no helps??

former_member31961
Contributor
0 Kudos

Hi,

You can use 'HR_MAINTAIN_MASTERDATA' to create/hire a new employee since its simulates the BDC PA30/40.

But you need to pass NO_EXISTENCE_CHECK as 'X' to hire a new employee, also you need to pass all the mandatory fields of infotypes which are used to hire a employee (IT0000, IT0001, IT0002 etc) at one go.

Still it's not able to update then check the error message (or Check the screen flow in Dialog Mode = 2).

PS: If you use this FM, Dynamic action wont be triggered, so you need to explicitly code if any dynamic actions need to be triggred.

Good luck,

Shrinivas

Former Member
0 Kudos

Hi,

There is no functional module in HR for creating a new employee. New employee can be created only thru an action i.e thru PA40. The function module which you mentioned is only to maintain master data of an already existing employee.

Rgds

Suman

Former Member
0 Kudos

And whit Idoc?