Application Development and Automation 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: 
Read only

select query

Former Member
0 Likes
590

hi all,

in the selection screen i have a posting date from MKPF Table but date should display only month and year as

DATE : 1/2008 TO 12/2008

I have written as below using offset.

select-options: l_date for mkpf-budat+2(6).

but how to get the values from MKPF table using select query.

in below query budat+2(6) is not working how can i compare and get the values based on month and year.

select mblnr

mjahr

bldat

budat

into table gt_mkpf

from mkpf

for all entries in gt_mseg

where mblnr eq gt_mseg-mblnr

and mjahr eq gt_mseg-mjahr

and budat+2(6) in l_date.

please , thanks in advance

4 REPLIES 4
Read only

Former Member
0 Likes
558

Dear Neethu,

I will advise you keep the date format as it is. Just ignore date while providing dates through selection screen. This will work as it is difficult to understand.

Regards,

Vijay

Read only

Former Member
0 Likes
558

HI,

Try this code

DATE : 1/2008 TO 12/2008


select-options: l_date for mkpf-budat+2(6). " value foramt will be YYYYMM
Ranges : r_budat FOR mkpf-budat.

Loop at l_date.
r_budat-sign = l_date-sign.
r_budat-option = l_date-option.

concatenate l_date-low '01' into r_budat-low.
concatenate l_date-high '01' into r_budat-high.
CALL FUNCTION 'LAST_DAY_OF_MONTHS'                        
    EXPORTING
      day_in            = r_budat-high
    IMPORTING
      last_day_of_month = r_budat-high
   EXCEPTIONS
      day_in_no_date    = 1
      OTHERS            = 2.
Append r_budat.
ENDloop.

select mblnr
mjahr
bldat
budat
into table gt_mkpf
from mkpf
for all entries in gt_mseg
where mblnr eq gt_mseg-mblnr
and mjahr eq gt_mseg-mjahr
and budat in r_budat.

Read only

Former Member
0 Likes
558

hi neetu,

Please explain a bit clear...

Read only

Former Member
0 Likes
558

Its simple

1/2008 TO 12/2008

1/2008 means 01012008

and 12/2008 means last day of december 31122008

just make 2 fields with these dates and use them in ur select query.