Date Range Selection
Dear friends,
How to select the record from BSEG table between Date range. Please give me the solution . Am also try to find the solution in SDN also.
select-options post_dt for bkpf-budat obligatory default sy-datum NO-EXTENSION.
select belnr budat from bkpf into corresponding fields of table it_head
where bukrs eq compcode
and gjahr eq year
and blart eq doctype
and budat in post_dt
order by belnr budat.
For this select query is working in perfect for single date only. But i want to select the date date range wise.
Thanks
Saravanan R
HI,
U can check the Select Quert by using IN s_option.
Like eg:--
Select * form Zemp where empno in s_empno.
Hope this example will help u...
here Zemp is a table...... empno is a field s_empno is a Select-option.
Thanks and rEgards
Suraj S Nair
Similar Messages
-
Date Range Selection in Query Templates
Hi,
Can someone please tell me how to use <b>Date Range Selection</b> Tab details in SQL Query and TAG Query (Using Examples).
Thanks in advance
Muzammil P.T>>>>>>>>>>
Re: Date Range Selection in Query Templates
Posted: Feb 15, 2007 6:43 AM in response to: Muzammil Ahamed Reply E-mail this post
Hi Muzammil,
In data range section you can have multiple options like setting start datetime and end datetime.. And you can set the shift (or) time period and also the format of the time periods.
Primarily we use the start date and end date querying to fetch data between two time labels. I can explain this one with example..
You have batch production table with columns Production Time, Batch Id, Production Qty. Then you want all the details between the 02/02/2007 to 05/02/2007.
Solution :
1.Map 02/02/2007 with Start date.
2.Map 05/02/2007 with end dare.
Now these two become the variables [SD] and [ED].
Now you have mentioned the date range, but you need to mention for which column these things to be applied. For that
3.In Query tab enter Production Time column name in Date column at the bottom.
Now you have written query like Select * from batch prodcution where production time > 02/02/2007 and production time < 05/02/2007.
4. Even those values you mapped (SD and ED) you can change from the front page through Java script.
Like wise you have so many other advantages also.
If you have any other specific doubt let me know.
Thanks,
Rajesh.
PS : Please ward points if answer is useful. <<<<<<<<
Message was edited by:
David Dreyer -
About Date Range Selection in Contributor Recognition Program- List
Hello SCN,
Happy that we have a classified date range selection like Year wise, Contest period wise and also with date range in the Top Contributors list. However earlier we had a luxury to see the point classified as "All Time Contribution". I personally feel to get back this option as well in the list.
Dear SDNers share your suggestion on this.
Thanks,
SaNv....Hi,
If you want the user to select the date directly rather than entering, you need not to have a dropdown menu in WAD. Directly go to the query which you have selected for the object in WAD, there create a variable with calendar. Put it mandatory, so that the user selection of the date will be mandatory. The variable will be automatically be available when you execute the template inn the browser.
Assign points if this helps u.
Regards,
Koundinya. -
Display of 2 rows of data for 2 different date range selection
Hi Folks,
I have a requirement as follows,
User has an option of selecting 2 Date Ranges
From and To Date and again From and To Date
The result should display 2 different rows of data with From and To Date range selection.
Eg:
12/09/20008 to 03/09/2009 10 20 30 40
23/10/2009 to 18/12/2010 40 20 10 30
Difference 30 0 20 10
% Change x y z q
Thanks for your input.
Regards,
KJYou will need to use union report, and you would have fours union's in this report.
Union - 1: Data from 1st Date Range
Union - 2: Data from 2nd Date Range
Union - 3: Variance Calculation
Union - 4: Percentage Variance Calculation.
If the date's are coming from the same field, use cast function to use the same column twice in your prompts. Apply filters on each union as needed.
Thanks. -
How to use 2 Dropdown box in webapplication for date range selection
Dear all,
I am working on a report that will show 2 drop down boxes. These should be used as a date range.
This works fine if I use 2 variables as a date range on 0CALYEAR. However I dont want the user to fill in the dates but selecting the dates with 2 drop down boxes.
I cannot manage to get this to work. I saw some comments about user exits in the forum but I cannot figure it out if there is an easier way.
Could you give me an idea of what to do?
Thanks a lot,
AndreasHi,
If you want the user to select the date directly rather than entering, you need not to have a dropdown menu in WAD. Directly go to the query which you have selected for the object in WAD, there create a variable with calendar. Put it mandatory, so that the user selection of the date will be mandatory. The variable will be automatically be available when you execute the template inn the browser.
Assign points if this helps u.
Regards,
Koundinya. -
Hello
i have a table with records
id number , start_date date , end_date date .
I want to select all ids that are with in an acceptable date range
ex. table data ( mm/dd/yyyy)
1 , 1/1/2008 , 1/4/2008
2. 1/3/2008 , 1/10/2008
3 1/12/2008 , 1/15/2008
4 1/4/2008 , 1/8/2008
5 1/5/2008 , 1/6/2008
i want to find all ids that the dates between 1/3/2008 and 1/4/2008
exists in their date range
acceptable record ids are 1 ,2 and 4
Thank youi want to find all ids that the dates between 1/3/2008 and 1/4/2008
select id from your_table
where start_date <= to_date('1/4/2008')
and end_date >= to_date('1/3/2008')Cheers, APC
Blog : http://radiofreetooting.blogspot.com/ -
Drop Down Box for Date Range Selection
I have multiple queries on the same worksheet with different variables for each. To simplify changing the one consistent variable, the date range, I have added a drop down box tied to all infoproviders in the query. This would work if I wanted to select a single date but I cannot determiine how to select a date range (01/2010 - 12/2010). Any ideas on how I might accomplish this? I am using Netweaver 7.1.
You can use two single-input variables: one for DATE FROM and the other for DATE TO and use them in query definition to restrict the date (restriction type: Range between DATE FROM and DATE TO).
Then you create two dropdown boxes, one for each variable.
Regards,
Dorota -
Date range selection from session/server variables - possible solution
I've recently been creating some reports who'se selection is based on the contents of a session variable, using this against a date field. Thought I'd share with everyone how I did it.
1/ Create a server/static variable called DATE_FORMAT who'se contents are 'dd/mm/yy' . Note, should include the single quotes.
2/ Create 2 session variables that represent the beginning/end date range for your selection you are after - in my case, it was the first & last date of the previous month, PREVIOUS_PERIOD_FROM and PREVIOUS_PERIOD_TO
3/ In the selection, add a filter on the date field in question, set the Operator as "is between".
4/ for each of the 2 valaues, select Add->SQL expression and enter:
EVALUATE('TO_DATE(%1,%2)',VALUEOF(NQ_SESSION."PREVIOUS_PERIOD_FROM"),VALUEOF("DATE_FORMAT"))
and
EVALUATE('TO_DATE(%1,%2)',VALUEOF(NQ_SESSION."PREVIOUS_PERIOD_TO"),VALUEOF("DATE_FORMAT"))HI,
U can check the Select Quert by using IN s_option.
Like eg:--
Select * form Zemp where empno in s_empno.
Hope this example will help u...
here Zemp is a table...... empno is a field s_empno is a Select-option.
Thanks and rEgards
Suraj S Nair -
Date range selection in abap code in infopackage
Hi!
I have a field called "OPEN_DATE".
When the infopackage is runned, I need the abap code to fint the current date, and from that, make a date range from the first day of current month to the last day of current month
Ex:
Current date = 12.12.2008
Abap code should extract 01.12.2008 - 31.12.2008
Thanks!Hi helge,
Data: l_idx like sy-tabix.
Data: date_low like sy-datum,
date_high like sy-datum.
Date_low = sy-datum.
date_low+6(2) = '01'.
CALL FUNCTION 'SLS_MISC_GET_LAST_DAY_OF_MONTH'
EXPORTING
DAY_IN = Date_low
IMPORTING
LAST_DAY_OF_MONTH = date_high
read table l_t_range with key
fieldname = 'OPEN_DATE'.
l_idx = sy-tabix.
Pass Range values to L_T_Range Table.
Move date_low to L_T_Range -Low.
Move date_high to L_T_Range -High.
L_T_Range -Sign = u2018Iu2019. *****(Here: I u2013 Include, E u2013 Exclude)
L_T_Range -Option = u2018BTu2019.****( Here: BT u2013 Between )
modify l_t_range index l_idx.
p_subrc = 0.
Regards, -
Date Range: Select which Qtr a date falls into
Hi All
I am looking for some code that takes a date passed into a variable and calculates which Quarter it is in.
My client uses Quarters:
Feb - Apr (Q1)
May - Jul (Q2)
Aug - Oct (Q3)
Nov - Jan (Q4)
So, if I pass a date of 21-Mar-2007 into the Variable, the code takes the date, calculates that the date is in Q1 and then returns the date of 200702 (the YEAR/ MONTH of the First Month in the Quarter) into the BW report.
I have searched the forums and can't find anything that would work, so you help is much appreciated.
DGHi Ajay
Thanks very much for your response.
I'm having a few difficulties getting the code to work in our environment, so was hoping you could help me tune it.
Input is Current Month
Output is First Month of Current Quarter
So, using this code, how can I pass the input date into the code?
(I'm sorry if this is obvious, I'm really new to SAP Development, so the answer may be and most probably is really obvious) -
Using function(s) to select date range in a computation.
Hello
Within my ApEx report, I would like to be able to have data returned from within a date range selected by the user. Under "Compute" there are lots of "Functions" (Least, Greatest, Last_Day, etc.) but so far I have not been able to find the right syntax for date range.
This seems so simple - any help appreciated.
Thanks
Paul S.I do not use APEX but is the BETWEEN operator available to you?
Normally to select a date range you just write code like
select ....
from table_t
where date_col between to_date(start_date,'format') and to_date(end_date,'format')
or
where date_col >= to_date(start_date,'format')
and date_col < to_date(end_date,'format') + 1
as this form eliminates worrying about the time component.
HTH -- Mark D Powell -- -
Date range stops working when I add record selection criteria
I have a simple report, using only nine fields, from four tables, plus two date parameter fields that I use to set a date range:
SELECT "Job"."Job", "Job_Operation"."Vendor", "Customer"."Customer", "Job"."Part_Number", "Delivery"."Promised_Date", "Job_Operation"."Status", "Job_Operation"."Sched_End", "Job_Operation"."Sched_Start", "Job_Operation"."Operation_Service"
FROM ("TECH"."dbo"."Delivery" "Delivery" INNER JOIN ("TECH"."dbo"."Job_Operation" "Job_Operation" INNER JOIN "TECH"."dbo"."Job" "Job" ON "Job_Operation"."Job"="Job"."Job") ON "Delivery"."Job"="Job"."Job") INNER JOIN "TECH"."dbo"."Customer" "Customer" ON "Job"."Customer"="Customer"."Customer"
WHERE (("Job_Operation"."Sched_End">={ts '2013-08-05 00:00:00'} AND "Job_Operation"."Sched_End"<{ts '2013-08-08 00:00:01'}) AND "Job_Operation"."Status"='O' OR "Job_Operation"."Status"='S' AND "Job_Operation"."Operation_Service"='150-170 SS' OR ("Job_Operation"."Operation_Service"='150-170 ST' OR "Job_Operation"."Operation_Service"='60-180' OR "Job_Operation"."Operation_Service"='180-200 SS' OR "Job_Operation"."Operation_Service"='180-200 ST' OR "Job_Operation"."Operation_Service"='200-220 ST' OR "Job_Operation"."Operation_Service"='F-1.1923'))
ORDER BY "Job"."Job"
When my record selection formula is
{Job_Operation.Sched_End} IN {?StartDate} TO {?EndDate}
AND
{Job_Operation.Status} = 'O' OR {Job_Operation.Status} = 'S'
the date range works.
However, when my record selection formula is
{Job_Operation.Sched_End} IN {?StartDate} TO {?EndDate}
AND
{Job_Operation.Status} = 'O' OR {Job_Operation.Status} = 'S'
AND
{Job_Operation.Operation_Service} = '150-170 SS' OR
{Job_Operation.Operation_Service} = '150-170 ST' OR
{Job_Operation.Operation_Service} = '60-180' OR
{Job_Operation.Operation_Service} = '180-200 SS' OR
{Job_Operation.Operation_Service} = '180-200 ST' OR
{Job_Operation.Operation_Service} = '200-220 ST' OR
{Job_Operation.Operation_Service} = 'F-1.1923'
the date range doesn't work. Instead, the report returns records with all kinds of {Job_Operation.Sched_End} dates.
What could be the reason?
Thanks,
MatteoHi Matteo,
Try this as the selection formula:
{Job_Operation.Sched_End} IN {?StartDate} TO {?EndDate}
AND
({Job_Operation.Status} = 'O' OR {Job_Operation.Status} = 'S')
AND
{Job_Operation.Operation_Service} = '150-170 SS' OR
{Job_Operation.Operation_Service} = '150-170 ST' OR
{Job_Operation.Operation_Service} = '60-180' OR
{Job_Operation.Operation_Service} = '180-200 SS' OR
{Job_Operation.Operation_Service} = '180-200 ST' OR
{Job_Operation.Operation_Service} = '200-220 ST' OR
{Job_Operation.Operation_Service} = 'F-1.1923'
-Abhilash -
Date range query problem in report
Hi all,
I have created a report based on query and i want to put date range selection but query giving problem.
If i am creating select list selection then it is working fine means it will display all records on the particular date.
But what i need is that user will enter date range as creation_date1,creation_date2 and query should return all the records between these date range. i want to pass it by creating items, i created two items and passing creation_date range to display all records but not displaying and if not passing date then should take null as default and display all records
Here is the query:
/* Formatted on 2006/12/10 20:01 (Formatter Plus v4.8.0) */
SELECT tsh."SR_HEADER_ID", tsh."SALES_DEPT_NUMBER", tsh."COUNTRY",
tsh."LOCAL_REPORT_NUMBER", tsh."ISSUE_DATE", tsh."SUBJECT",
tsh."MACHINE_SERIAL_NUMBER", tsh."MACHINE_TYPE", tsh."MACHINE_HOURS",
tsh."STATUS"
FROM "TRX_SR_HEADERS" tsh, "TRX_SR_PARTS" tsp
WHERE (tsh.status LIKE :p23_status_sp OR tsh.status IS NULL)
AND (tsh.machine_type LIKE :p23_machine_type_sp)
AND ( tsh.machine_serial_number LIKE
TO_CHAR (:p23_machine_serial_number_sp)
OR tsh.machine_serial_number IS NULL
AND ( TO_CHAR (tsh.failure_date, 'DD-MON-YY') LIKE
TO_CHAR (:p23_failure_date_sp)
OR TO_CHAR (tsh.failure_date, 'DD-MON-YY') IS NULL
AND ( TO_CHAR (tsh.creation_date, 'DD-MON-YY')
BETWEEN TO_CHAR (:p23_creation_date_sp)
AND TO_CHAR (:p23_creation_date_sp1)
OR TO_CHAR (tsh.creation_date, 'DD-MON-YY') IS NULL
AND (tsh.issue_date LIKE :p23_date_of_issue_sp OR tsh.issue_date IS NULL)
AND (tsh.country LIKE :p23_country_sp OR tsh.country IS NULL)
AND ( tsh.local_report_number LIKE TO_CHAR (:p23_local_rep_num_sp)
OR tsh.local_report_number IS NULL
AND ( tsp.part_number LIKE TO_CHAR (:p23_part_number_sp)
OR tsp.part_number IS NULL
AND tsh.machine_type IN (
SELECT DISTINCT machine_type
FROM trx_sales_dept_machine_list
WHERE sales_department_id IN (
SELECT DISTINCT sales_department_id
FROM trx_user_sales_department
WHERE UPPER (user_name) =
UPPER ('&APP_USER.'))
AND SYSDATE >= valid_from)
AND tsh.sr_header_id = tsp.sr_header_id
can any one tell me wat is wroung in this query.
Any other way to write this?
Thank You,
AmitHi User....
Here is some date range SQL that my teams uses with some success:
For date columns that do not contain NULL values, try this (note the TRUNC, it might help with your "today" problem).
The hard coded dates allow users to leave the FROM and TO dates blank and still get sensible results (ie a blank TO date field asks for all dates in the future.
AND TRUNC(DATE_IN_DATABASE)
BETWEEN
decode( :P1_DATE_FROM,
TO_DATE('01-JAN-1900'),
:P1_DATE_FROM)
AND
decode( :P1_DATE_TO,
TO_DATE('31-DEC-3000'),:
:P1_DATE_TO)
For date columns that contain NULL values, try this (a little bit trickier):
AND nvl(TRUNC(DATE_IN_DATABASE),
decode( :P1_DATE_FROM,
decode( :P1_DATE_TO,
TO_DATE('30-DEC-3000'),
NULL),
NULL)
BETWEEN
decode( :P1_DATE_FROM,
TO_DATE('01-JAN-1900'),
:P1_DATE_FROM)
AND
decode( :P1_DATE_TO,
TO_DATE('31-DEC-3000'),
:P1_DATE_TO)
Note the 30-DEC-3000 versus 31-DEC-3000. This trick returns the NULL dates when the FROM and TO date range items are both blank.
I hope this helps.
By the way, does anyone have a better way of doing this? The requirement is given a date column in a database and a FROM and a TO date item on a page,
find all of the dates in the database between the FROM and TO dates. If the FROM date is blank, assume the user want all dates in the past (excluding NULL dates). If the TO date is blank, assume that the user wants all of the dates in the future (excluding NULL dates). If both FROM and TO dates are blank, return all of the dates in the databse (including NULL dates).
Cheers,
Patrick -
POSTING DATE RANGE INCLUDED IN CUSTOMER RECEIVABLE AGEING REPORT PLD
Dear All,
Please can you tell me how to print the posting date range selected in the parameter selection for Customer Receivable Ageing Report PLD.
Thanks
GaryDear Rahul,
I know that but it is really painful to develop the whole report in crystal where it is available in SAP itself. Imagine just for one requirement i will have to build the whole report in crystal. I think SAP should give flexibility to change the hard coded reports.
Regards,
Gary -
Passing the Date range within the query
Hi ,
In my query , I have two date characteristic, and while doing the selection I have to do selection on only one date field.
This selection is a date range selection , So I have used a selection variable for this.
Can anyone please let me know if it is possible to pass the selection range to other variable. Is it possible to use Customer exit to pass the complete range.
Thanks
AltairHi,
You can do it in the user exit.And that is the only approach to transfer the values of one variable to other variable .
Search this forum for the code. you will find lot of postings.
With rgds,
Anil Kumar Sharma .P
Maybe you are looking for
-
How to use the Pull List in Discrete Scenario?
Hi Gurus, I am using pull list MF60 in REM. How to use the Pull List for creating material reservations in Discrete Scenario also? Anyone used this Pull list in discrete, pl share. How is helpful in discrete scenario? Srini
-
Permission error in opening word 7file in acrobat pro
I can create a pdf from within word 7 but can't open the file from within acrobat pro 9. When I sent the document in they said it wasn't run through distiller. When I open distiller and open the file I get a non-standard error, content flushed, no
-
Possible bug in x64 Remote Management firewall rule
Updated to ZCM11 over the weekend and am now running some tests on some test machines with the new ZAA. The problem I'm seeing is I'm unable to remote control Win7 Pro x64 running ZAA11. I looked into the problem and the Win7 firewall is blocking the
-
I'm very new to Netweaver, java and JSP, so please forgive me for what is hopefully a very simple question. I've created a simple JSP page that needs 2 external JAR files to run. <%@ page import="org.apache.commons.codec.binary.Base64" %> <%@ page im
-
i searched around this board but couldn't find my answer ... i am currently comtemplating FCE and am curious to know the extent of the effects ... i would like to take videos that are shot normally and in post-production make them look like they were