‎2009 Sep 16 8:24 PM
I am using PNPCE LDB and I need only PERNR on my selection screen . Hence used ___CE002 report category. Now when I run the report, I get all the records for each pernr from IT0001. But I will need only the last or recent record. How do I control this?
My Declarations:
Nodes
NODES: peras.
Logic:
Get Personnel assignment
GET peras.
Fetch only the Last Record
rp_provide_from_last p0001 space pn-begda pn-endda.
Thanks,
Kiran
‎2009 Sep 16 8:39 PM
The logic what you wrote is correct.
You cannot control the data coming from PNPCE ...
All you can do is filter the data in the GET event by using Macros ,
or just READ the structure P0001(in your case) by sorting on BEGDA descending .. and read the first entry ..
‎2009 Sep 16 8:46 PM
Hi Srinivas,
Thanks. That was the idea I got too...sort descending. But I will have multiple pernr's data at the same time. Then How do I skip the other recs for the same pernr and go to the next pernr.
I can use AT events though...its could be a performance issue.
Any more suggestions please.
Thanks,
Kiran
‎2009 Sep 16 9:38 PM
I thought below logic can be a good idea. Please suggest.
Sort it0001 descending.
delete adjacent duplicates from it0001 comparing pernr.
This way, i will have only the last valid record.
Please suggest if any alternatives.
Thanks,
Kiran
‎2009 Sep 17 7:59 AM
‎2009 Sep 17 8:09 AM
After get Eveent, write the macro rp_provide_from_last and check the condition.
GET PERAS.
Rp_provide_from_last p0001 space pn-begda pn-endda.
IF p0001-pernr NOT IN pnppernr.
REJECT.
ENDIF.
‎2009 Sep 17 8:19 AM
Hi Kiran,
Try this way.
Thanks
Venkat.O
REPORT ztest_notepad.
NODES peras.
INFOTYPES 0001.
DATA: BEGIN OF it_p0001 OCCURS 0,
pernr TYPE pa0001-pernr,
subty TYPE pa0001-subty,
bukrs TYPE pa0001-bukrs,
werks TYPE pa0001-werks,
persg TYPE pa0001-persg,
persk TYPE pa0001-persk,
END OF it_p0001.
START-OF-SELECTION.
GET peras.
rp_provide_from_last p0001 space pn-begda pn-endda.
IF pnp-sw-found = '1'.
MOVE-CORRESPONDING p0001 TO it_p0001.
APPEND it_p0001.
ELSE.
REJECT.
ENDIF.
END-OF-SELECTION.
"Display It_p0001 data once all employess are processed
"between GET PERAS and END-OF-SELECTION.
‎2009 Sep 17 8:28 AM
‎2009 Sep 17 3:51 PM
I left my own logic.
Hi Srini & Venkat, Since I don't have dates for my selection, it would fecth all the records for each pernr. Thats what I said in my first post. So macro wouldn't work.
Thanks,
Kiran
‎2009 Sep 17 3:56 PM
Hi Kiran,
Dates doesn't matter. Even if the dates are entered on the selection screen , data will not be filtered. U'll get all the records.
U need to filter data at the GET event.
Regards,
Srini.