Application Development and Automation 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: 
Read only

reading infotype

Former Member
0 Likes
955

im trying to read data from infotype 0002 by using hr_raed_infotype

CALL FUNCTION 'HR_READ_INFOTYPE'

EXPORTING

TCLAS = 'A'

pernr = 10

infty = '0002'

BEGDA = 'sy-datum'

ENDDA = '99991231'

tables

infty_tab = i_0002

EXCEPTIONS

INFTY_NOT_FOUND = 1

OTHERS = 2

i declared internal table using

DATA: i_0002 like P0002 occurs 0 with header line.

but my internal table is not getting populated.

also plz can anyone explain how to use select statements in hr reporting.

thnx

3 REPLIES 3
Read only

Former Member
0 Likes
603

Try declaring a variable for your pernr value you are passing into the function module.

For example:


data: l_pernr like p0002-pernr.

move: '10' to l_pernr.

then use the pernr variable for your FM Call.

Best Regards,

Chris

Read only

Former Member
0 Likes
603

Hi

remove quotes for sy-datum field and see

BEGDA = sy-datum

and give the PERNR number in 8 digits in quotes '00000010'.

You have to use

provide...endprovide statement like select statement

or if you use PNP ldb use

GET PERNR.

rp_provide_from_frst p0000 space pn-begda pn-endda.

if pnp-sw-found EQ '1'.

READ TABLE p0001 WITH KEY pernr = p0000-pernr.

if sy-subrc = 0.

write : p0001-plans. " earliest.

endif.

endif.

rp_provide_from_last p0014 space pn-begda pn-endda.

if pnp-sw-found EQ '1'.

READ TABLE p0014 WITH KEY pernr = p0000-pernr.

if sy-subrc = 0.

write : p0014-LGART. .

endif.

endif.

Reward points for useful Answers

Regards

Anji

Read only

Former Member
0 Likes
603

just copy & paste it will work

tables :  P0002 .
parameter :  s_pernr  like P0002-pernr .

 DATA : infty_tab TYPE TABLE OF p0002,
         wa_infty TYPE p0002.
  CALL FUNCTION 'HR_READ_INFOTYPE'
    EXPORTING
*   TCLAS                 = 'A'
      pernr                 = s_pernr
      infty                 = '0002'
*   BEGDA                 = '18000101'
*   ENDDA                 = '99991231'
   BYPASS_BUFFER         = 'X'
*   LEGACY_MODE           = ' '
* IMPORTING
*   SUBRC                 =
    TABLES
      infty_tab             = infty_tab
* 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.

reward points if it is usefull .

Girish