2007 Oct 01 12:07 PM
i have to make a FM and in that use "hr_read_infotype" to read current infotype details for personnel number ....and fetch the details from infotype tables (paXXXX)
for that personnel num.
i dont find any use of hr_read_infotype FM as it only takes input infotype and personnel num and output sy-subrc result....
i can input personel number in my FM also so wat is the exact use of FM hr_read_infotype.
plz help.......
i have to make a FM and in that use "hr_read_infotype" to read current infotype details for personnel number ....and fetch the details from infotype tables (paXXXX)
for that personnel num.
i dont find any use of hr_read_infotype FM as it only takes input infotype and personnel num and output sy-subrc result....
i can input personel number in my FM also so wat is the exact use of FM hr_read_infotype.
plz help.......
2007 Oct 01 12:14 PM
2007 Oct 01 12:33 PM
To get data from various infotypes :
1.) Declare fields as follows:
FIELD-SYMBOLS <it> TYPE STANDARD TABLE.
DATA l_table_name LIKE feld-name.
DATA: wa_0008 TYPE STANDARD TABLE OF p0008,
0008_line LIKE LINE OF wa_0008.
2) In Step 3 I have a form that you will need to call like this:
MOVE 'wa_0008' TO l_table_name.
ASSIGN (l_table_name) TO <it>.
PERFORM read_infotype USING pernr
'0008'
begda
endda.
wa_0008 = <it>.
3) Your form will need to look like this
FORM read_infotype USING pers_num
it_num
begin
end.
CALL FUNCTION 'HR_READ_INFOTYPE'
EXPORTING
pernr = pers_num
infty = it_num
begda = begin
endda = end
TABLES
infty_tab = <it>
EXCEPTIONS
infty_not_found = 1
OTHERS = 2.
IF sy-subrc = 1.
.......
ENDIF.
ENDFORM. " read_infotype
You can then call your form passing different infotype numbers to it.
*************************************
Try to write a function module like below and then use the field symbols to move the data from four generic strings to your infotype structure........
function z_get_emp_it_data.
*"----
""Local interface:
*" IMPORTING
*" VALUE(INFTY) LIKE PRELP-INFTY
*" VALUE(BEGDA) LIKE PRELP-BEGDA DEFAULT '18000101'
*" VALUE(ENDDA) LIKE PRELP-ENDDA DEFAULT '99991231'
*" TABLES
*" PERNR_RANGE_TAB STRUCTURE PERSNO_RANGE
*" INFTY_DATA_TAB STRUCTURE PRELP
*" PERNR_NOAUTH_TAB STRUCTURE PERNRTAB
*"----
data : begin of itab_pernr occurs 0,
pernr like p0003-pernr,
end of itab_pernr.
data : v_subrc like sy-subrc.
select distinct pernr from pa0003 into table itab_pernr where
pernr in pernr_range_tab.
loop at itab_pernr.
clear v_subrc.
call function 'HR_READ_INFOTYPE'
exporting
tclas = 'A'
pernr = itab_pernr-pernr
infty = infty
begda = begda
endda = endda
bypass_buffer = ' '
importing
subrc = v_subrc
tables
infty_tab = infty_data_tab.
if v_subrc gt 0.
If no authority then put the PERNR in PERNR_NOAUTH_TAB table
clear pernr_noauth_tab.
pernr_noauth_tab-pernr = itab_pernr-pernr.
append pernr_noauth_tab.
continue.
endif.
endloop.
endfunction.
*************************************
Reagrds
Vasu
2007 Oct 01 12:55 PM
Hi Karan,
The function module HR_READ_INFOTYPE is useful if you have infotype field as select options on the selection screen. Suppose you enter inftypes from 0000 to 0050 and you want to know howmany infotypes are updated or changed for a given employee during the given period. You can use this function module.
Check the below code.
TABLES: t591s, pa0000.
DATA: BEGIN OF it_pernr OCCURS 0,
pernr LIKE pa0000-pernr,
END OF it_pernr.
DATA: BEGIN OF it_info_type OCCURS 0,
infty LIKE t591s-infty,
END OF it_info_type.
DATA: BEGIN OF inft_tab OCCURS 0.
INCLUDE STRUCTURE pskey.
DATA: aedtm LIKE p0001-aedtm,
END OF inft_tab.
SELECT-OPTIONS: s_pernr FOR pa0000-pernr,
s_infty FOR t591s-infty.
START-OF-SELECTION.
SELECT pernr FROM pa0000 INTO TABLE it_pernr
WHERE pernr IN s_pernr AND
endda = '99991231' AND
stat2 = '3'.
IF sy-subrc = 0.
SORT it_pernr BY pernr.
DELETE ADJACENT DUPLICATES FROM it_pernr COMPARING pernr.
ENDIF.
SELECT infty FROM t777d
INTO TABLE it_info_type
WHERE infty IN s_infty.
IF NOT it_info_type[] IS INITIAL.
DELETE it_info_type WHERE infty EQ '0000' OR
infty EQ '0003' OR
infty BETWEEN '2000' AND '2999' OR
infty BETWEEN '9000' AND '9999'.
ENDIF.
LOOP AT it_pernr.
LOOP AT it_info_type.
CLEAR inft_tab.
REFRESH inft_tab.
CALL FUNCTION 'HR_READ_INFOTYPE'
EXPORTING
tclas = 'A'
pernr = it_pernr-pernr
infty = it_info_type-infty
TABLES
infty_tab = inft_tab
EXCEPTIONS
infty_not_found = 1
OTHERS = 2.
LOOP AT inft_tab WHERE aedtm LE '20070101' AND
aedtm GE '20071001'.
do what ever you want.
ENDLOOP.
ENDLOOP.
ENDLOOP.
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |