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: Need help with accessing data in an infotype...

Former Member
0 Kudos

I'm a newbie so bear with me, please.

I have a requirement to process records in IT0167 (Life Insurance). The gist of what I need to do is pull back anyone who is enrolled in an optional life plan and will turn 40 or 60 the month subsequent to when the program is executed.

I've heard of PNPCE and macros but all I can find are macros that will give you the last active record for a period, for example (RP-PROVIDE-FROM-LAST, etc.). This seems like it'll only pull back one record at a time but I need to iterate over anyone who fits the criteria.

I'm told that doing a select on PA0167 isn't a good idea and that I should use the LDB + macros but I can't find what I need. I'd be happy if I could find one that pulled back anyone who's active and then I could iterate over that itab and process only those that meet my criteria.

Suggestions?

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

Declare 0167 in the infotypes statement .. (If UR using an LDB)

in the get pernr event ...

infotypes : 0167.

start-of-selection.

GET PERNR.

loop at P0167.(U need not create this structure .. it will be

created if we are declaring 0167 with infotypes statement) ..

*P0167 contains all the records for one particular pernr ...

*U can loop P0167 for your criteria

endloop.

END-OF-SELECTION.

6 REPLIES 6

Former Member
0 Kudos

Hi,

Declare 0167 in the infotypes statement .. (If UR using an LDB)

in the get pernr event ...

infotypes : 0167.

start-of-selection.

GET PERNR.

loop at P0167.(U need not create this structure .. it will be

created if we are declaring 0167 with infotypes statement) ..

*P0167 contains all the records for one particular pernr ...

*U can loop P0167 for your criteria

endloop.

END-OF-SELECTION.

0 Kudos

Thanks for the information - I feel a little closer.

Can you clarify what you mean by "in the get pernr event"? Did you mean that in the START-OF-SELECTION I would call "GET PERNR"? What does that statement do once executed? Do I need to "declare" PERNR somewhere?

What's the relationship between "GET PERNR" and my loop?

Thanks for your help!!!

0 Kudos

If UR declaring PNP as the Logical database ... then U need to

use this event ..

Tables : pernr.

infotypes : 0167.

start-of-selection.

get pernr.

*once this is executed .. the structure P0167 will be filled up

with the data .. (what ever infotypes U declare using infotypes

statement .. will be filled up ... )

loop at p0176 ....

endloop.

end-of-selection.

0 Kudos

OK. I guess the only thing that isn't clicking is "GET PERNR". Can you tell me what this does, exactly? I'm not familiar with it. I know it has something to do with LDBs but that's about it. I'm having a hard time making the connection between this command (which obviously has to do with personnel numbers) and the fact that, after it's called, P0167 will have data in it.

Thanks again!!!

0 Kudos

http://sapabap.iespana.es/sap/info/hr_overview.htm

Use of GET PERNR is to retrieve data from data base and put it on

p0000,p0001....etc.this statement retrieves infotypes those are declared in

INFOTYPES declaration. PERNR is parameter where we enter PNP selection. so

GET statement get the details of particular pernr(person No.).GET statement

is just like loop.this will end when END-OF-SELECTION.

0 Kudos

I've got the following code to work. However, getting my brain around some of the things is what I'm struggling with now.

REPORT  ztest_pnpce.

TABLES:
  pernr.

NODES:
   peras.

INFOTYPES:0167 AS PERSON TABLE, 0002 AS PERSON TABLE.

GET peras.

  PROVIDE * FROM pp0002 * FROM pp0167 BETWEEN pn-begda AND pn-endda.
    WRITE 😕 pp0002-pernr,
             pp0002-gbdat,
             pp0167-bplan.
  ENDPROVIDE.

My questions are thus:

1) Why is the TABLES pernr statement there? If I take it out the program runs but there is no selection screen. What is the link?

2) What is "peras"? Yeah, I know it's a node in an LDB but I don't understand what it "is". Is there a "layman's" definition?

3) GET peras is called an "event" - like START-OF-SELECTION but it looks more like a command to me. I'm having trouble grasping this as an event. Events are called somewhere else so is the LDB calling this event?

THANKS AGAIN!!!