05-12-2008 10:52 AM
Hi friends.
Here i want to retrieve records(HR) for only employee.For this i am using HR_READ_INFOTYPE Function Module.
I have to retrieve the records from 0000, 0001, 0009, 0021, Etc.,
Can i use only one function module,to retrieve the records from different Infotypes(Any Fun. module will get records from one infotype).
Here i want to keep this into one subroutine and i will call this Subroutine ,repeatedly by passing infotype number and other parameters as per required.
This will reduce my code.
Can,plz, Any one guide in this part of code.
Points will be given as Rewards.
Thanks&Regards,
Chandra.
06-24-2008 12:46 PM
either you call the function repeatly and store data into table with structure PRELP
either you call once the function HRO1_FILL_INFOTYPES (note it is O1 and not 01)
06-24-2008 2:20 PM
Thanks friend.
Yeah this is very useful to my requerement.
can please send any sample code related to above method you said,It will very help to to me.
Thanks for spending your valuable time for sake of me.
Regards.
chandra.
06-24-2008 2:28 PM
you can create Z function module for your requirement
the fields u want from perticular infotype you can select that as exporting parameter
i hope u got my point
06-24-2008 2:32 PM
hi Chandra,
pls. see the following sample, of course you have to modify/expand a bit, but I hope you get the picture:
DATA : gv_pernr TYPE pernr.
DATA : gt_0001 TYPE TABLE OF pa0001,
gt_0008 TYPE TABLE OF pa0008.
PERFORM select : USING '0001'
CHANGING gt_0001,
USING '0008'
CHANGING gt_0008.
*&---------------------------------------------------------------------*
*& Form select
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->LV_INFOTYPE text
* -->LT_TABLE text
*----------------------------------------------------------------------*
FORM select USING lv_infotype TYPE infty
CHANGING lt_table TYPE table.
CALL FUNCTION 'HR_READ_INFOTYPE'
EXPORTING
* TCLAS = 'A'
pernr = gv_pernr
infty = lv_infotype
* BEGDA = '18000101'
* ENDDA = '99991231'
* BYPASS_BUFFER = ' '
* LEGACY_MODE = ' '
* IMPORTING
* SUBRC =
TABLES
infty_tab = lt_table
EXCEPTIONS
infty_not_found = 1
OTHERS = 2.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. "select
hope this helps
ec
06-24-2008 2:39 PM
i want sample code by using the function module
HRO1_FILL_INFOTYPE or HRO1_READ_INFOTYPES
Please can any one pass the code.
Regards,
Chandra.
06-24-2008 2:44 PM
Check this sample code;
DATA: READ_IT TYPE HRIFT_tt_cont,
RETURN_CODE LIKE SY-SUBRC.
DATA: IT_TABLE TYPE HRIFT_tt_lst.
* the list of infotypes needed
IT_TABLE-NUMBER = '0001'.
IT_TABLE-MODE = '<MODE>'.
IT_TABLE-BEGDA = <Begin date>.
IT_TABLE-ENDDA = <End date>.
append IT_TABLE.
clear IT_TABLE.
IT_TABLE-NUMBER = '0002'.
IT_TABLE-MODE = '<MODE>'.
IT_TABLE-BEGDA = <Begin date>.
IT_TABLE-ENDDA = <End date>.
append IT_TABLE.
clear IT_TABLE.
* read infotypes
CALL FUNCTION 'HRO1_READ_INFOTYPES'
EXPORTING
EMPLOYEE_NUMBER = EMPLOYEE_NUMBER
IMPORTING
READ_IT = READ_IT
TABLES
IT_TABLE = IT_TABLE
EXCEPTIONS
OTHERS = 1.
06-25-2008 9:13 AM
you have to pass the parameter READ_IT containing the list of infotypes to be read
in this parameter the component INFTY must be filled just like internal table $RINFO$ in logical database PNP
after the function call, data is returned in component DATA of parameter
if you don't know $RINFO$ , it should just contain:
NUMBER = infotype number on 4 characters
MODE = 'Y'
BEGDA & ENDDA = start date and end date for selection of records (of current infotype number)
that's all, other fields can remain empty
I don't have sample code, but it is quite obvious. it should be something like
DATA: wt_read TYPE hrift_ti_cont,
ws_read TYPE hrift_ts_cont.
DATA: ws_prelp TYPE prelp.
ws_read-infty-number = '0001'.
ws_read-infty-mode = 'Y'.
ws_read-infty-begda = '20080101'.
ws_read-infty-endda = '20081231'.
APPEND ws_read TO wt_read.
CALL FUNCTION 'HRO1_FILL_INFOTYPES'
EXPORTING
employee_number = p_pernr
IMPORTING
read_it = wt_read.
LOOP AT wt_read INTO ws_read.
LOOP AT ws_read-data INTO ws_prelp.
* do something depending on ws_read-infty-number
ENDLOOP.
ENDLOOP.