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 Abap - Using select query

hassimkhan
Explorer
0 Kudos

Hello expert,

I've tried provide statement and macro both work fine. Now i want to do a select statement using bedga and endda entered on screen.

"getting all employee personal number & normal hours employee only

   SELECT pernr

     FROM pa0007

     INTO TABLE gt_007

     WHERE begda <= p_begda AND endda > p_endda.


Is this the right way? Because here we are dealing with with period interval not just comparing date, please let me know if this is correct

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Almost correct.   You need to eliminate all infotypes starting beyond the selection screen date range or ending before the selection screen date range.

   SELECT pernr

     FROM pa0007

     INTO TABLE gt_007

     where begda le p_endda  "infotype starts before screen end date
     and endda ge p_begda"and ends after screen start date  

2 REPLIES 2

Former Member
0 Kudos

Almost correct.   You need to eliminate all infotypes starting beyond the selection screen date range or ending before the selection screen date range.

   SELECT pernr

     FROM pa0007

     INTO TABLE gt_007

     where begda le p_endda  "infotype starts before screen end date
     and endda ge p_begda"and ends after screen start date  

former_member289261
Active Contributor
0 Kudos

Hi,

The matter to look into is just the START DATE i.e BEGDA. ENDDA of screen parameter is of no importance because for few infotypes like 0015, BEGDA and ENDDA are same.

So,

Use query like this :

SELECT PERNR

INTO TABLE GT_007

FROM PA0007

WHERE BEGDA LE P_BEGDA

AND ENDDA GE P_BEGDA.

This where statement will fetch correct data for all infotypes.