‎2005 Nov 10 3:58 PM
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
‎2005 Nov 10 4:11 PM
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
‎2005 Nov 10 4:18 PM
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
‎2005 Nov 10 4:25 PM
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
‎2005 Nov 10 4:49 PM
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
‎2005 Nov 10 5:59 PM
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
‎2009 Apr 21 9:43 AM
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'?
‎2009 Apr 21 5:24 PM
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 =