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: 

date operation in select statement

prasad
Participant
0 Kudos

Hi experts,

is there any way to compare   the

month and date of  table  field with month and date of

sy-datum .

for Example 

By using the select statement

   select pernr nachn vorna from pa0002 into  TABLE itab where gbdat = sy-datum.

the query retrieving results in which the gbdat equal to sy-datum( no records are fetched because for ex gbdat =19800918 and sydatum = 20120918 )

but i want to compare only the month and date of gbdat field with month and date of

sy-datum .

Regards

Prasad

1 ACCEPTED SOLUTION

raymond_giuseppi
Active Contributor
0 Kudos

Did you try to consider date field as 8 characters long field.

TABLES: pa0002.

DATA: itab TYPE TABLE OF pa0002,

      wildcard TYPE c LENGTH 8.

wildcard = sy-datum.

wildcard+0(4) = '____'.

SELECT * INTO TABLE itab

  FROM pa0002

  WHERE gbdat LIKE wildcard.

BREAK-POINT.

Happy birthday ?

Regards,

Raymond

2 REPLIES 2

raymond_giuseppi
Active Contributor
0 Kudos

Did you try to consider date field as 8 characters long field.

TABLES: pa0002.

DATA: itab TYPE TABLE OF pa0002,

      wildcard TYPE c LENGTH 8.

wildcard = sy-datum.

wildcard+0(4) = '____'.

SELECT * INTO TABLE itab

  FROM pa0002

  WHERE gbdat LIKE wildcard.

BREAK-POINT.

Happy birthday ?

Regards,

Raymond

0 Kudos

Thanks Raymond

Problem solved.

Regards

Prasad