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: 

Need the latest employee records from PA0000

Pavithrra
Participant
0 Kudos

Hi Team,

Can you please help me in the below  select query. It is causing performance issue if i select the record based on aedtm field.

select pernr begda endda aedtm massn massg begda endda stat1 stat2

          into CORRESPONDING FIELDS OF TABLE gt_pa00

          from pa0000

          for ALL ENTRIES IN itab

          where pernr = itab-low  and

      aedtm IN s_seldt.


The functional need the latest employees record or the last changed on aedtm based on employee.


If i add the above select query it is creatinga  performance issue. The functional doesnt want to select the record based on the endda and begda.



Thanks and Regards,

Pavithrra

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

Instead of '  into CORRESPONDING FIELDS OF TABLE gt_pa00' , create a types for  the selection fileds and move the same to the internal table..

check before the select statement , where itab is not initial.


if again performance issue there , i will suggest one more solution...


thanks,

Vijay SR

13 REPLIES 13

roberto_vacca2
Active Contributor
0 Kudos

Hi.

You can:

1 - assign PNP logical database to your report and make a read like

     INFOTYPES: 0000.

     NODES: pernr.

     TABLES: t001p.

     get pernr.

     rp-provide-from-last p0000 space pn-begda pn-endda. "In your case enlarge BEGDA and ENDDA

2 -  Use function module HR_READ_INFOTYPE

3 - Try with a SELECT DISTINCT and ORDER option during SELECT instruction.

Hope to help.

Bye

0 Kudos

Hi Roberto,

Thanks for your immediate reply. It is not for one pernr i need multiple pernrs  based on the selection date range.

Will the above query work for this requirement.

Thanks,

Pavithrra

0 Kudos

Hi.

In that case your "aedtm filter" should be applied after internal table it's loaded.

You could then sort and search first occurence of PERNR with a BINARY SEARCH.

Hope to help

Former Member
0 Kudos

Hi,

Instead of '  into CORRESPONDING FIELDS OF TABLE gt_pa00' , create a types for  the selection fileds and move the same to the internal table..

check before the select statement , where itab is not initial.


if again performance issue there , i will suggest one more solution...


thanks,

Vijay SR

0 Kudos

Hi Vijayakumar,

Sorry for replying late. I was sick for the past 2 days.

Thanks for the suggestion but I am already using the similar thing.

data: begin of gt_pa00 occurs 0,

         pernr like pa0000-pernr,

         begda like pa0000-begda,

         endda like pa0000-endda,

         AEDTM like pa0000-aedtm,

         stat1 like pa0000-stat1,

         stat2 like pa0000-stat2,

         massn like pa0000-massn,

         massg like pa0000-massg,

      end of gt_pa00.

still it caused me the performance issue. Can you please provide the other solution.

Thanks.

Pavithrra

0 Kudos

Hi,

Paste your code here please

Thanks,

Vijay SR

0 Kudos

Hi Vijay,


Below is my code:


data: begin of gt_pa00 occurs 0,

         pernr like pa0000-pernr,

         begda like pa0000-begda,

         endda like pa0000-endda,

         AEDTM like pa0000-aedtm,

         stat1 like pa0000-stat1,

         stat2 like pa0000-stat2,

         massn like pa0000-massn,

         massg like pa0000-massg,

      end of gt_pa00.



select pernr begda endda aedtm massn massg begda endda stat1 stat2

             into CORRESPONDING FIELDS OF TABLE gt_pa00

          from pa0000

          for ALL ENTRIES IN itab

          where pernr = itab-low  and

               aedtm IN s_seldt

0 Kudos

Hi,

Two Options...

1.Create a secondary index for the aedtm in pa0000

or

2.in  select statement use only penr for select query

select pernr begda endda aedtm massn massg begda endda stat1 stat2

             into TABLE gt_pa00

          from pa0000

          for ALL ENTRIES IN itab

          where pernr = itab-low .

sort the gt_pa00 using pernr and aedtm

delete gt_pa00 where aedtm in selection screen


hope it helps

Please paste the code for the itab-low...where you populate the itab-low..Whether it have any balnk values???

Thanks,

Vijay SR

0 Kudos

Hi Vijay,

Thanks for the suggestion. the itab has some values. I have done the changes and sent for testing.

Regards,

Pavithrra

0 Kudos

Hi,

I believe you just need to select the maximun value contained in AEDTM field.

Please try as given below.


select pernr begda endda  max(aedtm) massn massg begda endda stat1 stat2

          into CORRESPONDING FIELDS OF TABLE gt_pa00

          from pa0000

          for ALL ENTRIES IN itab

          where pernr = itab-low  and

      aedtm IN s_seldt.


0 Kudos

Hi Jayati saha,

Thanks for your time. I have added the same logic in my code.

Anyways now I am trying with endda and begda in the query.

I will let you know whether that works fine.

THanks,

Pavithrra

Former Member
0 Kudos

Hi Pavithrra,

how many entries has your internal table itab?

Please read this note http://service.sap.com/sap/support/notes/48230

and check your profile parameters!


Good luck

By from Germany

Pavithrra
Participant
0 Kudos

Thanks all for your effort and valuable  time.

Thread is closed.