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-ABAP

Former Member
0 Kudos

Hi to all

Please tell me what id the meaning of following statement :

RP-READ-INFOTYPE PERNR 0002 P0002 <BEGIN> <END>

Also tell me how to fetch data from infotype and tables.

plz tell me the step by step procedure.

thanks & regards

Anubhav

2 REPLIES 2

Former Member
0 Kudos

Hi

This is the Macro used in HR to fetch the data from a Infotype

See the sample code for fetching data from Infotype

1. PROVIDE * from PA0001......ENDPROVIDE

this will fetch all data similar to select...endselect with in the given BEGDA and ENDDA dates

2.If you attach a LDB like PNP then you use the MAcros and fetch the data using GET statement

START-OF-SELECTION.

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.

Regards

Anji

Former Member
0 Kudos

Create a program, link the program to the PNP logical database (SE38 -> Click Properties -> Logical Database -> PNP).

In the very top line of your top-include or global data section put this instruction:

INFOTYPES:

And write all the numbers you need, for example:

INFOTYPES: 0000, 0001, 0002, 0006, 0041.

This will buffer those infotypes at runtime.

After, put this line:

TABLES pernr.

In the section START-OF-SELECTION...END-OF-SELECTION put this instruction:

GET pernr.

You will see P* structures magically filled.

If you want, you can read other records from Infotypes declared in global data section, using the macro:

rp-read-infotype

Or fetch the last/first record on a P* structure by using these:

rp-provide-from-last

rp-provide-from-first

If you need only active employees, you can use this macro at INITIALIZATION section:

rp-sel-ein-aus-init.

This will force the system to check out only active employees.

&----


*& Report ZSR_HR_EX1

*&

&----


*&

*&

&----


REPORT ZSR_HR_EX1.

.

DATA : BOOLEAN(1) TYPE C.

TABLES : PERNR.

INFOTYPES : 0002,0006.

START-OF-SELECTION.

GET PERNR.

RP-DEF-BOOLEAN .

*write 😕 pernr-pernr.

RP-PROVIDE-FROM-LAST P0002 SPACE PN-BEGDA PN-ENDDA.

IF PNP-SW-FOUND = 1.

WRITE 😕 P0002-PERNR, P0002-NACHN, P0002-VORNA.

ENDIF.

RP-PROVIDE-FROM-LAST P0006 '1' PN-BEGDA PN-ENDDA.

END-OF-SELECTION.

IF PNP-SW-FOUND = 1.

WRITE 😕 P0006-ORT01, P0006-LAND1, P0006-PSTLZ.

ENDIF.

use above logic and get data for remaining p0000,p0001,p0041 also

Look at the Link below

http://www.sap-basis-abap.com/sapta010.htm

Please give me reward points...