cancel
Showing results for 
Search instead for 
Did you mean: 

Query in ABAP HR

Former Member
0 Kudos

Hi folks,

i am new to ABAP HR. i want to fetch data from a infotype with some conditions.

The conditions are to select data from PA9003 wehre AEDTM between period selection and zz_trip_no is not initial and subty = 2 or 3 or 4. Could any body help me how to fetch data by using 'read_infotype' statement or 'provide * from' statement.....thnks in advance, pls help me...

Ram.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi ,

Ram ,

RP-PROVIDE-from-last p9003 space pn-begda pn-endda.

use this statement , its working properly ,

regards ,

GJ

Answers (3)

Answers (3)

Former Member
0 Kudos

>

> Hi folks,

>

> i am new to ABAP HR. i want to fetch data from a infotype with some conditions.

> The conditions are to select data from PA9003 wehre AEDTM between period selection and zz_trip_no is not initial and subty = 2 or 3 or 4. Could any body help me how to fetch data by using 'read_infotype' statement or 'provide * from' statement.....thnks in advance, pls help me...

>

> Ram.

u have to use either rp_provide_from_last

or provide statement statement depends on the no of records u want to read from the internal table

rp_provide_from_last acts like read statement

provide statement is like loop

rp_provide_from_last reads the last record of the infotype internal table

if u want to read multiple records from the infotype internal table then use provide

provide * from pa9003 between pn-begda pn-endda
                     where subtyp = '1' or '2'  or '3' or '4'
                          and zz_trip ne space

check for syntax i dont have system right now

Former Member
0 Kudos

Hi Ram,

Use the below statement,

provide * from p9003 between pn-begda and pn-endda.

write.....

endprovide.

or

provide * from p9003 between pn-begda and pn-endda where p9003-subtype = '1'.

write......

endprovide.

or

provide * from p9003 between pn-begda and pn-endda where p9003-subtype = '1'.

if p90003-valid = 'X'.

write......

endif.

endprovide.

For example look into the following program

TABLES: pernr,

t512t, "Wage type text

t001p. "Plant section

INFOTYPES: 0001, "Organ. Assignment

0014. "Recurr. Earn. & Deduc.

Start-of-selection.

rp_set_data_interval u2019P0014u2019 pn-begda pn-endda.

*-- Processing

GET pernr.

CHECK lines( p0014 ) GT 0.

rp_provide_from_last p0001 space pn-begda pn-endda.

rp-read-t001p p0001-werks p0001-btrtl space.

SKIP 2.

WRITE: / pernr-pernr,

(20) pernr-ename,

p0001-werks,

t001p-btext.

LOOP AT p0014.

CHECK p0014-betrg NE 0.

PERFORM print USING

p0014-lgart

p0014-betrg

p0014-begda

p0014-endda.

ENDLOOP.

----


  • FORM PRINT *

----


  • Print List *

----


FORM print USING

value(wtype)

value(amount)

value(begda)

value(endda).

PERFORM re512t USING t001p-molga wtype.

WRITE: / wtype UNDER pernr-ename,

t512t-lgtxt,amount,

begda,

endda.

ENDFORM. "print

----


  • FORM RE512T *

----


  • Read Wagetype Texts *

----


FORM re512t USING value(country_grouping)

value(wtype).

CHECK t512t-sprsl NE sy-langu

OR t512t-molga NE country_grouping

OR t512t-lgart NE wtype.

SELECT SINGLE * FROM t512t

WHERE sprsl EQ sy-langu

AND molga EQ country_grouping

AND lgart EQ wtype.

IF sy-subrc NE 0.

CLEAR t512t.

ENDIF.

ENDFORM.

****Reward points if found useful

Regards,

Naresh

amit_khare
Active Contributor
0 Kudos

Use simple SELECT statement.

Former Member
0 Kudos

Hi Amith,

I have to fetch the data only using rp_read statement. I should not use select statement, as we are using LDB here...

Thanks,

Ram.