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_MAINTAIN_MASTERDATA

Former Member
0 Likes
1,433

Hello,

Can anyone please provide me with some information on how to use HR_MAINTAIN_MASTERDATA to update SAP database?

I am trying to re-assign employees to a different position. Would this work for that purpose?

Thanks!

Regards,

~Mark

7 REPLIES 7
Read only

suresh_datti
Active Contributor
0 Likes
1,188

Yes you sure can.. First read infotype 0001 using the function module HR_READ_INFOTYPE.. fill the table proposed_values( change the position number) and other parameters & pass it as noted below

*********

call function 'HR_MAINTAIN_MASTERDATA'

exporting

pernr = pernr

massn = massn

persg = persg

persk = persk

actio = 'COP'

begda = datum

dialog_mode = '2'

importing

return1 = return

tables

proposed_values = proposed_values.

***************

Good Luck,

Suresh Datti

Read only

0 Likes
1,188

Thanks Suresh,

so the pernr is the pernr for the employee that I am reassigning?

Could you kindly explain what the other parameters are?

Much appreciated!

Regards,

~Mark

Read only

0 Likes
1,188

Mark,

rest of the parameters are Pers Action type, Employee Group & Employee Subgroup.. Pl take a look at the function module 'HRWPC_PCR_POS_CHANGE_EXTENDED'. You will get an idea, how to fill the 'proposed_values' table. Choose the 'Operation' & 'Dialog Mode' values depending on how you want to execute.

Good luck,

Suresh Datti

Read only

0 Likes
1,188

Hi Suresh,

Thanks again. Do you have any sample code that does a similar thing. I am actually quite new at ABAP (only a couple of months of experience

Thanks again,

~Mark

Read only

0 Likes
1,188

Hi Mark,

How many employees do you want to reassign? Ideally, you are better off doing the position change via Personnel Actions using PA30/PA40. Beacuse that way, you are sure that any Dynamic Actions associated with infotypes 0000 & 0001 are taken care of. If you decide to go with the function module, you will have to explicitly code the dynamic actions in the Program (I would not do that).I have used HR_INFOTYPE_OPEARTION (that inturn calls HR_MAINTAIN_MASTERDATA) in programs before but update other infotypes ie 0076,0015,0759 etc..

Good Luck,

Suresh Datti

Read only

0 Likes
1,188

Dear Sir/Madam,

Would you please show me the codes of FM HR_INFOTYPE_OPERATION?

I do not know the data formate of importing parameters 'RECORD'?

Read only

KK07
Contributor
0 Likes
1,188

Hi Mark,

Here is a simple program which is using HR_INFOTYPE_OPERATION (which calls HR_MAINTAIN_MASTERDATA internally) .

tables: pernr.

infotypes: 0002.

data: return_struc type bapireturn1,

record_key type bapipakey.

parameters: natio_o like p0002-natio default 'DE',

natio_n like p0002-natio default 'D'.

get pernr.

call function 'BAPI_EMPLOYEE_ENQUEUE'

exporting

number = p0002-pernr

importing

return = return_struc.

if not return_struc is initial.

write: / pernr-pernr, (70) return_struc-message.

reject.

endif.

loop at p0002 where endda ge pn-begda

and begda le pn-endda

and natio eq natio_o.

p0002-natio = natio_n.

call function 'HR_INFOTYPE_OPERATION'

exporting

infty = '0002'

number = p0002-pernr

  • SUBTYPE =

  • OBJECTID =

  • LOCKINDICATOR =

validityend = p0002-endda

validitybegin = p0002-begda

recordnumber = p0002-seqnr

record = p0002

operation = 'MOD'

  • TCLAS = 'A'

dialog_mode = '1'

  • NOCOMMIT =

  • VIEW_IDENTIFIER =

  • SECONDARY_RECORD =

importing

return = return_struc

key = record_key.

if not return_struc is initial.

write: / return_struc.

else.

write: / 'Record '(002), record_key, 'modified'(003).

endif.

endloop.

call function 'BAPI_EMPLOYEE_DEQUEUE'

exporting

number = p0002-pernr.

  • IMPORTING

  • RETURN =