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: 

PROVIDE....ENDPROVIDE HR Data

Former Member
0 Kudos

How Do Everyone,

I have inherited a piece of code below which brings

back certain infotype information. Can anyone tell me

why the p0015 is bringing back everything regardless

of the selection dates. When specifying:

BETWEEN pc-begda AND pc-endda

I thought this would apply to all the infotypes in the PROVIDE statements.

Any ideas? Would be grateful for any suggestions.

Andy

PROVIDE vorna nachn pernr gesch gbdat FROM p0002

persk begda kostl werks btrtl FROM p0001

wostd empct FROM p0007

dat01 FROM p0041

subty FROM p0442

lgart FROM p0015

cttyp FROM p0016

disab racky FROM p0077

BETWEEN pc-begda AND pc-endda.

4 REPLIES 4

Former Member
0 Kudos

HI Use this code example..

plz reward poins if it helps you..

&----


& Report ZSAPHR_PNP

*& *

&----


*& *

*& *

&----


Report ZSAPHR_PNP.

TABLES : PERNR.

*Infotype Declaration

INFOTYPES: 0002, "PERSONAL DATA

0006, "ADDRESS

0008, "

0000, "

0001. "ACTIONS

DATA : BEGIN OF ITAB OCCURS 10, "INTERNAL TABLE DECLARATION

NACHN LIKE P0002-NACHN,

VORNA LIKE P0002-VORNA,

GESCH LIKE P0002-GESCH,

GBDAT LIKE P0002-GBDAT,

FAMST LIKE P0002-FAMST,

HSNMR LIKE P0006-HSNMR,

STRAS LIKE P0006-STRAS,

LOCAT LIKE P0006-LOCAT,

PSTLZ LIKE P0006-PSTLZ,

LAND1 LIKE P0006-LAND1,

PLANS LIKE P0001-PLANS,

ORGEH LIKE P0001-ORGEH,

BET01 LIKE P0008-BET01,

WAERS LIKE P0008-WAERS,

PERNR LIKE P0000-PERNR,

END OF ITAB.

DATA: G_REPID LIKE SY-REPID."Report name

INITIALIZATION.

G_REPID = SY-REPID.

PNPTIMED = 'D'.

**********************************************START OF

SELECTION*****************************************

START-OF-SELECTION.

GET PERNR.

PROVIDE * FROM P0002 BETWEEN PN-BEGDA AND PN-ENDDA.

ITAB-PERNR = P0000-PERNR.

ITAB-NACHN = P0002-NACHN.

ITAB-VORNA = P0002-VORNA.

IF P0002-FAMST = '0'.

ITAB-FAMST = 'S'.

ELSE.

ITAB-FAMST = 'M'.

ENDIF.

ITAB-FAMST = P0002-FAMST.

IF P0002-GESCH = '1'.

ITAB-GESCH = 'M'.

ELSE.

ITAB-GESCH = 'F'.

ENDIF.

ITAB-GBDAT = P0002-GBDAT.

ITAB-HSNMR = P0006-HSNMR.

ITAB-STRAS = P0006-STRAS.

ITAB-LOCAT = P0006-LOCAT.

ITAB-PSTLZ = P0006-PSTLZ.

ITAB-LAND1 = P0006-LAND1.

ITAB-ORGEH = P0001-ORGEH.

ITAB-PLANS = P0001-PLANS.

ITAB-BET01 = P0008-BET01.

ITAB-WAERS = P0008-WAERS.

APPEND ITAB.

ENDPROVIDE.

END-OF-SELECTION.

Former Member
0 Kudos

Hi Andy,

Provide and End provide , gives you all the records

in the date range, thats why you are getting multiple

records.

If you want to get the latest record int he date range

use the below statement.

rp-provide-from-last p0015 space pn-begda pn-endda.

Hope this will hlpe you.

thanks&Regards,

Siri.

kindly award points if it is helpful.

0 Kudos

or you cam also simply loop at p0015 like any other itab..


loop at p0015 where endda ge pc-begda
                and begda le pc-endda.
....
endloop.

Regards,

Suresh Datti

0 Kudos

declare it in ur program as infotype section:

infotyepes: pa0015 and use it as

loop at p0015

where endda ge pc-begda and begda le pc-

endda

.....

endloop.

reward points if it helps

thx

gunjan