03-19-2007 8:08 AM
Hallow I wont to now if I can choose validity of date for <b>one month</b>
Ex. If the user choose 1.3.07
I wont to get all the data for this month from 1.3.07 until 31.3.07 and so on
How can I do that
Its very important for me the dates for all month that the user choose
Regards
SELECT stdaz plans
FROM pa2010
INTO (wa_emp_tab-no_of_hours_imb , wa_imb_hours_itab-plans)
WHERE pernr = wa_emp_tab-pernr
AND lgart = '9EXT' " Wage Type (salary)
<b> AND begda <= so_date
AND endda => so_date</b>
GROUP BY stdaz plans.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-t01.
PARAMETERS so_date TYPE sy-datum OBLIGATORY DEFAULT sy-datum.
SELECTION-SCREEN END OF BLOCK b1.
03-19-2007 9:36 AM
data : lastday like sy-datum,
firstday like sy-datum.
concatenate so_date(6) '01' into firstday.
CALL FUNCTION 'LAST_DAY_OF_MONTHS'
EXPORTING
DAY_IN = firstday
IMPORTING
LAST_DAY_OF_MONTH = lastday
EXCEPTIONS
DAY_IN_NO_DATE = 1
OTHERS = 2.
but i am not sure about your select qry what you want here?
SELECT stdaz plans
FROM pa2010
INTO (wa_emp_tab-no_of_hours_imb , wa_imb_hours_itab-plans)
WHERE pernr = wa_emp_tab-pernr
AND lgart = '9EXT' " Wage Type (salary)
AND begda between firstdate and lastday
AND endda between firstdate and lastday.
regards
shiba dutta
03-19-2007 8:11 AM
Yes u can do that...
data w_date like p_date.
w_date = p_date.
<b>
**code to get the last day of the entered month...</b>
move '01' to w_date+6(2).
add '01' to w_date+4(2).
if w_date+4(2) gt 12.
w_date+4(2) = '01'.
add '0001' to w_date(4).
endif.
subtract 1 from w_date.
<b>**Here w_date contains the last date of the user entered month..</b>
<b>Now....</b>
SELECT stdaz plans
FROM pa2010
INTO (wa_emp_tab-no_of_hours_imb , wa_imb_hours_itab-plans)
WHERE pernr = wa_emp_tab-pernr
AND lgart = '9EXT' " Wage Type (salary)
<b>AND begda = p_date
AND endda = w_date</b>
GROUP BY stdaz plans.
Hope this solves ur problem...
regards,
sai ramesh.
03-19-2007 8:13 AM
Hi Antonio,
use the FM rp_last_day_of_the_months to get
last day of the month by passing the month number and first day is obviously 01.
So u can find out the data between these days,
hope this helps,
keerthi
03-19-2007 8:15 AM
03-19-2007 8:24 AM
Hi antonio,
Now take the start date and end date into two variables say s_low and s_high.
select ...... from pA0000 into table Itab
where begda = s_low
and enda = s_high.
regards,
keerthi.
03-19-2007 8:24 AM
hi
obviously first day of any month is 01...
CALL FUNCTION 'LAST_DAY_OF_MONTHS'
EXPORTING
DAY_IN = ST1_DATE
IMPORTING
LAST_DAY_OF_MONTH = EN1_DATE
EXCEPTIONS
DAY_IN_NO_DATE = 1
OTHERS = 2.
here, st1_date will hold 01.03.2007 and en1_date will hold 31.03.2007.. use this in your select statement as follows...but i think the operands will be in the reverse order...
SELECT stdaz plans
FROM pa2010
INTO (wa_emp_tab-no_of_hours_imb , wa_imb_hours_itab-plans)
WHERE pernr = wa_emp_tab-pernr
AND lgart = '9EXT' " Wage Type (salary)
AND begda => st1_date
AND endda <= en1_date
GROUP BY stdaz plans.
but appending the values to a range and using in your select will yield better performance..
if helpful, reward
Sathish. R
03-19-2007 9:36 AM
data : lastday like sy-datum,
firstday like sy-datum.
concatenate so_date(6) '01' into firstday.
CALL FUNCTION 'LAST_DAY_OF_MONTHS'
EXPORTING
DAY_IN = firstday
IMPORTING
LAST_DAY_OF_MONTH = lastday
EXCEPTIONS
DAY_IN_NO_DATE = 1
OTHERS = 2.
but i am not sure about your select qry what you want here?
SELECT stdaz plans
FROM pa2010
INTO (wa_emp_tab-no_of_hours_imb , wa_imb_hours_itab-plans)
WHERE pernr = wa_emp_tab-pernr
AND lgart = '9EXT' " Wage Type (salary)
AND begda between firstdate and lastday
AND endda between firstdate and lastday.
regards
shiba dutta