FM for checking valid date

Hello, is there a function module which will allow me to check whether a date is valid or not?

then DATE_CHECK_PLAUSIBILITY is right FM in such cases...
DATA : p_date(8) TYPE d VALUE '20081301'.
CALL FUNCTION 'DATE_CHECK_PLAUSIBILITY'
  EXPORTING
    date                      = p_date
  EXCEPTIONS
    plausibility_check_failed = 1
    OTHERS                    = 2.
IF sy-subrc NE 0.
  WRITE :/ 'Invalid date'.
ENDIF.

Similar Messages

  • Checking for a valid date

    I have a program that takes a user's input from three text boxes to make a date. I need to be able to check to make sure that the day of the month is correct. For example if they enter 02/35/02 an error message should apear. I am trying to use a Calendar object to do this with but it isn't working. Here is my code:
                    String strMonth = month.getText();
              int intMonth = Integer.parseInt(strMonth);
              if ( (intMonth < 1) || (intMonth > 12) ) {
                   invalidDate("month",month.getText());
                   month.requestFocus();
                   return;
              else if(strMonth.length() == 1) {
                   strMonth = "0" + strMonth;
              //Formating the year
              String strYear = year.getText();
              int intYear = Integer.parseInt(strYear);
              if (strYear.length() == 1) {
                   //User entered only one digit
                   strYear = "200" + strYear;
              else if(intYear > 40) {
                   //User entered a year greater than 40 so must be 19??
                   strYear = "19" + strYear;
              else {
                   //If neither of the above then must be 20??
                   strYear = "20" + strYear;
              intYear = Integer.parseInt(strYear);
    //-----------RIGHT HERE IS MY PROBLEM------------------------------          
              //Check the day field using the month and year
              String strDay = day.getText();
              int intDay = Integer.parseInt(strDay);
              Calendar cal = Calendar.getInstance();
              cal.clear();
              cal.set(Calendar.MONTH,intMonth);
              cal.set(Calendar.YEAR,intYear);
              cal.set(Calendar.DAY_OF_MONTH,intDay);
              int min = cal.getMinimum(Calendar.DATE);
              System.out.println("Min Day: " + min);
    //-------------The variable max is always 31----------------------          
                    int max = cal.getActualMaximum(Calendar.DATE);
              System.out.println("Max Day: " + max);
              if( (intDay < min) || (intDay > max) ) {
                   //User entered an invalid date
                   invalidDate("day",strDay);
                   day.requestFocus();
                   return;
              else {
                   //User entered a valid date
                   if(strDay.length() == 1) {
                        strDay = "0" + strDay;
              //Everything is correct
              requestedDate = strMonth + "/" + strDay + "/" + strYear;
              System.out.println("All correct: " + requestedDate);The problem is that when I do this the variable max that I use to get the maximum day in the month is always 31. I would appreciate any help.

    import java.util.*;
    import java.text.SimpleDateFormat;
    public class Test {
      public static void main(String args[]) {
        GregorianCalendar c = new GregorianCalendar();
        c.set(Calendar.MONTH, 9);
        c.set(Calendar.YEAR, 2002);
        c.set(Calendar.DATE, 40);
        SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy");
        System.out.println("Date is "+sdf.format(c.getTime()));
        GregorianCalendar tmp = new GregorianCalendar();
        tmp.setTime(c.getTime());
        tmp.add(Calendar.MONTH, 1);
        tmp.set(Calendar.DATE, 1);
        tmp.add(Calendar.DATE, -1);
        System.out.println("Days="+tmp.get(Calendar.DATE));
    }

  • Code  of ME_process_cust_Po BADI for checking item data?

    Hi all,
    While users are creating new PO in ME21N, I have to check the condition records for the Materials they entered.
    If the condition record is not maintained for the respective material The creation of PO while saving it , should not be  allowed  and a message should be displayed.
    Please mention  the respective method and code to do this?
    Thanks
    Vamshi.

    Hi ,
    this is the sample code for Item check, by using mm_messages_mac(include u can raise error msg based on the INFNR(info record) field.
      DATA: ls_mepoitem TYPE mepoitem,
            ls_customer TYPE mepo_badi_exampl,
            ls_tbsg     TYPE tbsg.
      INCLUDE mm_messages_mac. "useful macros for message handling
    here we check customers data*
      ls_mepoitem = im_item->get_data( ).
      IF ls_mepoitem-loekz EQ 'D'.
    a physical deletion of the item was carried out. therrefor we have to*
    delete customer data on the level of the item*
        ls_customer-ebeln = ls_mepoitem-ebeln.
        ls_customer-ebelp = ls_mepoitem-ebelp.
        CALL FUNCTION 'MEPOBADIEX_SET_DATA'
          EXPORTING
            im_data                    = ls_customer
            im_physical_delete_request = 'X'.
      ELSE.
    update/insert operation*
        CALL FUNCTION 'MEPOBADIEX_GET_DATA'
          EXPORTING
            im_ebeln = ls_mepoitem-ebeln
            im_ebelp = ls_mepoitem-ebelp
          IMPORTING
            ex_data  = ls_customer.
    check customers data*
    check field badi_bsgru. This should be carried out only for new items. Once the PO is posted the*
    field should no longer be changeable. This is done in Method FIELDSELECTION_ITEM.*
        IF im_item->is_persistent( ) EQ mmpur_no.
          IF ls_customer-badi_bsgru IS INITIAL.
    Place the cursor onto field badi_bsgru. The metafield was defined in BAdI ME_GUI_PO_CUST,*
    Method MAP_DYNPRO_FIELDS.*
            mmpur_metafield mmmfd_cust_01.
            mmpur_message_forced 'W' 'ME' '083' text-002 '' '' ''.
          ELSE.
    check whether the field is valid*
            *SELECT SINGLE * FROM tbsg INTO ls_tbsg WHERE bsgru EQ ls_customer-badi_bsgru.*
            IF NOT sy-subrc IS INITIAL.
              mmpur_metafield mmmfd_cust_01.
              mmpur_message_forced 'E' 'ME' '083' text-004 '' '' ''.
    invalidate the object*
              CALL METHOD im_item->invalidate( ).
            ENDIF.
          ENDIF.
        ENDIF.
    check field badi_afnam*
        IF ls_customer-badi_afnam IS INITIAL.
          mmpur_metafield mmmfd_cust_02.
          mmpur_message_forced 'W' 'ME' '083' text-003 '' '' ''.
        ENDIF.
      ENDIF.
    regards
    Prabhu

  • How to give the Fiscal year period in RSA3 for checking the data.

    Hi BW Experts, good morning.
      We have loaded the data monthlywise with selection parameters as Fiscal Year Period(FISCPER).
      While checking the data consistency in both R/3 and BI, the selection parameter which i have given  is in the format of         001.2005   
      I got the records in BI side.
      But if we give the same format In RSA3 in the Fiscal Year Period tab , we r getting 0 records.
      So kindly help me how to  enter the selection parameters for 1 month.
        Thanks
                  Anjali

    Hi sanyam ,
       Thanks for the help.
      I got it now.
      Thank you so much
      Bye
                   Regards
                         Anjali

  • User Exit for VA41 Validity Date

    Hi,
    I am giving order type in VA41 Tcode and then Clicking on 'Create with Reference' .Then a Pop Up is getting generated. In this i am giving Contract created with validity date lessthan today's date(in Contract Tab).For Example i created a Contract xxxxxx with 'valid to' 9.12.2008. When I am giving this contract and clicking on 'Copy' button a Warning message is getting generated 'The sales document is only valid until 09.12.2008'. Now i have to change this into Error message instead of Warning Message.
    i used User Exits mv45afzz,MV45AFZA,MV45AFZB. But the debugger is getting started only after Warning message got generated.Is there any User Exit for which debugger gets started when i give the Contract and then Click on 'Copy' button. Please Suggest.
    Thanks
    K Srinivas

    Hi,
    Create a file say breakpoint.txt file as follows:-
    [FUNCTION]
    Command=/H
    Title=Debugger
    Type=SystemCommand
    Once you come to the screen of 'Create with reference' where you are giving the contract, from  second session drag the above mentiuoned file to the session where you are running VA41, & drop it here. Now debugger has been activated. Proceed with debugging. This method you can use for any of the 'POP UPs'.
    I hope this helps,
    Regards
    Raju Chitale

  • FM for checking valid drive on PC

    Hi all,
    I am developing an interface.
    There is one file which is to be uplaoded in my code. I am doing some processing on that code and downloading that file on PC.
    User will enter the input & output file name. When user will enter the path I want o check for the drive. Means if user has only C & D drive on my PC & user has given F drive while giving the output file name then it should give error.
    Is there any FM or method available for this? I have tried with FM "PC_CHECK_PATH_WITH_DRIVE" but it is not giving me desired result.
    Please help.... Its urgent....
    Thanks in advance.
    Deepti

    Hi Deepti,
    1. file_not_found                  = 19
    2. sy-subrc = 19 if drive is wrong.
    3. It surely gives error (by value of sy-subrc <> 0)
       after the FM is called.
    4. try this code (just copy paste in new program)
    5. It  WILL GIVE ERROR
    6.
    REPORT abc.
    DATA : t001 LIKE TABLE OF t001 WITH HEADER LINE.
    SELECT * FROM t001 INTO TABLE t001.
    CALL FUNCTION 'GUI_DOWNLOAD'
      EXPORTING
      BIN_FILESIZE                    =
        filename                        = 'k:\abc.txt'
      FILETYPE                        = 'ASC'
      APPEND                          = ' '
      WRITE_FIELD_SEPARATOR           = ' '
      HEADER                          = '00'
      TRUNC_TRAILING_BLANKS           = ' '
      WRITE_LF                        = 'X'
      COL_SELECT                      = ' '
      COL_SELECT_MASK                 = ' '
      DAT_MODE                        = ' '
      CONFIRM_OVERWRITE               = ' '
      NO_AUTH_CHECK                   = ' '
      CODEPAGE                        = ' '
      IGNORE_CERR                     = ABAP_TRUE
      REPLACEMENT                     = '#'
      WRITE_BOM                       = ' '
      TRUNC_TRAILING_BLANKS_EOL       = 'X'
      WK1_N_FORMAT                    = ' '
      WK1_N_SIZE                      = ' '
      WK1_T_FORMAT                    = ' '
      WK1_T_SIZE                      = ' '
    IMPORTING
      FILELENGTH                      =
      TABLES
        data_tab                        = t001
      FIELDNAMES                      =
    EXCEPTIONS
       file_write_error                = 1
       no_batch                        = 2
       gui_refuse_filetransfer         = 3
       invalid_type                    = 4
       no_authority                    = 5
       unknown_error                   = 6
       header_not_allowed              = 7
       separator_not_allowed           = 8
       filesize_not_allowed            = 9
       header_too_long                 = 10
       dp_error_create                 = 11
       dp_error_send                   = 12
       dp_error_write                  = 13
       unknown_dp_error                = 14
       access_denied                   = 15
       dp_out_of_memory                = 16
       disk_full                       = 17
       dp_timeout                      = 18
       file_not_found                  = 19
       dataprovider_exception          = 20
       control_flush_error             = 21
       OTHERS                          = 22
    IF sy-subrc = '19'.
      WRITE :/ 'FILE NOT FOUND - '.
    ENDIF.
    regards,
    amit m.

  • User exit for checking Actual dates before TECO of WBS element

    Hi,
    Is there a user exit in PS we can use that checks to see if Actual dates have been entered on the WBS element before the WBS element is set to TECO?

    Hi,
    I am not sure on this as i havent checked it. You can explore and check if defining validations can serve  your purpose.
    Best Regards,
    Gokul

  • Business rules for check current date and session user

    MDS 2012
    Hi All! How to make validation business rules:
    1.  date < GETDATE()
    2.  current session user is UserName(), where UserName() - system function like in MS Analysis Services
    from Moscow with Love

    There is no way to create this with a Business Rule, you have to write a custom workflow or SQL nightly job or something to update your fields.
    Ok people start screaming.
    "solution" if you want to call it that. USE AT YOUR OWN RISK, try in dev first :)
    1. Create an Attribute / Column in your Entity and call it Today or something.
    2. Go to Business Rules and create a dummy rule where you are setting this attribute (unconditionally with no Condition)
         Today equals 1/1/2000 or something.
    3. Go to tblBRItem find this BR and etin ItemSQL  from N'1/1/2000' to GETDATE()
    now you have Todays Date field...
    OK NEVER MIND, I've tried it and it works, the problem is that tblBRItems gets updated via a stored proc and will overwrite your entry.
    One can modify the code there as well but I don't have time to play with it unfortunately, as at that time you have to pass some token in to identify some values as your own special commands ... Either way this becomes messy and not a way to go.

  • Field Level Validation - Date Mask

    Hi all
    I need some Java Script to validate a date mask in a field. Format must be:
    dd-mm-ccyy.
    Can anyone help me?
    Thanks

    Here is a copy of the script I set up to do validation.
    I not only wanted it to check for a valid date,
    but I wanted to store leading zeros, but not make the user type them in.
    One of the things you have to do is to set the format mask for the date to MM-DD-YYYY for each date field in your form.
    Here it is:
    var DayArray =new Array(31,28,31,30,31,30,31,31,30,31,30,31);
    var MonthArray =new Array("01","02","03","04","05","06","07","08","09","10","11","12");
    var firstDash = null;
    var lastDash = null;
    var inYear = null;
    var inMon = null;
    var inDay = null;
    var today = new Date();
    var curFullYear = today.getFullYear();
    var strYear = String(curFullYear);
    var thisCentury = strYear.slice(0,2);
    var thisYear = strYear.slice(2);
    var numThisYear = Number(thisYear);
    inDate = theElement.value;
    if (inDate.length == 0) return true;
    /* Check for a valid format. */
    var filter=/^[0-9]{1,2}-[0-9]{1,2}-[0-9]{2,4}$/;
    if (! filter.test(inDate))
    { alert("Please enter date in MM-DD-YY or MM-DD-YYYY format.");
    theElement.focus();
    theElement.select();
    return false;
    /* Pick off the indices (zero-based) of the two dashes. */
    firstDash = inDate.indexOf("-");
    lastDash = inDate.lastIndexOf("-");
    if ((firstDash == lastDash) &#0124; &#0124; (firstDash == -1) &#0124; &#0124; (lastDash == -1))
    alert("Please enter date using dashes (-), e.g. MM-DD-YY or MM-DD-YYYY.");
    theElement.focus();
    theElement.select();
    return false;
    /* Pick off the month and day (pad with leading zero, if necessary). */
    inMonth = inDate.slice(0,firstDash);
    if (inMonth.length == 1) inMonth = "0" + inMonth;
    inDay = inDate.slice(firstDash+1,lastDash);
    if (inDay.length == 1) inDay = "0" + inDay;
    /* Pick off the year. Filter ensures 2, 3, or 4 digit year. 4 is what we */
    /* want, so we only have to deal with 2 or 3 digit years. */
    inYear = inDate.slice(lastDash+1);
    /* If the user entered a two digit year, figure out which century to pad. */
    if (inYear.length == 2)
    /* Adding 5 years is still within the current century... */
    if ((numThisYear + 5) < 100)
    /* 00 to (current year + 5 years) should use the current */
    /* century; otherwise, use the previous century. */
    if (inYear > (numThisYear + 5))
    inYear = (thisCentury - 1) + inYear;
    else
    inYear = thisCentury + inYear;
    else
    /* Adding 5 years would rollover the century, use the current century */
    inYear = thisCentury + inYear;
    /* A 3 digit year is an error. */
    if (inYear.length == 3)
    alert("Please enter date with either a 2 digit or 4 digit year.");
    theElement.focus();
    theElement.select();
    return false;
    /* Check for a valid month. */
    var filter=/01|02|03|04|05|06|07|08|09|10|11|12/;
    if (! filter.test(inMonth))
    alert("Please enter a valid month.");
    theElement.focus();
    theElement.select();
    return false;
    /* Check for leap year. */
    N=Number(inYear);
    if ( ( N%4==0 && N%100 !=0 ) &#0124; &#0124; ( N%400==0 ) )
    DayArray[1]=29;
    /* Check for valid days for the month. */
    for(var ctr=0; ctr<=11; ctr++)
    if (MonthArray[ctr]==inMonth)
    if (inDay > DayArray[ctr] &#0124; &#0124; inDay <= 0)
    alert("Please enter a valid day.");
    theElement.focus();
    theElement.select();
    return false;
    /* Output the fixed up date. */
    theElement.value = inMonth + "-" + inDay + "-" + inYear;
    return true;
    Regards,
    Rene'

  • What are the tables used for ACR & Master data daemon job?

    Hi Experts,
    What are the tables used in the backend for ACR & Master data daemon jobs. I would like to see the details of CHANGERUNMONI or ACR/Hierarchy Change run.
    Kr,
    Praveen

    Hi Praveen,
    Have you tried these tables BALHDR, BALDAT and BALOBJT for checking master date daemon delta status. It may not give you complete details. but definitely helps.. If you find any more details please do let me know..
    Thanks,
    Bharath

  • FV60 and MIRO -duplicate invoice doent chk for diff inv dates

    In ecc 6.0 ,We use FV60 and MIRO  to enter all invoices. We have config (under MM) for duplicate invoice check against  "ref field" only. When we enter an invoice with the same ref field value, it gives error message as expected. However, when we change the date, the error message is gone and we are allowed to create the invoice and post the invoice.
    Pls help

    Hi,
    Check your config for duplicate invoices.  There is another check box for "Check Invoice Date", see if it is checked.  If yes, then remove it and the system should not allow you to post the same invoice with a different date.
    Cheers.

  • How can I set an validity date for a given vendor?

    Hello,
    we are currently trying to set a "validity date" for vendors.
    Basically, our vendors need to be audited, and are "accepted" for a period of time, beyond which we'd need to re-audit them.
    What we'd like the system to do is block use of the vendor if this date was exceeded.
    Anyone has an idea on the way to achieve this?
    PS: We know that there is a way to do this at the material level, we instead wish to manage it centrally for the vendor
    Tx

    Hello Nisha,
    before doing business with a new vendor for services, our QA group needs to go thru a serie of verifications. We check various things such as insurance, certification,...
    Once "approved", the vendor can be utilised by the plant for a certain period of time, after which a "re-audit" is necessary.
    What I'd like to implement is a field where the QA group would enter this date, after which the vendor would be automatically blocked for usage.
    This would then trigger the "re-audit" followed by the release from QA (who'd re-modify the date with the new one), and so on.
    The vendor is not necessarily used for supply chain. Sometimes, it could be for services , maintenance, or other.
    Tx for the ideas.

  • Maintain Validity Date for Documents

    Hi
    Any Idea how can we put and maintain Validity Dates for any Document uploaded in DMS Server.
    Validity Dates here means (Documents cannot be used if validty is over)
    I could not find any option in CV01*   T-Codes.
    Regards

    Dear Prasant,
    You can also do this solution also if you find it OK.
    1. Create a Class with "Validaty Date" as characteristics. Assign this Charac to class. Assign this class to doc Type. This charac should not be editable to any one except creator.
    2. Create a program with BAPI " Set Status" ( Check the name). which will run in background to check the validity date of Document. If the validity date is reached the BAPI will change the status to "S" as stated by Chritoph.
    This will help user to manually tracked which documents have exceded the validity date. You can also genegrate report and mail it to particular user that what documents have been set to Status "S".
    Hope I have provided a valid solution as I have tried similar kind of functionality with changing a characteristics with Date.
    With warm Regards
    Mangesh Pande

  • Unable to generate IDOCs in BD30 for BOMs because of Validity Date

    Hello everyone,
       I am having a unique issue with our Bills of Materials. After they are created and set to active, they have validity dates that go from 2001 to 9999. When I go to BD30 to distribute the BOM to the external systems I am getting the following error message:
    No bill of material exists on 08/25/2009 for 2557B27H02/FBLR/1/01
    Message no. BOM014
    Diagnosis
    You want to distribute BOM 2557B27H02/FBLR/1/01 via ALE. However, the BOM is invalid on 08/25/2009.
    System Response
    The system does not distribute the BOM.
    Procedure
    Check the BOM's validity.
    If you want to distribute all BOMs with the change status for another key date, enter another valid-from date on the initial screen.
    If you only want to distribute a certain BOM with the change status for another key date, enter another valid-from date or a change number on the selection screen.
    We get this for any BOM in this system.
    This is our QA environment and do not have this problem in our Development system. BD30 finds the BOM we specified but claims it is invalid on that date.
    We are trying to figure out if there is another status or approval step that I am missing here.
    SAP v4.7 level 19
    Thanks and points awarded for helpful answers!
    John

    Hi
    Enter a lower validity date like 8/25 2004 and try. If not check if there is any change management activated. Also check the ignore distribution lock. Please revert for further discussion
    Krishna

  • Source List validity dates for MRP only

    Hi.
    Is there a way to do the following:
    Set purchasing view "source list required" so that the material must be purchased from ANY of the sources on the source list...  AND...
    Setup the source list so that there are no overlaps, and MRP sources from consecutive contracts based on the source list validity dates.
    For example, 1/1/10 to 5/1/10 -> Contract A (mrp relevant);  5/2/10-10/1/10 -> Contract B (mrp relevant).  But on 5/3/10 I want to be able to manually change the requisition away from "B" and release against Contract A.  In other words, I want MRP to get the sourcing close to correct, but allow the user the ability to override the MRP sourcing, AND still ensure that the source the user picks is on the source list somewhere.
    When I try this now, the system generates "Source list not included in list despite source list requirement."  The source list checking seems to be done all the way at the validity period level.

    hi,
    I understood your concept. Please explain it  clearly so that why this message
    is appearing " Source list not included in list despite source list requirement"
    can be found out
    Regards
    G.Ganesh Kumar

Maybe you are looking for

  • Select Query in Crystal Report

    Dear all, I have a report to be developed in which i have to fire more than 2 select quires. I am adding this quires in "Add Command" window, it doesn't give any error but gives output of first query only. I have tried to use multiple commands in rep

  • The firefox browser page covers the entire screen including the time icon in the lower right hand corner.

    The browser page originally did not cover the entire page Also, I must place my cursor on the upper limit of the browser page to access the search and Firefox tool bar now.

  • Ways to Add Lines?

    The New York Times website uses lots of fine gray lines to separate content. What's the best way to put these into a site? Do they use CSS? Any tips or tricks to doing this? Thanks.

  • How To Edit Excel or Word Files Using iPhone?

    I am trying to do SIMPLE edits of Excel or Word files... in my emails I can view them, but not able to edit them... -Glenn

  • 30 to 24 sequence

    I have been working on a film: online footage is in HD 24p. offline are downconverts to 29.97 the project will go backto film from an uprezed HD on FCP. The project was not set up with cinema tools and was begun using sequence timelines ar 29.97. I h