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

help with report

Former Member
0 Likes
1,006

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

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
981

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

7 REPLIES 7
Read only

Former Member
0 Likes
981

Hi,

use FM DATE_TO_DAY to know the date is sunday or sat.

Regards,

Omkar.

Read only

Former Member
0 Likes
981

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.

Read only

Former Member
0 Likes
981

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.

Read only

Former Member
0 Likes
981

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

Read only

Former Member
0 Likes
982

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.

Read only

0 Likes
981

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

Read only

0 Likes
981

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