FM or Way to validate Date format. The date is from TEXT File

Dear All,
I need to validate a date field whether it is in proper format.
The field is coming from TEXT file to Internal table by using FM GUI_UPLOAD.
Can any one give me the FM name or guide me how to do that?
Definitely points will be given for correct solution.
Thanks & Regards,
Neeraj

try the function module 'DATE_CHECK_PLAUSIBILITY'
  call function 'DATE_CHECK_PLAUSIBILITY'
       exporting
            date                      = '23.09.2007'
       exceptions
            plausibility_check_failed = 1
            others                    = 2.
  if sy-subrc <> 0.
    write:/ 'Please verify the date'.
    exit.
  endif.

Similar Messages

  • How to format the spaces in a text file using bat file scripting

    Currently the records in my text file are like this:
    100239 0000015.00 
    QRP
    I want them to be like this:
    100266 0000015.00 QRP
    There should be 6 spaces before the first column and 8 spaces after that. There should be 1 space between the second and third columns.
    Generally this file contains approx 1000 records.
    Any help is highly appreciated.
    Thank you.

    So far it's like this:
    for /f "skip=2 delims=*" %%a in (C:\Bonus_File_Export.txt) do (
    echo %%a >>C:\newfile.txt    
    xcopy C:\newfile.txt C:\Bonus_File_Export.txt /y
    del C:\newfile.txt /f /q
    I've to format a text file generated by the tool Microstrategy and it feed it to another system in a specific format. Ihave removed the headers with the above script but was unable to remove the spaces between those columns.
    You can use this code as a basis for your script:
    @echo off
    set Line=
    if exist d:\temp\newfile.txt del d:\temp\newfile.txt
    for /F "skip=2 tokens=1-2" %%a in (d:\temp\test.txt) do call :Sub %%a %%b
    goto :eof
    :Sub
    if not "%2"=="" (
      set Line=      %1        %2
    ) else (
      echo %Line% %1>>d:\temp\newfile.txt
    It works provided that your input file uses this format:
    Header line
    Header line
    100239 0000015.00  
    QRP
    100240 0000016.00  
    QRR
    100241 0000017.00  
    QRS
    100242 0000018.00  
    QRT
    100243 0000019.00  
    QRU
    100244 0000020.00  
    QRV

  • Data transfer from text file to internal table

    Hi, i am uploading data from a text file to an internal table itab.
    one of the field in the text file is in the format of p(7,2).
    while uploading , this is not not getting uploaded correctly,
    for ex instead of uploading 00008.00 in the itab, it gives a strange value of 30303030382>3.03. how to correct this?
    pls help

    Hello Rahul,
    Do the following:
    types: begin of ty_upload,
             string type string,
           end of ty_upload.
    types: begin of ty_fields,
             text1(20),
             wert      type p decimals 2,
             text2(20),
           end of ty_fields.
    data: it_upload type table of ty_upload,
          it_fields type table of ty_fields,
          wa_upload type ty_upload,
          wa_fields type ty_fields.
    CALL FUNCTION 'GUI_UPLOAD'
      EXPORTING
        filename                      = 'C:\aa_upload.txt'
       FILETYPE                      = 'ASC'
    IMPORTING
      FILELENGTH                    =
      HEADER                        =
      tables
        data_tab                      = it_upload
    EXCEPTIONS
      FILE_OPEN_ERROR               = 1
    Populate the internal table it_fields accordingly in a loop run, e.g.
    loop at it_upload into wa_upload.
      wa_fields-text1 = wa_upload-string(20).
      wa_fields-wert  = wa_upload-string+20(10).
      wa_fields-text2 = wa_upload-string+30.
      append wa_fields to it_fields.
    endloop.
    When your offsets are set correctly, there shouldn't be any problem.
    Regards,
    Heinz

  • Data read from text file(notepad) not enterd into  particular field

    Hi frends, I have used function "F4_FILENAME" and "GUI_UPLOAD" to upload a text file in notepad on my desktop to an internal table in SAP.after that i used the folowing code line  to copy data from one table to other:
    " insert tab2 from table itab accepting duplicate keys. "
    But my problem is that in tab2 i have total 5 fields.In notepad file i have written following two words:
    achal
    mehra
    now when i copy the data from itab to tab2 , it shows word "achal" in the field 1 of 1st row and "mehra" in field 1 of 2nd row only.
    what i want is to store "a" in field1 "c" in field2 and so on in row 1.
    similarly "m" in the second row and field1.
    PLZ guide me.I am new to ABAP.

    thnx frend but dear ur code has syntax error.Actually I am new to ABAP. I am using following code as a part of my program :
    CALL FUNCTION 'GUI_UPLOAD'
    EXPORTING
       FILENAME = d_file
       FILETYPE =  'ASC'
       HAS_FIELD_SEPARATOR = ''
       HEADER_LENGTH = 0
       READ_BY_LINE = 'X'
       DAT_MODE = ' '
         TABLES
         DATA_TAB = itab
         LOOP AT gt_file2 INTO lwa.
         EXCEPTIONS
           FILE_OPEN_ERROR = 1
           FILE_READ_ERROR = 2
           NO_BATCH = 3
           GUI_REFUSE_FILETRANSFER = 4
           INVALID_TYPE = 5
           NO_AUTHORITY = 6
           UNKNOWN_ERROR = 7
           BAD_DATA_FORMAT = 8
           HEADER_NOT_ALLOWED =9
           SEPARATOR_NOT_ALLOWED = 10
           HEADER_TOO_LONG = 11
           UNKNOWN_DP_ERROR = 12
           ACCESS_DENIED = 13
           DP_OUT_OF_MEMORY = 14
           DISK_FULL = 15
           DP_TIMEOUT = 16
           OTHERS = 17.
          IF SY-SUBRC <> 0.
                    ENDIF.
          loop at itab.
            Write:/ ITAB.
            endloop.
    insert zlfa4 from table itab .
    plz guide me where i shud use ur code and plz write the exact syntax for me if u can.

  • Saving data retrieved from text file to JDBC table

    Hi,
    I would like to save data, loaded from a text file to a dataset, into an existing JDBC table.
    The documentation I found on this subject is very brief, and no matter how I tried, I couldn't succeed.
    I would appreciate any help.
    Thank you in advance

    Hi there,
    Here is an example of reading a String and a date from a text file. Once you have what you need in the Strings (or whatever) it should be easy to insert them into and SQL statement. Let me know if you need an example of this as well and I'll post it in the morning. Right now I'm off to bed :o)
    Cheers
    Mark
    import java.io.*;
    import java.util.*;
    import java.text.*;
    public class WriteTest {
    public static void main(String [] arg) throws Exception {          
       Date today = new Date();          
       String name = "";          
       SimpleDateFormat formatter = new SimpleDateFormat("ddMMyyyy");          
       File myfile = new File("hello.txt");               
       // how to input     
       BufferedReader in = new BufferedReader(new FileReader(myfile));          
       String name="",
       date="";          
       boolean eof = false;          
       do {
          name = in.readLine();               
          date = in.readLine();               
          if(!(eof = (name==null || date==null)))                    
          System.out.println(name+" "+formatter.parse(date));
       while(!eof);     
    }

  • Pick the login credentials from text file

    I have written a login code in on-logon trigger. Currently the login credentials are hard coded in it. I want to pick them from properties file (text file). How can i do that?

    This solution is too easy.
    Try Single Sign On if it's possible in your environment. Create an Oracle Internet Directory with the informations needed and run your form against it.
    That's the most secure way you can implement. Don't do it hardcoded or use selfwritten encryptings.
    Gerd

  • HT3775 Is the Codec listed adjacent to the file format the Codec used with that file format?

    Is the Codec listed adjacent to the file format the Codec used with that file format?

    Is the Codec listed adjacent to the file format the Codec used with that file format?

  • How do I save a mutlitcolumn data to a text file?

    I am trying to save a multicolumn data to a text file without using Report Generation VIs. Here is the detail scenario...
    I have data in the following format.
    Time Voltage
    1 2
    2 3
    3 6 ...
    and
    Power
    1
    and
    Peaks
    x-axis y-axis
    Peak1 1 4
    Peak2 5 11
    If I have such data, how would I put them in a columnar format with their title and labels in a text file.
    Any example VIs would be nice to see.
    Thanks.

    Here is one solution, hope it helps. I would like to see this done using clusters and less shift arrays, I'm sure there are a few ways to do this with less wires but i guess that's what sub vi's are for...
    Attachments:
    data_to_col..vi ‏98 KB

  • CO-PA load data from text file

    Hello
    At present, in our company, we load data from Excel files to CO-PA. Is there any way to load those data to CO-PA from text files ?
    I will be grateful for any suggestions.

    You can create a structure using KEFA, assign the Value fields in KEFB and then use KEFC to upload data against that structure.
    You have various file format options, but I don't think Excel is one of them... you have have to save the file as txt and upload.
    Play around with those transactions and come back if you need additional help.
    Cheers.

  • Write data to multiple text files after specific size

    Hello,
    I wrote a code that contineously writes data to  a text file. The problem is I am running this VI for long time and therefore this text file is being bigger in size e.g. more than 10MB. I want to split writing data in this text file after max 1MB size. Can anyone help ????
    thanks in advance.

    CMW.. wrote:
    You could use the "File/Directory Info Function" in the Advanced File VIs and Function palette to check the size. If the file is too big. close it and create a new one.
    I would use the Get File Position since this won't cause Windows to have to do so much.  Assuming you are just writing and not setting the file position manually, this will return the size of the file in bytes (file position will always be at the end of the file).
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • How to store the contents of a text file directly in to a clob field

    Hi All,
    Could anyone help me to store the contents of a text file (*.txt,*.xml etc)directly in to a clob field.
    Thanks in advance
    Jayaram.

    One way is to use sqlloader. Three files are used. A control file, an xml data file, and a file with the path of the xml data file. Here's the control file. It reads load.file, which is the file with the path of the xml data file. It names the path ext_path, and inserts the xml into field xml_field.
    CONTENTS OF CONTROL FILE:
    load DATA
    INFILE 'load.file'
    APPEND
    INTO TABLE xml_table
    ( ext_path FILLER CHAR(13),
    "XML_FIELD" LOBFILE(ext_fname) TERMINATED BY EOF
    CONTENTS OF FILE LOAD.FILE:
    /tmp/load.dat
    The xml is in the file /tmp/load.dat.
    null

  • Using a "Scheduled Task" on a cisco controller to output data to a text file

    Can someone tell me if there is a way to run a Cron Job, RBA, or some other automated process on an 8510?  The idea would be to run the job every 5mins, and output the data to a text file.  Is this possible?

    In your script - you might be able to capture the error by putting your code inside a try/catch block. Something like:
    try {
    # do stuff
    } catch {
    $error.message | out-file c:\temp\script.txt
    G. Samuel Hays, MCT, MCSE 2012, MCITP: Enterprise Admin
    Blog:gsamuelhays.blogspot.com
    twitter:twitter.com/gsamuelhays

  • Write Text Data Array to text file

    Greetings all. I hope someone can help me as I am really under the gun. The attached vi shows the basics of what I am trying to do. I have already written a vi that takes the Cal Data Array and prints it out in a nicely formatted report. My problem is that the powers that be also want the data saved to a generic text file that can be copied and printed out anywhere they like. As such, I need to save the data to a generic text file in column format such that it will all fit on one page in landscape mode. There are a total of 12 columns of data. I have been trying to create something that would format each column to a specific length instead of them all being the same. No luck so far. Basically, I need columns 1,2,3,8 and 12 to be length of 5. The rest a length of 9. I have tried to place the formatting part in a for loop with the formatting in a case, but it does not appear to work. I really need this quick so if anyone has any ideas, please help. As always, I really appreciate the assistance.
    Thanks,
    Frank
    Attachments:
    Write Cal Data to Text File.vi ‏21 KB

    pincpanter's is a good solution. Beat me to it while I was away building an example. Similiar approach using two for loops and case statement. Here is my suggestion anyway....
    cheers
    David
    Message Edited by David Crawford on 11-23-2005 09:37 AM
    Attachments:
    Write Text Data Array to text file.vi ‏31 KB

  • How To Re-Input More Data To A Text File?

    I was wondering if anyone could tell me how to re-input more data into a text file? I don't want to over-write the text file, but just add more data to it. The current code i have is:
    import java.util.Scanner;
    import java.io.*;
    class trialanderror002 {     
    public static void main(String args[]){     
         Scanner input = new Scanner(System.in);
         String str;
    FileOutputStream out;
    PrintStream p;
    try{
         out = new FileOutputStream("c:\\products.txt");
         p = new PrintStream(out);
         System.out.println("Please insert text to be written to file...");
         str = input.next();
         p.println (str);
         p.close();
    catch (Exception e){
         System.err.println ("Error writing to file");
    Basically, after each time the program is ran, i'd like to insert another line of data into products.txt.
    Is there a way for me to loop the program too and not remove the data from the text file?
    thanx...

    just one more question...
    i've figured out the code to retrieve the text file and print it to screen...but how do i go about only printing parts of my text file?
    So supposing my text file has 5 lines of data/text etc, how would i make it print the first line?...or the second line?...or the third....etc etc...
    the current code i now have is:
    package Assignment1;
    import java.util.Scanner;
    import java.io.*;
    class trialanderror002 {     
    public static void main(String args[]){     
         Scanner input = new Scanner(System.in);
         String str;
    FileOutputStream out;
    PrintStream p;
    try{
         out = new FileOutputStream("c:\\trial.txt", true);
         p = new PrintStream(out);
         System.out.println("Please insert text to be written to file...");
         str = input.next();
         p.println (str);
         p.close();
    catch (Exception e){
         System.err.println ("Error writing to file");
              try {
              FileReader file = new
              FileReader("c:\\trial.txt");
              BufferedReader buff = new
              BufferedReader(file);
              boolean eof = false;
              while (!eof){
                   String line = buff.readLine();
                   if (line == null)
                        eof = true;
                   else
                        System.out.println(line);
              buff.close();
              }catch (IOException e){
                   System.out.println("Error -- " + e.toString());
    }

  • Data loading from flat file to cube using bw3.5

    Hi Experts,
                       Kindly give  me the detailed steps with screens  about Data loading from flat file to cube using bw3.5
           ...............Please

    Hi ,
    Procedure
    You are in the Data Warehousing Workbench in the DataSource tree.
           1.      Select the application components in which you want to create the DataSource and choose Create DataSource.
           2.      On the next screen, enter a technical name for the DataSource, select the type of DataSource and choose Copy.
    The DataSource maintenance screen appears.
           3.      Go to the General tab page.
                                a.      Enter descriptions for the DataSource (short, medium, long).
                                b.      As required, specify whether the DataSource builds an initial non-cumulative and can return duplicate data records within a request.
                                c.      Specify whether you want to generate the PSA for the DataSource in the character format. If the PSA is not typed it is not generated in a typed structure but is generated with character-like fields of type CHAR only.
    Use this option if conversion during loading causes problems, for example, because there is no appropriate conversion routine, or if the source cannot guarantee that data is loaded with the correct data type.
    In this case, after you have activated the DataSource you can load data into the PSA and correct it there.
           4.      Go to the Extraction tab page.
                                a.      Define the delta process for the DataSource.
                                b.      Specify whether you want the DataSource to support direct access to data.
                                c.      Real-time data acquisition is not supported for data transfer from files.
                                d.      Select the adapter for the data transfer. You can load text files or binary files from your local work station or from the application server.
    Text-type files only contain characters that can be displayed and read as text. CSV and ASCII files are examples of text files. For CSV files you have to specify a character that separates the individual field values. In BI, you have to specify this separator character and an escape character which specifies this character as a component of the value if required. After specifying these characters, you have to use them in the file. ASCII files contain data in a specified length. The defined field length in the file must be the same as the assigned field in BI.
    Binary files contain data in the form of Bytes. A file of this type can contain any type of Byte value, including Bytes that cannot be displayed or read as text. In this case, the field values in the file have to be the same as the internal format of the assigned field in BI.
    Choose Properties if you want to display the general adapter properties.
                                e.      Select the path to the file that you want to load or enter the name of the file directly, for example C:/Daten/US/Kosten97.csv.
    You can also create a routine that determines the name of your file. If you do not create a routine to determine the name of the file, the system reads the file name directly from the File Name field.
                                  f.      Depending on the adapter and the file to be loaded, make further settings.
    ■       For binary files:
    Specify the character record settings for the data that you want to transfer.
    ■       Text-type files:
    Specify how many rows in your file are header rows and can therefore be ignored when the data is transferred.
    Specify the character record settings for the data that you want to transfer.
    For ASCII files:
    If you are loading data from an ASCII file, the data is requested with a fixed data record length.
    For CSV files:
    If you are loading data from an Excel CSV file, specify the data separator and the escape character.
    Specify the separator that your file uses to divide the fields in the Data Separator field.
    If the data separator character is a part of the value, the file indicates this by enclosing the value in particular start and end characters. Enter these start and end characters in the Escape Charactersfield.
    You chose the; character as the data separator. However, your file contains the value 12;45 for a field. If you set u201C as the escape character, the value in the file must be u201C12;45u201D so that 12;45 is loaded into BI. The complete value that you want to transfer has to be enclosed by the escape characters.
    If the escape characters do not enclose the value but are used within the value, the system interprets the escape characters as a normal part of the value. If you have specified u201C as the escape character, the value 12u201D45 is transferred as 12u201D45 and 12u201D45u201D is transferred as 12u201D45u201D.
    In a text editor (for example, Notepad) check the data separator and the escape character currently being used in the file. These depend on the country version of the file you used.
    Note that if you do not specify an escape character, the space character is interpreted as the escape character. We recommend that you use a different character as the escape character.
    If you select the Hex indicator, you can specify the data separator and the escape character in hexadecimal format. When you enter a character for the data separator and the escape character, these are displayed as hexadecimal code after the entries have been checked. A two character entry for a data separator or an escape sign is always interpreted as a hexadecimal entry.
                                g.      Make the settings for the number format (thousand separator and character used to represent a decimal point), as required.
                                h.      Make the settings for currency conversion, as required.
                                  i.      Make any further settings that are dependent on your selection, as required.
           5.      Go to the Proposal tab page.
    This tab page is only relevant for CSV files. For files in different formats, define the field list on the Fields tab page.
    Here you create a proposal for the field list of the DataSource based on the sample data from your CSV file.
                                a.      Specify the number of data records that you want to load and choose Upload Sample Data.
    The data is displayed in the upper area of the tab page in the format of your file.
    The system displays the proposal for the field list in the lower area of the tab page.
                                b.      In the table of proposed fields, use Copy to Field List to select the fields you want to copy to the field list of the DataSource. All fields are selected by default.
           6.      Go to the Fields tab page.
    Here you edit the fields that you transferred to the field list of the DataSource from the Proposal tab page. If you did not transfer the field list from a proposal, you can define the fields of the DataSource here.
                                a.      To define a field, choose Insert Row and specify a field name.
                                b.      Under Transfer, specify the decision-relevant DataSource fields that you want to be available for extraction and transferred to BI.
                                c.      Instead of generating a proposal for the field list, you can enter InfoObjects to define the fields of the DataSource. Under Template InfoObject, specify InfoObjects for the fields in BI. This allows you to transfer the technical properties of the InfoObjects into the DataSource field.
    Entering InfoObjects here does not equate to assigning them to DataSource fields. Assignments are made in the transformation. When you define the transformation, the system proposes the InfoObjects you entered here as InfoObjects that you might want to assign to a field.
                                d.      Change the data type of the field if required.
                                e.      Specify the key fields of the DataSource.
    These fields are generated as a secondary index in the PSA. This is important in ensuring good performance for data transfer process selections, in particular with semantic grouping.
                                  f.      Specify whether lowercase is supported.
                                g.      Specify whether the source provides the data in the internal or external format.
                                h.      If you choose the external format, ensure that the output length of the field (external length) is correct. Change the entries, as required.
                                  i.      If required, specify a conversion routine that converts data from an external format into an internal format.
                                  j.      Select the fields that you want to be able to set selection criteria for when scheduling a data request using an InfoPackage. Data for this type of field is transferred in accordance with the selection criteria specified in the InfoPackage.
                                k.      Choose the selection options (such as EQ, BT) that you want to be available for selection in the InfoPackage.
                                  l.      Under Field Type, specify whether the data to be selected is language-dependent or time-dependent, as required.
           7.      Check, save and activate the DataSource.
           8.      Go to the Preview tab page.
    If you select Read Preview Data, the number of data records you specified in your field selection is displayed in a preview.
    This function allows you to check whether the data formats and data are correct.
    For More Info:  http://help.sap.com/saphelp_nw70/helpdata/EN/43/01ed2fe3811a77e10000000a422035/content.htm

Maybe you are looking for