Date range validation

I have a requirement where i have to check date range in select option and if its more than 45days the I have to give an Informatory message and exit the programme , How can I do that ??
Urgent Plzz..

Hi,
  try this code...
TABLES: zpr_prog_item.
DATA: cnt TYPE i.
SELECT-OPTIONS date FOR zpr_prog_item-date_shoot.
CALL FUNCTION 'DAYS_BETWEEN_TWO_DATES'
  EXPORTING
    i_datum_bis                   = date-high
    i_datum_von                   = date-low
IMPORTING
   e_tage                        = cnt
EXCEPTIONS
   DAYS_METHOD_NOT_DEFINED       = 1
   OTHERS                        = 2.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
  IF cnt < 45.
    LEAVE TO LIST-PROCESSING.
    WRITE:/ date-low,
          / date-high,
          / cnt.
  ELSE.
    MESSAGE i000(zsam).
    LEAVE SCREEN.
  ENDIF.
regards,
Bhuvana.

Similar Messages

  • Date range validity evaluation in BRM table

    Lectori salutem, Gurus salutem,
    I'm using 7.3 sp03. I would like to achieve the following with BRM (bit simplified):
    a parameter, ABC, is passed to a ruleSetService, and needs to be evaluated.
    The table is as follows:
    ABC startDate endDate Value
    1 01-01-2011 31-12-2011 A
    1 01-01-2012 31-12-2012 B
    2 01-01-2011 31-12-2011 X
    4 01-01-2012 31-12-2012 Y
    When ABC-value '1' is passed to the ruleSetService in the table the first row needs to be selected. CurrentDate (24-11-2011) is in between 01-01-2011 and 31-12-2011, making this the valid row. The value that should be returned is A.
    Beginning of next year it should change to B.
    How should I set this up in BRM?
    Thanks in advance!
    Martijn.

    Hi Martijn,
    Appreciate that you've simplifiied the scenario... but do you have any idea how many of these entries you are likely to have in total as that may change the answer.
    You have a couple of choices that might work here...
    1. You could a decision table... to hold your values (i.e. ABC and date range as conditions, value as action) and use the rule that evaluates the decision table to pick up the current date for the comparison. e.g.  date conditions would be "greater than than 01-01-2011", "less than 31-12-2011", etc.
    2. Alternatively, if the plan is to have a simple end of year change over,  you could use Effectivities (in the Project Resources of the rules project) to determine which values  are selected and use a decision table or even just a rule script to determine the value.
    But the thing is... HOW you organise your rule is going to depend a lot on:
    a) How many entries in total do you expect
    b) Is there a nice neat cutover of all ABC values at the same time or do effective date ranges vary a lot between different ABC values
    c) Who's responsible for maintaining these and if multiiple people are responsible do you need to organise your rule to cater for that? E.g. Are different people responsible for different ABC entries
    Does that help at all?
    Regards,
    Jocelyn

  • Date Range valid check on BSP Application

    Hallo,
    i want to  display brochures with its validity date in BSP application.Can anybody help me. i was rejected because i posted my code here ,i cant post it again.
    regards

    hi,
    In which block  you want to keep the validation . In Layout of in Onevent processing block. ??
    <script for="sd" event=onchange type="text/javascript">
    var data = this.value;
    var date = data.split(".");
    if (data != ' ')
    var day = date[0];
    var month = date[1];
    var year = date[2];
    if ((day<1 || day >31) || (month<1 || month>12) ||(year.length != 4))
    alert("Please enter a valid  Date ( mm.dd.yyyy )");
    endif.
    hw come ur post  got reject ?
    Please specify whr u want to embed validation .

  • Dynamic Date range validation

    Hi all,
    I have 2 date fields in a page: Start Date, End Date. The Start Date should not be later than End Date.
    I don't know how to write a validation to control TWO fields. I cannot use the built-in ADF declarative validation at Entity Level, since I want to set the autoSubmit=true to do validation at realtime.
    What I have done is I created validator function for both fields, the function works fine except this:
    1. user input 1-1-2000 to Start Date, user input 1-1-1999 to End Date. the invalid dialog appears for end date
    2. user input 1-1-1990 to Start Date, but the End Date is still Invalid.
    Is there anyway to fix this problem?
    I am using Jdeveloper 11.1.1.2 with ADF BC.
    Regards,
    Samson Fu

    I found the solution for this, post here for anybody have the same problem.
    http://jdevadf.oracle.com/adf-richclient-demo/faces/feature/interfieldValidation.jspx
    Regards,
    Samson Fu

  • Date Range Validity periods for Addresses

    Hello,
    In the BP transaction when entering address details I cannot see a place to enter a validity period for the address even though in BUT020 there are database fields on this table to store a To and From date for and address.
    Does anyone know how to make these date field available for entry?
    Many thanks in advance.
    David

    Thanks.
    When I go to this in SPRO I can see the field 'BP Address: Time-Dependent Usages' for the role I need to change.
    However when I make this field 'optional' is still does not appear.
    If I select optional on some other fields e.g. 'Address-Indep.Communication Data: Mobile Telephone' this field appears.
    Is there anything else I need to do to make this field appear?
    Regards
    David

  • PO date(bedat) range validation

    i have to validate the PO delivery date range:
    and the scenario is given  below
    Please display a warning if no date range is specified or if the date range exceeds 31 calendar days. The warning should state u201Cno or large date range specified. This can result in long processing times. Do you want to proceed? u201CThe user should be given the option to abort and re-enter the selection criteria or continue with the execution of the report.
    Moderator message : Spec dumping not allowed.  Read forum rules before posting.  Thread locked.
    Edited by: Vinod Kumar on Jul 6, 2011 1:41 PM

    If you can share the form,then it will be easy to find out where the issue is..
    Steps to share a document..
    1. Go to URL http://Acrobat.com
    2. Create an account if you don't have one.
    3. Then login to the website.
    4. In top left corner you will see a button called Upload.
    5. Click on browse and select the file you want to upload.
    6. After Uploading, mouse over on the uploaded file. Click the down arrow button and choose Share document.
    7. Then you will be prompted a popup window at the lower left corner. Choose "Publish it" option.
    8. In the next pop up window choose "Copy Link" option.
    9. You can paste the link in the forum thread.
    Thanks
    Srini

  • Date wise Valid Customers

    Hi Experts,
    I have a customer master data object with move in date and move out date as attributes.
    Now I want a report for number of customers valid for each day of a specified user entry date range.
    Let say I have date in the object like below.
    cid              move-in-date           move-out-date
    1                   01 dec 2008           5 dec 2008
    2                   03 dec 2008           7 dec 2008
    Now in my report I need
    Date              valid customers.
    1st dec              1
    2nd dec              1
    3rd dec             2
    4th dec              2
    5th dec             2
    6th dec             1
    7th dec             1
    So how can I achieve this.
    Thanks in advance.

    Hi ,
    I dont think it is possible in reports.
    Try to create a extra field at infor provider itself and populate using abap code during loading itself.
    Construct report taking this field into consideration.
    Hope it helps,
    regards,
    anil

  • How to set a date range for date field ?

    Dear Experts,
    Scenario:
    I have a query in validating the date field in my BSP application. My application is for maintain infotype 0023 Other/Previous Employers online by employees in the company.
    As per our design we are maintaining the all employment details of the employee both ( with in the current company / previous employment outside the company) in the same infotype.
    Every employee will have a hiring date within the SAP HR system. We consider this date as the cutoff date between current and previous employment in our application. When the employee updating the details wia BSP page I need to check the following.
    Record inside current company: Validation that, the user should only able to enter BEGIN DATE (BEGDA)  greater than or equal HIRING DATE and END DATE(ENDDA) should be greater than FROM  DATE (BEGDA).
    Record outside current Company: Validation that, the user should only able to enter BEGIN DATE (BEGDA)  less than or equal HIRING DATE and END DATE (ENDDA) should be greater than FROM  DATE (BEGDA) and less than HIRING DATE.
    Technical Requirement:
    How to set a date range for date field, i.e. how we can limit the date range in a HTMLB date field? Can this it be achieved via standard functionality of HTMLB?
    Following is the code to describe date field in my application.
        <htmlb:inputField id= "ENDDA_NEW_IN"
                          type= "date"
                    doValidate= "TRUE"
                      showHelp= "TRUE"
                      disabled= "FALSE"
                         width= "183"
                         style= "cssTextAreadate"
                         value= "<%='99991231'%>"/>
    Thanks a lot in advance for your assistance and help.
    Cibinu2026
    Edited by: cibin kuruvilla on Nov 12, 2008 11:13 AM

    Hi,
    This functionality is known to be very important and is a key part of the next major release of the JRC planned for the first half of 2008.
    Regards,
    <p>Blair Wheadon</p>
    <p>Product Manager, Crystal Reports</p>

  • EasyDMS - search by date range for characteristics of type date

    Hi Folks,
    I have a characteristic of type date in the additional data of a DMS document. If I enter the date (for example validity date) as 08/31/2009 and search using cv04n and give a date range for the characteristic (i.e. 01/01/2009 - 12/31/2009), the search result will bring up the document.
    However, I cannot do this from the EasyDMS find function. I need to specify an exact date. This is not very helpful for user who need to find documents with a validity date between 01/01/2009 - 12/31/2009 for example. Is there a way users can search for date range in EasyDMS find function?
    Thanks,
    Lashan

    To search a date range with EasyDMS Client you have to set the registry key
    \HKEY_CURRENT_USER\Software\SAP\EasyDms\Generel\DateSearchPick to Value 0
    Then you can use the input field like in SAP-Gui. (01.01.2009-31.01.2009)
    If you set the value to 1 or the key is not defined you can only search for one specified date.
    If you don't find this key on your PC create it as dword.
    Maybe you must restart you PC for takeing effect.
    Hope this will help you.
    Regards Wolfgang

  • Date parameters for Date range

    Hi,
    I got a report with 2 parameters From Date and To Date and i have 2 columns items in the report absence start date and absence end date.
    i have to make sure that the date range satisfies all case's
    what is the best way that I can these validation rules in discoverer on these dates...?
    case's are something like this:
    1 (absence start date > from date; absence end date > to date)
    2 (absence start date > from date; absence end date < to date)
    3 (absence start date < from date; absence end date > to date)
    4 (absence start date > from date; absence end date < to date)
    Any help would be really appreciated.

    Using conditions in Discoverer is just like specifying a where clause in SQL with AND and OR. You should be able to use conditions for what is being described below.
    Are you not able to do that using conditions in your report ?

  • Query for aggregates for each date in a date range

    Hi,
    I want to generate a Trend report with a T-SQL proc, which needs following logic. 
    Input -
    Date Range say '10/10/12' to '20/10/12'  (Say to check the trend of Size of account in 20 days of Trend report)
    Account balance is captured randomly, (i mean not every day) 
    Table with date looks like this..
    --Account Balance Table
    CREATE TABLE AccBanalce (
    BranchId SMALLINT
    NOT NULL,
    AccId CHAR(9)
    NOT NULL,
    Amount DECIMAL(9,3)
    NOT NULL,
    SnapShotDate DATETIME
    NOT NULL 
    CONSTRAINT PK_AccBanalce PRIMARY KEY NONCLUSTERED (AccId, SnapShotDate) )
    GO
    Create CLUSTERED INDEX CIx_AccBanalce ON AccBanalce (SnapShotDate)
    GO
    --Date Range table
    CREATE TABLE DateRange ( StartDate DATETIME, EndDate DATETIME)
    GO
    --Date for the Account Balance Table
    INSERT INTO AccBanalce (BranchId, AccId, Amount, SnapShotDate)
    VALUES (1, 'C1-100',  10.4, '10/11/2010' ),
    (1, 'G1-110',  20.5, '10/11/2010' ),
    (2, 'GC-120',  23.7, '10/11/2010' ),
    (2, 'Gk-130',  78.9, '10/13/2010' ),
    (3, 'GH-150',  23.5, '10/14/2010'),
    (1, 'C1-100',  31.8, '10/16/2010' ),
    (1, 'G1-110',  54.8, '10/16/2010' ),
    (2, 'GC-120',  99.0, '10/16/2010' ),
    (3, 'Gk-130',  110.0, '10/16/2010' ),
    (3, 'G5-140',  102.8, '10/16/2010' ),
    (2, 'GC-120',  105,  '10/18/2010' ),
    (2, 'Gk-130',  56.7, '10/18/2010' ),
    (1, 'C1-100',  84.3, '10/18/2010' ),
    (1, 'G1-110',  75.2, '10/19/2010' ),
    (2, 'GC-120',  64.9, '10/20/2010' ),
    (3, 'GH-150',  84.0, '10/20/2010' ),
    (1, 'C1-100',  78.0, '10/20/2010' ),
    (1, 'G1-110',  89.5, '10/20/2010' )
    GO
    --Date for DateRange Table
    INSERT INTO DateRange (StartDate, EndDate) VALUES
    ('2010-10-11 00:00:00.000', '2010-10-11 23:59:59.997'),
    ('2010-10-12 00:00:00.000', '2010-10-12 23:59:59.997'),
    ('2010-10-13 00:00:00.000', '2010-10-13 23:59:59.997'),
    ('2010-10-14 00:00:00.000', '2010-10-14 23:59:59.997'),
    ('2010-10-15 00:00:00.000', '2010-10-15 23:59:59.997'),
    ('2010-10-16 00:00:00.000', '2010-10-16 23:59:59.997'),
    ('2010-10-17 00:00:00.000', '2010-10-17 23:59:59.997'),
    ('2010-10-18 00:00:00.000', '2010-10-18 23:59:59.997'),
    ('2010-10-19 00:00:00.000', '2010-10-19 23:59:59.997'),
    ('2010-10-20 00:00:00.000', '2010-10-20 23:59:59.997')
    GO
    Question - 
    I want TOTAL Balance of all Accounts in a Branch per each day between 10/11/2010 to 10/20/2010
    If the Snapshotdate (date) on which the account was not made an entery to AccBalance table, last available  balance to be considered for that account.
    like for account [C1-100] on 10/15/2010 the balance should be [10.4]
    --Group By Branch
    --Last valid Account balance to be considered.
    I know, this is long solution, but any one who is expert in T-SQL can help me in this solution.
    Thanks,
    Krishna

    Thanks Himanshu You almost solved my issue...but can you provide the final output as following...
    Actually you are aggregating the Amount, which is not required, as it is the total available in that account.
    But the missing pint is I need the SUM of all the accounts for each DAY in a BRANCH.
    The 3rd Result Query modified to get DAILY balances for each account as following...
    --*RESULT*
    SELECT a.AccId, a.StartDate, 
                        (SELECT TOP 1 b.Amount
                        FROM #InterimOutput b
                        WHERE b.AccId = a.AccId and b.Amount > 0
                        AND B.StartDate<=A.StartDate  ORDER BY B.StartDate DESC) as ToDateBal
    FROM   #InterimOutput a
    ORDER BY a.AccId
    go
    Now I need SUM of all Account Balances AT each BRANCH on DAILY basics. Can you help on that?
    Thanks again
    Krishna

  • Validate date range overlapping

    Hello all. I am trying to write a code which checks if the date does not overlap. For example, in my form I have id, from_date (mm/dd/yyyy), to_date (mm/dd/yyyy).. what i am trying to do is, the dates must not ovelap for particular id..
    Sample:
    id | from_date | to_date
    1 | 01/01/2012 | 01/31/2012
    1 | 04/01/2012 | 04/30/2012 --> this must be allowed
    2 | 01/15/2012 | 01/15/2012 --> this must also be allowed as id differs
    1 | 01/15/2012 | 01/15/2012 --> this must not be allowed because for id=1, 15th Jan is overalapping with the 1st row's date range (1st Jan to 31st Jan).
    PS : I dont want to use DB trigger, but rather write a code in Backing bean
    (I will let you know what code i tried so far, if needed)
    Edited by: 925715 on Apr 5, 2012 3:36 AM

    Assalaam Alaikum Jabr. thankss for the reply. For some reason it doesn't seem to work. I tried to create a validation method, at Entity level and also at Attribute level in Entity class of detail table. it is committing all the dates. Any ways, i will check again, if I am missing something here. And, must the validator be created at entity or attribute level??
    Edited by: 925715 on Apr 7, 2012 4:32 PM

  • 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.

  • What  are the usual date field validations

    Hi all,
    can you please tell me what  are the usual date field validations in selection Screen
    Thanks and regards ,
    Madhavi pilla

    Once you declare it as TYPE SY-DATUM, usually that is enough.  Sometimes we will also check that it is not less than '18000101' or greater than '99991231'.  Or if you have a specific date range that applies to your program you could check the field contents against that. I hope this helps.
    - April King

  • Question regarding usage of CRM pricing conditions using date ranges

    Hi,
    I wonder if someone has a suggestion regarding how to set up pricing conditions in CRM to accomplish the following scenario:
    For existing customers we want to “freeze” the product price for certain customers,
    but at the same time let other customers get another prize for the same product
    and period.
    (We have scenarios where the product price changes retroactively, years back in time, but only for those custoemrs that  fulfill a specific criteria at the time where the prize change was decided to take place..)
    We want the prize to be dependent on the customer status AND when this status was set
    (before a specific date), but there doesn’t seem to be a way to set up pricing
    conditions with date ranges (i e "customer status changed before YYYYMMDD
    renders prize X").
    Since we are talking about quite a lot of customers we do not want to add each and every
    one of them as “individual price items” in the pricing conditions tables.
    Does anyone have an idea regarding how to set this up?
    Thanks
    /Marika Wasserman

    Hi Marika,
    condition records have validity (FROM - TO). Let us assume you have a condition record for product A with 50 EUR per piece and this record is valid from 01.01.2014 until 31.12.2014.
    If you create CRM Sales Order having product A at 4.12.2014 and this date is used as pricing date for the conditon determination, then it will find this condition record with price 50 EUR per piece. This 50 EUR should be the froen price.
    Now how can you achieve that for the same CRM Sales Order another product price is determined for certain customer or a certain customer group?
    The idea is to pass an additional pricing attribute, e.g. customer group. Then you can create a new condition table with this field with the key fields product and customer group. In the access seqeunce first the new condition table is checked and if no record is found, then the second conditon table is checked as shown below:
    Access Sequence ABC
    Access 10: condition table with key fields product + customer group
    Access 20: condition table only key field product
    Instead of customer group you define also any other field. You create your own implementation of the BAdI  CRM_COND_COM_BADI that passes this field with a value to pricing.
    Best regards,
    Baris Yalcin

Maybe you are looking for