Restrict Date Range

Hi All,
    I have a select-option for Date.I need to restrict dates within a month??
How can i do that??

Hi ,
Same problem i also faced , so you will follow below code you will get the solution definately .
SELECT-OPTIONS : S_CALP   FOR RFPDO1-SZISABRZ NO-EXTENSION obligatory , "date
DATA:
      v_text        TYPE STRING,
      v_from_month  TYPE STRING,
      v_to_month    TYPE STRING,
      V_LEAP TYPE I .     "leap year variable
From/To date validation
  CLEAR : v_days .
  CALL FUNCTION 'FIMA_DAYS_AND_MONTHS_AND_YEARS'
    EXPORTING
      I_DATE_FROM = CALC_PERIOD_FROM  "date low
      I_DATE_TO   = CALC_PERIOD_TO  "date high
    IMPORTING
      E_DAYS      = v_days.
From/To date validation
  clear : v_text , v_to_month , V_YEAR ,V_LEAP.
  v_text = CALC_PERIOD_FROM .
  v_from_month = v_text+4(2).
  clear : v_text .
  v_text = CALC_PERIOD_TO .
  v_to_month   = v_text+4(2).
  V_YEAR = v_text+0(4).
IF NOT V_YEAR IS INITIAL .   "logic for leap year .
  V_LEAP = V_YEAR MOD 4 .
ENDIF .
****logic for  months validation
  IF NOT v_from_month = v_to_month .
      RETURN-MESSAGE = 'From/To Month should be same !'.
      APPEND RETURN.
      EXIT.
ENDIF .
  IF ( v_to_month = '01' OR
       v_to_month = '03' OR
       v_to_month = '05' OR
       v_to_month = '07' OR
       v_to_month = '08' OR
       v_to_month = '10' OR
       v_to_month = '12' ) .
    IF NOT v_days EQ 30 .
      RETURN-MESSAGE = ' Please Enter Valid Date !'.
      APPEND RETURN.
      EXIT.
    ENDIF .
  ELSEIF  ( v_to_month = '04' OR
            v_to_month = '06' OR
            v_to_month = '09' OR
            v_to_month = '11' ) .
    IF NOT v_days EQ 29 .
      RETURN-MESSAGE = 'Please Enter Valid Date !'.
      APPEND RETURN.
      EXIT.
    ENDIF .
  ELSEIF v_to_month = '02' .
    IF V_LEAP = 0 .
      IF NOT v_days EQ 28 .
        RETURN-MESSAGE = 'Please Enter Valid Date !'.
        APPEND RETURN.
        EXIT.
      ENDIF .
    ELSE .
      IF NOT v_days EQ 27 .
        RETURN-MESSAGE = 'Please Enter Valid Date!'.
        APPEND RETURN.
        EXIT.
      ENDIF .
    ENDIF .
  ENDIF .
Regards ,
Nilesh Jain .

