05-09-2006 6:54 AM
Hii all,
Is there any standard RFC/BAPI that can be used to eextract HR Master data from a remote client? If so, pls let me know, its urgent.
Thanks in advance
Azeez
05-09-2006 6:58 AM
For Fm`s and BAPI`s go to SE37 AND search on HR and RH
for Idocs go to WE30 search HR ....
for HR tables and Transactions
http://www.sapcookbook.com/preview_hr_questions.htm
http://sap.ittoolbox.com/topics/t.asp?t=302&p=302&h1=302
http://help.sap.com/saphelp_470/helpdata/EN/8a/6a46347969e94be10000009b38f83b/frameset.htm
Pl. award the points if it helps you ...
05-09-2006 7:02 AM
Function Module
Description
BAPI_EMPLOYEE_DEQUEUE
Release infotype entry after update
BAPI_EMPLOYEE_ENQUEUE
Lock infotype entry ready for update
HR_ENTRY_DATE
Employee start date
HR_LEAVING_DATE
Employee leaving date
HR_INFOTYPE_OPERATION
Maintenance of HR infotype entries, used to create (operation = INS), change (operation = MOD), delete (operation = DEL) and create successor (operation = COP).
HR_PERSONAL_WORK_SCHEDULE
Returns employees work schedule into internal table PERWS. I.e. Days planned to work (stdaz NE 0)
HR_READ_FOREIGN_OBJECT_TEXT
Returns text values for objects i.e. Organisation Unit text
HR_READ_INFOTYPE
Read infotype data
RH_DIR_ORG_STRUC_GET
Retrieve Org. Structure (Only required parameter is org unit)
RH_PM_GET_STRUCTURE
Retrieve Organisation Structure
Retrieve employees work schedule
The below code shows how HR_PERSONAL_WORK_SCHEDULE is used. Export to the FM a personnel
number, period and it will retrieve the employees work schedule for that period.
data: it_ptpsp type standard table of t_ptpsp initial size 0,
wa_ptpsp type t_ptpsp.
CALL FUNCTION 'HR_PERSONAL_WORK_SCHEDULE'
EXPORTING
pernr = pernr-pernr
begda = pn-begda
endda = pn-endda
KUG =
REFRESH = 'X'
WORKING_HOURS = 'X'
SWITCH_ACTIV =
MODIFY_ENTRIES = 'X'
I0001_I0007_ERROR = '0'
READ_CLUSTER =
IMPORTING
warning_occured = gd_warning
TABLES
I0000 =
I0001 =
I0002 =
I0007 =
I0049 =
I2001 =
I2002 =
I2003 =
perws = it_ptpsp "Stores employees work schedule
I0003 =
EXCEPTIONS
error_occured = 1
abort_occured = 2
OTHERS = 3.
Retrieve text for Organisation unit
Simply use the code below to retrieve the organisation unit text. Using the function module will return the
full text as seen in PA20 where as using table t527x will only return the first 25 characters of the org. text
DATA: ld_orgtx(40) type c.
*Retrieve Org. Unit text
PERFORM get_org_unit USING p0001-orgeh
p0001-begda
p0001-endda
CHANGING ld_orgtx.
&----
*& Form get_org_unit
&----
Retrieve Org. Unit text
----
FORM get_org_unit USING p_orgeh
p_begda
p_endda
CHANGING p_orgtx.
DATA: orgeh_short(12) TYPE c,
orgeh_stext(40) TYPE c,
read_return TYPE i.
Returns full orgunit text, entry in table t527x is sometimes
truncated so that it fits into a 25 character field
CALL FUNCTION 'HR_READ_FOREIGN_OBJECT_TEXT'
EXPORTING
otype = 'O'
otype = ot_orgunit
objid = p_orgeh "p0001-orgeh
begda = p_begda "p0001-begda
endda = p_endda "p0001-endda
reference_date = p_begda "p0001-begda
IMPORTING
short_text = orgeh_short
object_text = orgeh_stext
return = read_return
EXCEPTIONS
nothing_found = 1
wrong_objecttype = 2
missing_costcenter_data = 3
missing_object_id = 4
OTHERS = 5.
IF sy-subrc EQ 0.
p_orgtx = orgeh_stext.
ELSE.
If function module fails return text from text table
select single orgtx
from t527x
into p_orgtx
where orgeh eq p_orgeh and "Replace with org. unit field
sprsl eq sy-langu and
( endda ge sy-datum and
begda le sy-datum ).
ENDIF.
ENDFORM. " get_org_unit
Read infotype data
Read infotype information via the use of a function module. Simply replace the infotype number '0002' and result table structure(infty_tab) with your required infotype ( i.e. 0000, 0001, 0002, 0003 etc etc).
CALL FUNCTION 'HR_READ_INFOTYPE'
EXPORTING
TCLAS = 'A'
pernr = wa_repdata-staff_id
infty = '0002'
BEGDA = '18000101'
ENDDA = '99991231'
BYPASS_BUFFER = ' '
LEGACY_MODE = ' '
IMPORTING
SUBRC =
tables
infty_tab = p0002
EXCEPTIONS
INFTY_NOT_FOUND = 1
OTHERS = 2.
Retrieve Organisation Structure
The below code shows how RH_PM_GET_STRUCTURE is used. You pass it an Organisation
Unit(OBJID) and it will retrieve all the units below it in the org. tree (including idividual personnel). Also
'RH_DIR_ORG_STRUC_GET' is an alternative but seems to be much slower.
The OBJECT_TAB table stores all the objects within the org structure zorg_unit (including all sub levels).
The key for these objects is stored within the 'OTYPE' field. Therefor if you loop through the table you can
retrive the objects you require.
i.e. The following code will loop around all the personnel numbers:
Loops around personnel numbers within Org. Unit.
LOOP AT objec_tab where otype = 'P'.
Processing....
ENDLOOP.
data: objec_tab like objec occurs 0 with header line.
data: zorg_unit type p0001-orgeh.
data: t_org_tab like rhldapp occurs 0 with header line.
call function 'RH_PM_GET_STRUCTURE'
exporting
plvar = '01' "p0000-plvar
otype = 'O' "0001-otype
objid = zorg_unit
begda = pn-begda
endda = pn-endda
status = '1'
wegid = 'SBESX'
77aw_int = ' '
tables
objec_tab = objec_tab
exceptions
not_found = 1
ppway_not_found = 2
others = 3.
***************************
Alternative, but very slow*
***************************
call function 'RH_DIR_ORG_STRUC_GET'
exporting
act_orgunit = zorg_unit
act_plvar = '01'
act_date = pn-begda
tables
org_units = t_org_tab
exceptions
no_active_plvar = 1
others = 2.
regards
vinod