09-17-2014 7:59 AM
Hi guys,
SELECT-OPTIONS: v_month FOR s068-spmon OBLIGATORY.
here v_month (month and year) is excluding given input months while fetching the data.
it's not fetching the 4th and 9th months data.
colud anybody please let me know how to make both input dates include?
Thanks in Advance
regards
satish
09-17-2014 10:23 AM
Hi Satish,
by only looking on the select-option, i'd say , there's nothing wrong with it.
The option BT signals an open interval, meaning that both, low and high value are included in the selction.
Whithout further knowledge of your source, where you actually use the select-option, it's next to impossible to analyse your problem.
Please provide a bit more information.
Best regards - Jörg
09-17-2014 8:05 AM
Hi satish,
You can create a range table for date and pass option as equal and then use this for making selection.
Regards
Giri
09-17-2014 10:23 AM
Hi Satish,
by only looking on the select-option, i'd say , there's nothing wrong with it.
The option BT signals an open interval, meaning that both, low and high value are included in the selction.
Whithout further knowledge of your source, where you actually use the select-option, it's next to impossible to analyse your problem.
Please provide a bit more information.
Best regards - Jörg
09-17-2014 11:16 AM
hi jorg,
thanks for the input
the following is my query
SELECT mblnr mjahr zeile bwart matnr lifnr ebeln ebelp lgort budat_mkpf meins menge werks FROM mseg
INTO CORRESPONDING FIELDS OF TABLE it_mseg
WHERE lifnr IN s_lifnr
AND matnr IN s_matnr
AND werks IN s_werks
AND budat_mkpf IN v_month
here budat_mkpf is the date field (ddmmyyyy) AND V_MONTH is my input (mmyyyy).
is it giving any problem.
regards
satish
09-17-2014 11:33 AM
Hi Satish,
Edit v_month.
concatenate v_month-low '01' to v_month-low.
concatenate v_month-high '31' to v_month-high.
09-17-2014 11:50 AM
Hi Satish,
here we go.
You're actually comparing an 8-digit DB-field to a 6-digit select-option.
Let's have a look on it, from a programs perspective
Budats inner representation is like YYYYMMDD, whereas your select-options inner representation comes as IBTYYYYMMYYYYMM. The db now interpretes the line IBT201404201409
as interval between 20.04.2014 to ... well something.
Now there're two possible ways out:
1.
change your select-option to
SELECT-OPTIONS v_month for mseg-budat_mkpf and fill it like
01.04.2014 to 30.09.2014
or 2.
create another ranges tab like
DATA: rt_budat TYPE RANGE OF mseg-budat_mkpf,
rs_budat LIKE LINE OF rt_budat.
DATA: l_hlp TYPE DATS.
LOOP AT v_month.
MOVE-CORRESPONDING v_month TO rs_budat
rs_budat-low+6(2) = '01'.
* the following looks a bit lengthy, yet it's the fastest way
* to calculate the last day of any given month
l_hlp = rs_budat-high.
l_hlp+6(2) = '28'. "highest day in every month
ADD 4 TO l_hlp. "garanteed to be in the next month
l_hlp+6(2) = '01'. "set to first day of next month
SUBTRACT 1 from l_hlp. "Let ABAP do the month-end calculation
rs_budat-high = l_hlp.
append rs_budat to rt_budat.
ENDLOOP.
Now use your new rangetab instead of select-option.
Personally, i'd go for the first option.
Best regards - Jörg
09-17-2014 12:03 PM
hi jorg,
you are really awesome. thanks for the wonderful kt. my issue has been resolved.
Thanks a lot.
regards
satish