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 help in fetching the Data from HRP1000 table based on date.

Former Member
0 Kudos

Hi,

I have given two parameters in the program " otype type hrp001 and date1 type dats".

I am using select option like this "  SELECT * FROM HRP1000 INTO  table itab where otype in otype and  BEGDA  < DATE1 AND ENDDA >= DATE1."

by using this i am not getting any records in the output.by removing the "date1" relation i am able to fetch all the records. So please help me to fix this issue.

1 ACCEPTED SOLUTION

rajkumarnarasimman
Active Contributor
0 Kudos

Hi Vishnu,

Kindly check in SE16N whether the record is available in database.

Try the below code.

SELECT * FROM HRP1000 INTO  table itab

  where otype in otype and BEGDA  <= DATE1 AND ENDDA >= DATE1


Regards


Rajkumar Narasimman

4 REPLIES 4

rajkumarnarasimman
Active Contributor
0 Kudos

Hi Vishnu,

Kindly check in SE16N whether the record is available in database.

Try the below code.

SELECT * FROM HRP1000 INTO  table itab

  where otype in otype and BEGDA  <= DATE1 AND ENDDA >= DATE1


Regards


Rajkumar Narasimman

0 Kudos

If we use the if condition i am able to get the required output.

IF date1 IS NOT INITIAL.

     SELECT * FROM hrp1000 INTO  TABLE itab WHERE otype IN otype AND  begda  <= date1 AND endda >= date1.

   ELSE .

     SELECT * FROM hrp1000 INTO  TABLE itab WHERE otype IN otype.

   ENDIF.

Is their any way to fetch record without using the if condition.

0 Kudos

Hi Vishnu,

Use the following statement before select statement, assign the current date value as shown below.

date1 = sy-datum.

Regards

Rajkumar Narasimman

0 Kudos

This stems from the fact that the initial value of a date field is 00000000, so comparing this against the date values in HRP1000 will never find a match (00000000 being less than 01011900, the usual start date for unlimited HR records).

Your IF statement is a fine solution.

Regards,

Nick