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: 

HCM PNP LDB - Table for all the eligible employees ?

former_member229979
Participant
0 Kudos

Hi ABAP Gurus,

This question is specific to PNP LDB . I am using PNP and within loop of GET PERNR and END-OF-SELECTION, I want to get all the eligible employees in a single internal table. Where can I get it?

5 REPLIES 5

Former Member
0 Kudos

Hi,

If i got your question right, you need to show all the employees in the output, which you can do without giving inputs in the selection screen.Just execute. Here is a sample program.

tables:pernr,t528t.

infotypes:0001,0008.

  data : begin of itab occurs 0,

  pernr like p0001-pernr,

  sname like p0001-sname,

  plans like p0001-plans,

  begda like p0001-begda,

  endda like p0001-endda,

  ptext like t528t-plstx,

  ANSAL like p0008-ANSAL,

  end of itab.

start-of-selection.

  get pernr.

itab-pernr = pernr-pernr.

rp_provide_from_frst p0001 space pn-begda pn-endda .

  IF pnp-sw-found = 1.

  itab-sname = p0001-sname.

  itab-plans = p0001-plans.

  itab-begda = p0001-begda.

  itab-endda = p0001-endda.

  endif.

rp_provide_from_frst p0008 space pn-begda pn-endda .

  IF pnp-sw-found = 1.

  itab-ansal = p0008-ansal.

  endif.

data : vtext(50) type c.

  select single plstx into vtext

  from t528t

  where plans = itab-plans

  and SPRSL = 'EN'.

  if sy-subrc eq 0.

  itab-ptext = vtext.

  endif.

  append itab.

end-of-selection.

clear itab.

  loop at itab.

  write:/ itab-pernr,

  itab-sname,

  itab-plans,

  itab-begda,

  itab-endda,

  itab-ansal.

  endloop.

If you want to store the the pernr in an internal table you have to fetch all the  pernr from PA0000.

Or post your exact requirement.

Regards

.

GirieshM
Active Contributor
0 Kudos

Hi Megha,

If you want all the Pernr to be in single internal table then do as per below:

Types: begin of ty_pernr,

                   pernr type persno,

            end of ty_pernr.

data: it_pernr type table of ty_pernr,

         wa_pernr type ty_pernr.

GET Pernr.

wa_pernr-pernr = pernr-pernr.

append  wa_pernr to it_pernr.

clear: wa_pernr.

End-of-selection.

hope it might help.

With Regards,

Giriesh M

former_member229979
Participant
0 Kudos

Can we have all the employees within the loop --> GET PERNR and END-OF-SELECTION.

0 Kudos

No Megha,

Get Pernr and end of selection loops for each employee at a time.

All the data related to that particular employee is available in that loop.

Within this loop, if you want to get the information of all eligible employees, you will need to give an explicit select statement here with the required conditions.

select * from pa0001 where ....

0 Kudos

Hi Megha,

      You will get the personnel number which ever satisfied based on the selection screen condition one by one and you can append the pernr list into an seperate internal table. If you want to process infotypes record of an employee then please mention those infotypes in Keyword "Infotypes"  at the repoet, so that you can use those infotypes within LDB instead of writing a query.


GET Pernr.

wa_pernr-pernr = pernr-pernr.

append  wa_pernr to it_pernr.

clear: wa_pernr.

End-of-selection.

Revert back incase of issues.

With Regards,

Giriesh M