Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

HR_READ_INFOTYPE

0 Kudos

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.

7 REPLIES 7

franois_henrotte
Active Contributor
0 Kudos

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)

0 Kudos

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.

0 Kudos

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

0 Kudos

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

0 Kudos

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.

0 Kudos

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.

0 Kudos

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.