‎2008 Nov 25 8:04 AM
Hi all,
I need some of the HR data, personal name, pernr etc.
However systems are different and I can reach the HR data directly.
As an alternative I have created a table in system I have used and want to fill this table or
update it whenever a new entry created or entered into HR system.
Is there any way to do that?
Thanks.
deniz.
‎2008 Nov 25 8:11 AM
Hello,
Are you trying to create a RFC? Sorry, but I am not able to get to your requirement.
For updating/creating new record in HR database:
You should always update Info type using HR_INFOTYPE_OPERATION because it updates the information of the employee for the HR database not just the table. Below Code will be of help to you.
LOOP AT t_insert INTO w_insert.
w_pernr = w_insert-ownnum.
CALL FUNCTION 'HR_READ_INFOTYPE'
EXPORTING
pernr = w_pernr
infty = c_infty "'0105'
TABLES
infty_tab = t_0105
EXCEPTIONS
infty_not_found = 1
OTHERS = 2.
READ TABLE t_0105 INTO w_0105 WITH KEY pernr = w_insert-ownnum"#EC *
subty = c_subu.
IF sy-subrc = 0.
MOVE w_0105 TO w_p0105.
w_p0105-usrid = w_insert-lanid.
CLEAR w_0105.
ELSE.
w_p0105-pernr = w_pernr.
w_p0105-usrid = w_insert-lanid.
w_p0105-begda = sy-datum.
w_fnr = 'X'.
ENDIF.
CALL FUNCTION 'BAPI_EMPLOYEE_ENQUEUE'
EXPORTING
number = w_pernr.
w_p0105-pernr = w_pernr.
IF w_fnr = 'X'.
CALL FUNCTION 'HR_INFOTYPE_OPERATION'
EXPORTING
infty = c_infty "'0105'
number = w_p0105-pernr
subtype = c_subu "'0001'
validityend = w_p0105-endda
validitybegin = w_p0105-begda
record = w_p0105
operation = c_oprn "'INS'
tclas = 'A'
dialog_mode = '0'
IMPORTING
return = w_return.
ELSE.
CALL FUNCTION 'HR_INFOTYPE_OPERATION'
EXPORTING
infty = c_infty "'0105'
number = w_p0105-pernr
subtype = c_subu "'0001'
validityend = w_p0105-endda
validitybegin = w_p0105-begda
record = w_p0105
operation = 'MOD' "'MOD'
tclas = 'A'
dialog_mode = '0'
IMPORTING
return = w_return.
ENDIF.
CLEAR w_fnr.
CALL FUNCTION 'BAPI_EMPLOYEE_DEQUEUE'
EXPORTING
number = w_pernr.
Endloop.
Hope it helps.
Thanks,
Jayant
‎2008 Nov 25 8:16 AM
Hi Jayant,
Thanks.
Assume HPX as HR system and
HPY the system I have created table(Assume table as ZPERSONEL)
What I want is to enter data into or update zpersonel table from HR system,HPX.
So do I have to write code at HR system or in HPY?
Thanks.
deniz.
‎2008 Nov 25 8:24 AM
If the data is in another system i.e. HPX as in your case and you want to update the table ZPERSONEL in HPY system then you need to create two RFC's one in each system for data transfer. Use MODIFY statement in HPY system to update the entries in ZPERSONEL table.
Thanks,
Jayant