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 infotypes

Former Member
0 Likes
578

im trying to read data from infotype 0002 by using hr_read_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

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
544

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

Message was edited by:

Anji Reddy Vangala

3 REPLIES 3
Read only

Former Member
0 Likes
545

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

Message was edited by:

Anji Reddy Vangala

Read only

Former Member
0 Likes
544

hi,

use select querry...........

select * from <b>PA0002</b>

where condition........

Reward points if helpful,

Regards,

Imran

Read only

Former Member
0 Likes
544

just copy & paste ... i modified you query .. it works now

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 suefull .

Girish