Application Development 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: 

Regarding the dates to retrieve the required records.

Former Member
0 Kudos
130

Hi,

In the selection screen, i have radiobuttons for reporting period like ALL, PAST, FUTURE, TODAY,OTHERKEYDATE ,e.tc.

My report should run for the date which i have selected on the selection screen.

For today, we can write the condition as

Begda < = sy-datum and enda > = sy-datum.

But i have to write in general for everydate which i selected.

I am writing report for OM. i am not using PCH LDB.

if i use LDB , i can write Begda < = pnp-enda and endda >= pnp-enda.

But iam not using the LDB PCH.

how to write query to retreive the required date.

1 ACCEPTED SOLUTION

Former Member
0 Kudos
58

Hi,

Resolving this problem u create to date type variable like v_bedda and v_endda.

If U select the ALL radio button then initialize these two variables as v_begda = '18000101' and v_endda = '19991231'.

If u select PAST radiio button then v_begda = '18000101' and v_endda = todays date (20080205).

If u select FUTURE radio button then v_begda = todays date(20080205) and v_endda = '19991231'.

If u select TODAY then v_begda = Todat date and v_endda = Today date.

If u are selecting other periods radio button then directly initialize selection screen begda and endda to v_begda and v_endda.

........

after initializing these two variables use thease variables in select statements......

Regards,

Ashok Kumar Reddy.N

3 REPLIES 3

amit_khare
Active Contributor
0 Kudos
58

Are those fields on screen are custom fields or standard screen from some logical database.

If standard then,

SELECT....

Begda <= pn-begda and

ENDDA >= pn-endda.

If custon then you need to check for INITIAL all the field ans write seperate SELECT query for each criteria.

Regards,

Amit

<REMOVED BY MODERATOR>

Edited by: Alvaro Tejada Galindo on Feb 5, 2008 4:32 PM

Former Member
0 Kudos
59

Hi,

Resolving this problem u create to date type variable like v_bedda and v_endda.

If U select the ALL radio button then initialize these two variables as v_begda = '18000101' and v_endda = '19991231'.

If u select PAST radiio button then v_begda = '18000101' and v_endda = todays date (20080205).

If u select FUTURE radio button then v_begda = todays date(20080205) and v_endda = '19991231'.

If u select TODAY then v_begda = Todat date and v_endda = Today date.

If u are selecting other periods radio button then directly initialize selection screen begda and endda to v_begda and v_endda.

........

after initializing these two variables use thease variables in select statements......

Regards,

Ashok Kumar Reddy.N

Former Member
0 Kudos
58

hi,

let us say your radio buttons have the name as follows:

P_ALL -> for all

P_TODAY -. for only today

P_PAST -. for all dates in past from today.(not including today)

P_FUTURE -> for all dates in FUTURE from today( not including today)

P_OTHERKEYDATE -> for any other date that user enters.

*Logic:

if P_ALL = 'X'.

  • code is as such the program runs for all records irrespective of dates.

elseif P_TODAY = 'X'.

p_date = sy-datum. " this p_date is a variable used to hold today's date.

  • now code it so that it runs only for the records having date = p_date.

elseif P_PAST = 'X'.

*write code to pick all the dates which are in past , I don't know what you have as begin and end dates and what they for, use the begin and end dates to calculate past dates and run the code only for those past dates.

elseif P_FUTURE = 'X'.

*do as done in past,for future dates.

else p_date = otherkeydate "hope this is entered by user somewhere on the screen.

*run the code for only that p_date.

endif.

<REMOVED BY MODERATOR>

deepti.

Edited by: Alvaro Tejada Galindo on Feb 5, 2008 4:54 PM