Similar Messages

  • Restrict date range to be entered

    G'day
    I have a table called guest that allows them to be "checked in" in a hotel for example.
    The table was built as:
    CREATE TABLE GUEST
       (     ROOM_NUMBER VARCHAR2(2),
         DATE_ARRIVAL DATE NOT NULL,
         DATE_DEPARTURE DATE NOT NULL,
         NUM_ADULTS INTEGER,
         NUM_CHILDREN INTEGER,
         GUEST_NAME VARCHAR2(60),
         ADDRESS VARCHAR2(40),
         LICENSE_PLATE VARCHAR2(10),
               CONSTRAINT LICENSEPLATE_UN UNIQUE (LICENSE_PLATE),
               CONSTRAINT GUEST_ARRIVALDATE_CHK CHECK (DATE_ARRIVAL <= DATE_DEPARTURE), 
         CONSTRAINT GUEST_ROOM_FK FOREIGN KEY (ROOM_NUMBER)
         REFERENCES ROOM (ROOM_NUMBER));I'd like to add another check constraint to ensure that if a room has alredy been allocated to another guest :date arrival (10-May-06) to date departure (15-May-06) cannot be given to another guest within that date range.
    Some dumb data to be tested
    INSERT INTO Guest VALUES('R1','10-MAY-06','15-MAY-06',1,1,'Tom','London','AH343');
    INSERT INTO Guest VALUES('R1','14-MAY-06','17-MAY-06',2,0,'John','Canada','AF343');Thanx

    There was rather elegant solution discussed on AskTom. I do not remenber details, but it goes something like this:
    CRETATE MATERIALIZED VIEW MV AS
    SELECT G1.ROOM_NUMBER
    ,G1.DATE_ARRIVAL
    ,G1.DATE_DEPARTURE
    ,G2.DATE_ARRIVAL DATE
    ,G2.DATE_DEPARTURE
    FROM GUEST G1, GUEST G2
    WHERE G1.ROOM_NUMBER = G2.ROOM_NUMBER
    AND G1.DATE_ARRIVAL < G2.DATE_DEPARTURE
    AND G2.DATE_ARRIVAL < G1.DATE_DEPARTURE
    REFRESH ON COMMIT
    And then set some kind of restriction on the view that prohibits it from having any rows.
    BTW trigger proposal would not work because of "table is mutating" error.
    Checks on app level would require row locks (SELECT FOR UPDATE), otherwise sooner or later you will end up with several guys in the same room:)

  • Date Range Parameter's Restriction

    Could you someone please tell me how BO restricts date range parameter when the users tries to run a query?  Often times, users simultaneously try to get several years of data dumped into a single query.  Some users even forget to enforce the date range, which causes the query to try to get the data from the beginning of time. 
    How do we as a BO developer create some sort of date range restriction so that it can prevent users from overloading a query?  If the users want to get several years of data, he/she has to run a query in batches instead of doing it all at once.
    I hope there is a way that we can create a custom informational error message for each report to prevent users from trying to query too many months or years of data.  Some reports may hit small and well-indexed tables that allow large date range queries.  But, some reports query against large and poorly indexed tables, which can potentially cause adverse effect on performance without date range restriction. 
    Any thoughts or advices on how to implement such things (if possible).  I am also afraid that the answer will be "currently not doable".  If so, any ideas if the next version of BO will allow such functionality, or if it is at least in the plan at all?  Thank you so much for your insight and sharing.  Have a great day!

    Dear Amr,
    Thanks so much for your quick reply!  The field I want to create a restriction on is called RESULT_DT_TM.  When I saw the "where" section of the field, I just don't see how I can apply my START_DT_TM and END_DT_TM parameters on this field so that START_DT_TM and END_DT_TM cannot be more than 365 days apart.  If my query does not use parameters called START_DT_TM and END_DT_TM, this "where" section will not be valid? 
    I don't think the solution has to be on the field itself but rather on the parameter START_DT_TM and END_DT_TM.  What I want is that as long as START_DT_TM and END_DT_TM are more than 365 days apart, it does not matter what field these parameters are running against. The screen would then display something saying "your date range parameters for this report must be within 365 days.  Please revise your date range on query".
    Sorry, I am PL/SQL report programmer, and not familiar with what BO can do.  So, is there anyway that can make my dream come true?  Thanks a bunch again, Amr.

  • How to write a routine in infopack to restrict a date range !!!!

    Hi
    I want to load the data for a speicific date range ,i.e , i want to load the data between created on some date range which is not in between the same range for changed on...so i want to restrict that date range for changed on....Please le tme know the routine logic to restrict a date range....
    regards...

    How to ... Write Infopackage selection Routine
    1.Create an Infopackage 2. Go to selections tab and choose Type: 6 u2013 ABAP Routine.You can see following available options(F4 Help).
    3. Give disruption, and hit enter, now you will move to following screen. 4. Write Code between begin of Routine and End of Routine.
    5. See below sample code to select date range from Previous 6 days to Current date.
    6. L_T_Range table is of Type structure RSSDLRANGE.
    a. RSSDLRANGE contains SIGN, OPTION, LOW, HIGH
    We need to populate these fields to pass range dynamically.
    Sample Code:
    ***$$ begin of routine - insert your code only below this line -
    Data: l_idx like sy-tabix.
    Data: date_low like sy-datum.
    Date_low = sy-datum u2013 6.u201D(To get 6 days back).
    read table l_t_range with key
    fieldname = 'CRDAT'.
    l_idx = sy-tabix.
    Pass Range values to L_T_Range Table.
    Move date_low to L_T_Range -Low.
    Move sy-datum 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.
    **$$ end of routine - insert your code only before this line -
    7. Syntax check and Save.
    Hope it Helps
    Srini

  • Restrict Query Data based on Date range and Users

    Hi All,
    I have a few web reports that I need do restrict data based on Users.
    In all the queries i have an infoobject 0CALDAY, and  a User Entry range variable on it. Because of performance issues  I need to restrict the range of dates a User can see. Typically most of users could go to a max date range of 1 month back. But some others would need the ability to see data for much bigger range of dates.
    Pls suggest how should i go about with this. Should I have to enforce this at Variable level(user exit).... but then i might have to maintain a table for the users.. Is there any other way of doing it.
    thanks
    Raj

    Any thoughts ?

  • Support date range and as of date in Universe

    Hi,
    I have some questions on Universe design best practices. Can you please help ?
    We are using BO4 SP7 and UDT for universe design.
    Little bit on our schema: snow flake schema with multiple fact tables. Most of our table are 'Pure Type 6' dimension tables in which start date and end date are used to track historical data.  We also have date dimension table. We want to support both 'As of date' and custom 'date range' type reporting.
    Out typical use cases are like
    1. All items As of date
    2. All items between dates etc.
    How can we model it in the Universe ?
    1. We can not join every dimension with date_d dimension. So we have decided to put default conditions at Folder level. Our typical date conditions as below.
    date_d.end_full_date_utc  between  diminetion1_d.start_date AND diminetion1_d.end_date
    But problem is, table condition are not always applied. If we have A, B and C folders and if I create report by using objects from A and C then non of the condition applied to B appears in the query. This is problem for us.
    2. Other approach we thought is to define start and end prompt and define a restriction condition  for each and every table.
          diminetion1_d.start_date > [start_date_prompt] AND diminetion1_d.end_date < [end_date_prompt]
    We thought it will be too munch work as we have more than 150 tables and also 2 prompts will always appear, even of as of date, which may not look good.
    3. Is there a way apply to apply these date conditions at the individual table level so that they will appear in Query when ever the table is involved in the join path ?
    3. What is the best way to handle this kind of requirements, please suggest ?
    Thanks

    Hi,
    I have some questions on Universe design best practices. Can you please help ?
    We are using BO4 SP7 and UDT for universe design.
    Little bit on our schema: snow flake schema with multiple fact tables. Most of our table are 'Pure Type 6' dimension tables in which start date and end date are used to track historical data.  We also have date dimension table. We want to support both 'As of date' and custom 'date range' type reporting.
    Out typical use cases are like
    1. All items As of date
    2. All items between dates etc.
    How can we model it in the Universe ?
    1. We can not join every dimension with date_d dimension. So we have decided to put default conditions at Folder level. Our typical date conditions as below.
    date_d.end_full_date_utc  between  diminetion1_d.start_date AND diminetion1_d.end_date
    But problem is, table condition are not always applied. If we have A, B and C folders and if I create report by using objects from A and C then non of the condition applied to B appears in the query. This is problem for us.
    2. Other approach we thought is to define start and end prompt and define a restriction condition  for each and every table.
          diminetion1_d.start_date > [start_date_prompt] AND diminetion1_d.end_date < [end_date_prompt]
    We thought it will be too munch work as we have more than 150 tables and also 2 prompts will always appear, even of as of date, which may not look good.
    3. Is there a way apply to apply these date conditions at the individual table level so that they will appear in Query when ever the table is involved in the join path ?
    3. What is the best way to handle this kind of requirements, please suggest ?
    Thanks

  • Restricting data entry to a particular language in the form

    Hi,
    I created a multilingual form in which all the fields of the form are in a particular language . Now am trying to restrict data entry in the form to that language at the client side only . Say if it is a form in french, can we restrict the data entry to french only .  The approach i was trying to implement was adding a script against the change event of all data fields and see if the characters lie in the range of  the language unicode character set . But have not been successful in it yet . Can anybody help me find some way or provide any sample for it ?
    Thanks

    Hello, I'm German
    Probably you can restrict the characters used for text entry, so for example ü is allowed in the German form but not in French.
    But you will NEVER be able to restrict the users staying only writing French in French forms 100%.
    1) You sometimes, not often, do encounter letters that are not typical for the language. (Though it can appear in any kind of word, it's quite regular for names.)
    2) Let's say I fill the French form. I encounter a problem when I type in the word "Müller". This word wouldn't be French at all. The text will be delted and probably given an error message. Well... I learn out of this error message. Next time I'll type Mueller. ^^
    (I knew several pages were people were restricted to talk English by forbidding letters that were not used in English very often... That didn't stop us violating that rule. The only error that really bugged us wasn't the restriction in not using letters that don't exist in English but the "please don't swear or insult so." error that kept appearing for ex. when we used the German word for "that" (= "dass"). They just didn't like the last 3 letters.)
    3) Many countries have the same or include other countries unicodes. For example English could be written in the German form or in the French form.
    4) You can't get out the syslanguage as far as I know. This would be a great hint which language the person is using.
    5) I don't think you can use the spellcheck in any way... great violation against spellchecking could also be a hint for another language.
    I know a quite big internetcommunity which did try to accomplish the same as you do. After about 2 years and a lot of experiments they stopped their efforts and were content by popping up the random error-messages warning that you don't have to insult, just like those other communities mentioned above. ^^ (Though they tried to restrict the insulting parts to the language used that didn't work out. Too many people knew how to insult in other languages ;D or which words were similar to insults.)
    People just never do what they are supposed to do and are quite nasty finding workarounds...
    My advice to you would be:
    Don't make the effort.
    Sorry for not being able to provide you with a solution, but the opposite.
    Lisa

  • Date range for key date in hierarchy

    Dear Friends,
    Is there a work around for single key date restriction for time dependent hierarchy.Bcos i can only select one key date in teh report for my hierarchy so that it will take that hierarchy which falls in this date and display the result accordingly.
    But is there a way to select the date range for key date so that more than one hierarchy can be used to display my report accrding to the time range.
    Say,i have 4 hierarchies (time dependent) like v1,v2,v3,v4 and v5 for jan 08,feb 08,mar 08,apr 08 & may 08 respectively.
    In my report,i want to display the result for the time interval say mar to May.
    So my report should diplay the result according to the 3 different hierarchies for the time period i.e.v3,v4&v5.
    How do i acheive this.
    Thanks.
    ragu

    Hi
    I think we may do with the Char with text with replecement path.
    take time char as Calmonth and set the offet value as -1 and -2 and design the report and use the hierarchies in that query.
    Am not surt it willwork but better to try with this.

  • Sample code in Update Rule to restrict data selection?

    We used to restrict data selection in InfoPackage data selection, e.g., for company code range when loading data from a source system (e.g. EBP which is similar to R3), but somehow the company code range we set in InfoPackage data selection not working and we found actually it occurs on the source system side when running RSA3 on EBP side and input the company code range in RSA3 selection section, but still it extracts data beyond the company code range.  We don't understand why EBP data selection doesn't work, then we consider in update rule on BW to set the company code range.  We know in update rule, we can select Start Routine, formula, or routine to set the company code range.  But we would be appreciated if experts here can recommend which one is the most efficient to load data fast for data load performance reason and would be appreicated if you can let us know the sample code!
    Thanks in advance!

    hi Hari,
    I copy the whole code of the start routine below:
    PROGRAM UPDATE_ROUTINE.
    $$ begin of global - insert your declaration only below this line  -
    TABLES: ...
    Includes to update generic objects
    INCLUDE rsbctgn_top .
    INCLUDE rsbctgn_update_rules .
    INCLUDE rsbctbbp_generic_objects.
      The following section is prepared for you if you compound
      the business partner 0BPARTNER with the
      Source System 0BBP_SYS_BP or if you compound the organizational
      Unit 0ORGUNIT with the source System 0BBP_SYS_BP
    TYPE-POOLS: RRSV.
    Data: L_HLP_CHAVL_CMP       TYPE RSCHAVL.
    DATA:
           L_S_DEP       TYPE RRSV_S_DEP,
           L_T_DEP       TYPE RRSV_T_DEP.
      End of compound
    DATA: l_s_errorlog        TYPE rssm_s_errorlog_int,
          l_hlp_chavl         TYPE rschavl.
    $$ end of global - insert your declaration only before this line   -
    The follow definition is new in the BW3.x
    TYPES:
      BEGIN OF DATA_PACKAGE_STRUCTURE.
         INCLUDE STRUCTURE /BIC/CS0BBP_CONF_TD_1.
    TYPES:
         RECNO   LIKE sy-tabix,
      END OF DATA_PACKAGE_STRUCTURE.
    DATA:
      DATA_PACKAGE TYPE STANDARD TABLE OF DATA_PACKAGE_STRUCTURE
           WITH HEADER LINE
           WITH NON-UNIQUE DEFAULT KEY INITIAL SIZE 0.
    FORM startup
      TABLES   MONITOR STRUCTURE RSMONITOR "user defined monitoring
               MONITOR_RECNO STRUCTURE RSMONITORS " monitoring with record n
               DATA_PACKAGE STRUCTURE DATA_PACKAGE
      USING    RECORD_ALL LIKE SY-TABIX
               SOURCE_SYSTEM LIKE RSUPDSIMULH-LOGSYS
      CHANGING ABORT LIKE SY-SUBRC. "set ABORT <> 0 to cancel update
    $$ begin of routine - insert your code only below this line        -
    fill the internal tables "MONITOR" and/or "MONITOR_RECNO",
    to make monitor entries
    delete data_package where 0comp_code < 'X300' OR 0comp_code > 'X6ZZ'.
    if abort is not equal zero, the update process will be canceled
      ABORT = 0.
    $$ end of routine - insert your code only before this line         -
    ENDFORM.

  • Regarding date ranges in search criteria in oracle forms

    I am using employee number,name, person type, and date ranges as search criteria in custom form.
    when I enter employee number, hit the find button, I am getting the exact info in the result block.
    Result block contains
    employee name,personid,emp numb,org,start_date.
    Similarly when I enter employee number,dept, I am getting correct values.
    My question here is, when I enter date range. Iam unable to filter data.
    When i enter START_DATE between nvl(:BLOCKNAME.START_DATE,'01-JAN-1901') and nvl(:BLOCKNAME.END_DATE,'31-DEC-4712') at where clause in the result block. I got data for the date range also.
    if I give condition in the where clause, results are taking so much time when i search with employee name,number,dept,person type.
    If i query with date, persormance is good.
    Do u any know,how to prevent START_DATE between nvl(:BLOCKNAME.START_DATE,'01-JAN-1901') and nvl(:BLOCKNAME.END_DATE,'31-DEC-4712') when we search with employee name,number,dept,person type.

    Initailly Ididnt given any code in the where clause of the result block. I got data in the result block when i search with employee name,number,person type,dept etc except date range.
    If i give date range, irrespective of the date, getting all the data.
    after that i added code to the where clause of the result block. Now i am getting data for everything.
    like, when i query with employee name,number,even date range also.
    My question here, performance.
    when I query with date range, data is coming in expected time in the result block.
    when i query with dept, taking much time since date range logic exist in the where clause of the result block.
    I need to restrict the where clause only to the data ranges. Where clause should not necessary for employee number,name,person type dept search criteria
    Tahnks for your reply

  • F4 help:Restrict Value Range

    Hello Experts,
    I want to a search help for one field such that when user click on F4 help , it will again pop- up with one  screen, in which I need to have 2- 4 fields to Restrict the values then user enter some values here then F4 help will appaer.
    Like in standard tables mseg-lifnr F4 help Restrict Value Range screen , but i require only one tab
    Plz suggest
    Aastha

    Hello,
    Use the following piece of code.
    Parameter : p_value type ......
      TYPES : BEGIN OF y_value,
                      value TYPE text6,
                     END OF y_value.
      DATA : t_value TYPE STANDARD TABLE OF y_value.
      DATA: t_return TYPE STANDARD TABLE OF ddshretval.
    Fill table t_value with the values which  u require in the F4 help.
    CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
        EXPORTING
          retfield         = 't_value-value' 
          dynpprog     = sy-repid
          dynpnr         = sy-dynnr
          dynprofield   = 'p_email'     
    TABLES
          value_tab       = t_value
          return_tab      = i_return
        EXCEPTIONS
          parameter_error = 1
          no_values_found = 2
          OTHERS          = 3.

  • Changing date range in Report...

    Hi all,
    in report i have to change date range ..it is presently 1.1.2006 to 31.12.2006. i need to change year to 2007....
    can anyone please suggest me how to do that?

    Hi,
    In query Designer,select your date Char. expand u find Char. Variables.
    Select your Char. Varaible(the variable which is used to restrict the Values). right click ->edit,where u can change defalut date values or make it as blank.

  • 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

  • Ical searches with specific date range

    We post the people who are to work at specific events in the notes field of ical. Is there a way to search for these peoples names on the web via ical.php within a specific date range? No matter what date I have set to look at on the calendar the search grabs everything in the past. I only want future events that this person is associated with. Thanks for helping if you can. Jake

    Hi,
    You want to run the report on specific date without 0CALDAY?. Without 0CALDAY you can't restrict the report for specific day. So you must insert 0CALDAY in report and then use Offsets or implement code in CMOD.
    Thanks
    Reddy

  • Issue with displaying QM control chart for specific date range

    Dear All
    In our chemical mfg organisation, we just implemented SAP QM solution and things are working fine. I have implemented control  chart functionalities as below:
    SPC Criteria in Inspection Plan: Task List Charateristics / Material (0020)
    Sampling Procedure: Fixed Sample / SPC Inspection (without inspection point)
    We use process orders to get the inspection lots for products (material) and record results for the MICs and UD the inspection lots.
    Currently all our Control Chart have status 1 (created) and we have not moved any of those charts to status 3 and 5 yet.
    Using QGC1 when user trying to run control chart for any particular material in the plant and for a specific date range, report showing all the charts for that material with different MICs as expected. Though the result is NOT restricted to the selection dates either against "Lot Created On" or " Insp. Start Date" ( may be due to SPC criteria????) , its always showing all the result for any particular MIC for that material starting from go live till today.
    How to restrict the dispaly of result on the chart for any particular MIC against the Material / Plant within a specific date range ?
    Looking forward for your response.
    Best Regards
    SK

    Hi,
    1. Even though when i give the Created on, and to date the system is displaying the report which is prior to the created on date.
    2. Similarly the report data is different when the field is maximum no of Hits is given. for example when i giving this field as 10, 20, 30, etc the report is showing only 10 line items. if i enter 50, 60 etc it is showing the list for half i given.
    Note that system is having more than 1000 line items to display..
    Regards,
    R. Loganathan

Maybe you are looking for