2007 Jul 23 10:35 AM
hi to all experts,
i have a requirement of listing purchase orders created only on Sunday and Saturday,please help me out im struggling with is report from 2 days. any sample code will help
2007 Jul 23 12:23 PM
Hi,
Try using this sample code. I think this will solve your problem.
Parameters : P_startdate type dats,
P_enddate type dats.
data: days_between type i.
ranges : r_days type dats.
days_between = p_startdate p_enddate.
do days_between times.
Call function module DATE_TO_DAY to see if the day is sat or sun.
Call function DATE_TO_DAY
Exporting
DATE = p_startdate
Importing
WEEKDAY = g_day.
*if the day is sat ir sun populate u'r ranges
If g_day = Saturday or g_day = Sunday.
R_days low = p_startdate.
R_days- high = .
R_days sign = I.
R_days option = EQ.
Append r_days.
Endif.
P_startdate = p_startdate + 1.
enddo.
Select * from vbak
into table lt_vbak
where erdat in r_days.
Reward points if it was useful.
Regards,
Hema.
hi to all experts,
i have a requirement of listing purchase orders created only on Sunday and Saturday,please help me out im struggling with is report from 2 days. any sample code will help
2007 Jul 23 10:42 AM
Hi,
use FM DATE_TO_DAY to know the date is sunday or sat.
Regards,
Omkar.
2007 Jul 23 10:53 AM
ok you should make yourself a ranges table.
in that you shall store all the valid dates.
Logic for that follows.
data: startdate type dats value '2211200'. "value is taken out of the blue
data: enddate type dats value '01062007'
data: days_between type i
days_between = startdate - enddate.
do days_between times.
"here add: if day = saturday or sunday, add day to your ranges table.
startdate = startdate + 1.
enddo.
Select * from vbak
into table lt_vbak
where erdat in your_ranges_table.
2007 Jul 23 10:56 AM
If you have date range as input, then get the day for the from date and add number of days till sat.
Consider your from date is 23.07.2007 means it Monday. Add 4 days it will give you Sat and next day is Sunday. From sunday onwards you can add 5 days so will get all Sat and Sun till to date. If the day is other then monday then add that number of days to get sat/sun.
2007 Jul 23 11:46 AM
Hi Abdul,
i think in your report there should be a selection-screen with option to enter date range. fetch all data from ekko and ekpo..in a internal table.
loop the internal table..in between pass erdat to DATE_TO_DAY FM, it will give you the day name..if it falls in saturday or sunday then proceed else delete the entry from int table.
i think it will solve your problem
regards,
Krish
2007 Jul 23 12:23 PM
Hi,
Try using this sample code. I think this will solve your problem.
Parameters : P_startdate type dats,
P_enddate type dats.
data: days_between type i.
ranges : r_days type dats.
days_between = p_startdate p_enddate.
do days_between times.
Call function module DATE_TO_DAY to see if the day is sat or sun.
Call function DATE_TO_DAY
Exporting
DATE = p_startdate
Importing
WEEKDAY = g_day.
*if the day is sat ir sun populate u'r ranges
If g_day = Saturday or g_day = Sunday.
R_days low = p_startdate.
R_days- high = .
R_days sign = I.
R_days option = EQ.
Append r_days.
Endif.
P_startdate = p_startdate + 1.
enddo.
Select * from vbak
into table lt_vbak
where erdat in r_days.
Reward points if it was useful.
Regards,
Hema.
2007 Jul 24 11:37 AM
u r answer helped me lot but im getting all the dates which falls in a range.that if condition is not working. plz help me
2007 Jul 24 11:41 AM
Hi,
Use as follows
Parameters : P_startdate type dats,
P_enddate type dats.
data: days_between type i.
ranges : r_days type dats.
days_between = p_startdate p_enddate.
do days_between times.
Call function module DATE_TO_DAY to see if the day is sat or sun.
Call function DATE_TO_DAY
Exporting
DATE = p_startdate
Importing
WEEKDAY = g_day.
*if the day is sat ir sun populate u'r ranges
<b>If g_day = Sat or g_day = Sunday.</b> Changed
R_days low = p_startdate.
R_days- high = .
R_days sign = I.
R_days option = EQ.
Append r_days.
Endif.
P_startdate = p_startdate + 1.
enddo.
Select * from vbak
into table lt_vbak
where erdat in r_days.
This works only in Enlgish logon
For better results I advise you to check the Function module DATE_TO_DAY and see the Text elements used for the Day texts.
And create in your program also similar text elements and compare using the text elements rather than hard coded stuff in one language.
Regards,
Sesh
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |