I want to read the contents of a file to a text item line by line dynamical

I have created a timer
tm_id := FIND_TIMER('LOG_READING_TIMER');
If Id_Null(tm_id)
then
tm_id := create_timer('LOG_READING_TIMER', 1000, REPEAT);
else
set_timer (tm_id, 1000, REPEAT);
end if;
/* executed the shell script on application server */
host(v_command,no_screen);
and used below code for reading a file in when timer expired
DECLARE
v_file_name := '/home/log.txt' /* log created during running shell script */
BEGIN
v_infile := Text_IO.Fopen(v_file_name , 'r');
loop
Text_IO.Get_Line(v_infile,v_linebuf);
:CONTROL.item:= :CONTROL.item||v_linebuf||chr(10);
end loop;           
WHEN no_data_found THEN
     Text_IO.Fclose(v_infile);
     delete_timer('LOG_TIMER');
END
I want to read a log file which is created while runnning shell script line by line
dynamically
Above code is reading the log filebut all the lines are shown at once.
I have to display
each line on the text item
and the next line line by line
Can anyone help me how to achieve this.
Thanks,
in advance

In when-button-pressed trigger
I have called a shell script on application server using host command
HOST('Path of script',NO_SCREEN);
Shell script writes some set of statements to log file on application server
Problem is to read the log file on to the multiline text item each line simultaneosly
while running the script.
Below is the procedure i have written to achieve this but below code is writing all the lines at once
after entire complete execution of shell script.
for example
shell script writes tolog file:
1. 'Loading of tables';
then loads the data
2. 'emailing data';
3. ...
4. ...
Below code writes
all the 4 lines at once
I want to see in frontend what is going on while running the script
by reading the log file data line by line
WHEN-BUTTON-PRESSED
tm_id := FIND_TIMER('LOG_READING_TIMER');
If Id_Null(tm_id)
then
tm_id := create_timer('LOG_READING_TIMER', 1000, REPEAT);
else
set_timer (tm_id, 1000, REPEAT);
end if;
/* executed the shell script on application server */
host(v_command,no_screen);
WHEN-TIMER-EXPIRED
and used below code for reading a file in when timer expired
DECLARE
v_file_name := '/home/log.txt' /* log created during running shell script */
BEGIN
v_infile := Text_IO.Fopen(v_file_name , 'r');
loop
Text_IO.Get_Line(v_infile,v_linebuf);
:CONTROL.item:= :CONTROL.item||v_linebuf||chr(10);
end loop;
WHEN no_data_found THEN
Text_IO.Fclose(v_infile);
delete_timer('LOG_TIMER');
END
While running the script on application server
I want to see the data from log file simulataneously on to the form when the data is written on to the log file
Please let me know if you need more details.
Thanks,
in advance

Similar Messages

  • How to read the contents of XML file from my java code

    All,
    I created an rtf report for one of my EBS reports. Now I want to email this report to several people. Using Tim's blog I implemented the email part. I am sending emails to myself based on the USERID logic.
    However I want to email to different people other then me. My email addresses are in the XML file.
    From the java program which sends the email, how can I read the fields from XML file. If any one has done this, Please point me to the right examples.
    Please let me know if there are any exmaples/BLOG's which explain how to do this(basically read the contents of XML file in the Java program).
    Thank You,
    Padma

    Ike,
    Do you have a sample. I am searched so much in this forum for samples. I looked on SAX Parser. I did not find any samples.
    Please help me.
    Thank you for your posting.
    Padma.

  • How to read the contents of redolog files?

    Hi,
    I would want to read the contents of the redolog files on my database.
    Actually, I can't because these files are binary files*. I would want to know if there is a way to read these redolog files , if for example Oracle has tools to learn these redolog files.
    Thanks.

    In order to read the content of the Redo Log files, you should use Logminer Utility
    Please refer to the documentation for more information:
    [Using LogMiner to Analyze Redo Log Files|http://download.oracle.com/docs/cd/B19306_01/server.102/b14215/logminer.htm#SUTIL019]
    Kamran Agayev A. (10g OCP)
    http://kamranagayev.wordpress.com
    [Step by Step install Oracle on Linux and Automate the installation using Shell Script |http://kamranagayev.wordpress.com/2009/05/01/step-by-step-installing-oracle-database-10g-release-2-on-linux-centos-and-automate-the-installation-using-linux-shell-script/]

  • Reading the contents of a File without using the  fileref

    Hi ,
    I was trying to read the contents of a file (not upload
    basically) without using the fileref.upload or any servlets.
    I wanted to give this file as input(dataprovider) to a
    datagrid from the local instead of uploading it to the server and
    fetching the contents from there.
    I will explain the scenerio here:
    1.I have a text field. (Here I am providing the path of the
    file located).
    2.There is a Submit button .(On click should be able to take
    the specified file as input and read the contents of the file)
    which should be able to read the contents of the file path
    specified in step1.
    I want to basically provide the contents of this xml file as
    data provider to a datagrid.
    can anyone please provide some help on this issue.
    thanks

    You cannot access the local file system in Flex. You need to
    upload the file to the server, and then populate the file from that
    uploaded file. Unless of course you are using AIR, then this is
    doable.

  • Read the content of a file (via socket)

    Hi,
    I need to read the content of a file (.txt, or better, .jpg) and to write it again in another file.
    I have this code (in Javascript):
        conn = new Socket;
        conn.encoding = "BINARY";
        if (conn.open ("127.0.0.1:8888")) {
        conn.timeout=30;
        conn.writeln("GET variousFiles/file.jpg HTTP/1.1");
        reply = conn.read(999999);
        conn.close();
        var file = new File("C:/APPS/New_File.txt");
        file.encoding = 'BINARY';
        var open_file = file.open("w+");
        file.write(reply);
        } else { alert("Errore: " + conn2.error); }
    However my new file is always empty, because I can not read the content of the first file.
    My variable "reply" is always empty.
    Thanks and best regards.

    There is a particular case with sugested function, if content is generated on the fly by the server -php, cgi, etc.-
    In this case, http server doesn´t knows total size of response data, so response shows a chunked transfer-encoding header and data is parted in chunks, each one starting with it´s size, and following the data.
    HTTP/1.1 200 OK
    Date: Tue, 30 Apr 2013 12:43:41 GMT
    Server: Apache/1.3.31 (Win32) mod_fastcgi/2.4.1
    Connection: close
    Transfer-Encoding: chunked
    Content-Type: image/jpeg
    f49
    ÿØÿà  JFIF
    I´m using this function to decode parted response, with initial chunkedString with firs chunk size; in this case, f49:
    PartsSeparator="\r\n";
    function getPartedBody(partedBodyString) {
        var separatorPosition=partedBodyString.indexOf(PartsSeparator);
        var chunkSize=new Number("0x"+partedBodyString.substring(0,separatorPosition));
        separatorPosition+=PartsSeparator.length;
        var bodyString=new String("BINARY");
        bodyString="";
        if (chunkSize>0)
            bodyString=partedBodyString.substring(separatorPosition,separatorPosition+chunkSize)+
                getChunkedResponse(partedBodyString.substring(separatorPosition+chunkSize+PartsSeparator. length));
        return bodyString;
    Hope this helps
    regards

  • Does Acrobat Pro read the content in pdf file and transforms it?

    Does Acrobat Pro read the content in pdf file and transforms it to xls file without the need for much changes or manual work?

    Acrobat X (Standard and Pro) will save tabular data to XLS or XLSX format, provided it can recognize the table as being a table. If the PDF has missing or incorrect structure tags, Acrobat will try to guess the table layout by the position of text and lines on the page - this works well for basic formatting but if the table has complex styling, spanned cells etc. it can lead to problems.
    Acrobat X will even attempt to export a table within a scanned document, by applying OCR during the export stage - though again this relies on the table being visually identified.
    See http://www.adobe.com/products/acrobatpro/pdf-to-word-excel-converter.html and this article on how to extract one table from a larger document.

  • How to save the contents of a file(not a text file)

    Hi all, I want to save the contents of a file(,png file, not a text file) as a field in a class. Shall I have it as a string or byte array or something?
    I have tried saving a file in a string but there were some problems with loading the file from a different platform. Following is my code.
            String string;
            try {
                StringBuffer sb = new StringBuffer(1024);
                char[] characterArray = new char[1024];
                BufferedReader br = new BufferedReader(new FileReader(file));
                while(br.read(characterArray) != -1){
                    sb.append(String.valueOf(characterArray));
                br.close();
                string= sb.toString();
            } catch (IOException ex) {
                ex.printStackTrace();
            }and I use the following code to recover the string back to a stream, and save that stream back to a time later.
        ByteArrayInputStream bais = new ByteArrayInputStream(map.getBytes());I realized that because this file is not a text file, the string could cause some problems. But anyone could tell me if I should use a byte array or someting? and how?
    Any help would be appreciated!
    Cheers,
    Jing

    You should use a byte array, and the binary streams (InputStream a& OutputStream). Never use Strings and Reader/Writer if you have binary data.
    Kaj

  • How to read the contents of a file present in local file system

    Hi ABAP Experts,
       I want to read the file contents of a file in the local system. I want to read it stream based i.e if the file is if 100kb in size, i want to read the first 100bytes at one time, next 50 kb after, and remaining some other time. Is this possible. I know that with GUI_UPLOAD i can get the total contents into a xstring.
    But how to resolve the following i am not sure. Can you please help.
    Thanks & Regards,
    Vinay.

    Hi,
    transfer file to your application server and use:
    open dataset file ... AT POSITION p .
    regards Andreas

  • How to read the contents of Uploaded File Data?

    Dear Experts,
    I want to develop one webdynpro application in which the iview contains the FileUpload option.and after uploading i need to read the contents of the file.
    Can you plz guide me how to achieve this?
    its very much helpfull if u have any sample project / code on this...plz do send it to [ycsvissu at gmail dot com]
    Regards,
    Viswes.

    Ike,
    Do you have a sample. I am searched so much in this forum for samples. I looked on SAX Parser. I did not find any samples.
    Please help me.
    Thank you for your posting.
    Padma.

  • How to read the contents of attached files

    Hi,
    I am designing a Form using LiveCycle Designer 8.0
    Scenario:
    User can attach the file through "Attachments" facility provided on Adobe  Reader.
    The requirement is to attach 3 documents and post it to SAP system using Web services.
    I am using the following code(which i got from this forum only) to find the number of files user has attached.
    d = event.target.dataObjects;
    n =  d.length;
    xfa.host.messageBox("Number  of Attachments: "+n);
    //Displaying  the names of the Attached files
    for( i =  0; i < n; i++ )
    xfa.host.messageBox("Name  of the file: "+d[i].name);
    My problem: is how to read the contents of the attached files so that I post it to SAP using Web services
    Thanks in advance!!
    Taha Ahmed

    In order to read the content of the Redo Log files, you should use Logminer Utility
    Please refer to the documentation for more information:
    [Using LogMiner to Analyze Redo Log Files|http://download.oracle.com/docs/cd/B19306_01/server.102/b14215/logminer.htm#SUTIL019]
    Kamran Agayev A. (10g OCP)
    http://kamranagayev.wordpress.com
    [Step by Step install Oracle on Linux and Automate the installation using Shell Script |http://kamranagayev.wordpress.com/2009/05/01/step-by-step-installing-oracle-database-10g-release-2-on-linux-centos-and-automate-the-installation-using-linux-shell-script/]

  • How to read the content of .msg file type with attachments in SAP crm?

    Hi All,
    Need to develop a RFC FM which will take any BP number as input
    Read the attachments in the BP and identify the attachment which is an email( .msg).
    Identify by the mime type and file extension
    Scan through the email to get the attachments of that email read the content of the
    attachment as a binary file and return that binary file with file name, size
    etc.
    I need to read the data (in binary format) attachment of an attachment of .msg file type .
    I have done till step 2 .
    Please help me on step 3.
    Thanks&Regards,
    Pratap Naik

    Can any one help me on this ?
    Thanks in advance.
    Regards,
    Pratap Naik

  • Read the content of a file attached to a document

    Hi,
    I have a requirement to read the content of the file attached to the document and send in the body of the email. The original get stored in the KPRO server. Can anyone suggest how can i read the content of the file stored in the KPRO server. HTTp is used to save the file in KPRO server.
    thanks
    Papiya

    Dear Papiya,
    if I got your problem correctly you are looking for some report to get the originals files from the content server and then send it via e-mail?
    In this case the report DMS_KPRO_READ may be useful for you. You can start this report in transaction SE38. You just need to enter the document data and then all attached originals will be listed with the corresponding PHIO- and LOIO-ID. Further there is also a small grenn download button to get this file on your PC.
    Best regards,
    Christoph
    P.S.: Please reward points for useful information.

  • Reading the contents of RTF file

    Hi,
    I would like to read the contents of an RTF file which contains static text and place holders. The place holders have to be mapped to a database column(s) and once it is done I have to rewrite the output again to an RTF file. Is there any Java API directly available for this?

    Hey! Did you ever find a decent solution to this. I'm trying to do something similar.
    Read in an RTF file with some of the document already there, and embeded tags.
    These tags will be replaced with more RTF (which I would like to generate).
    Any pointers appreciated
    Regards
    Scott

  • I want to read the content of a text file dropped in a watched folder into a string variable

    I have a workbench process with 2 variable.
    inDoc (DataType=Document/input/required)
    outStr (DataType = String/output)
    The document being passed to the workflow is a text file with 4 lines of text in it.  when the text file is dropped into the watched folder, it will be assigned to the inDoc parameter in the workflow.
    My workflow needs to extract the 4 lines of text and write it into a string (outStr).
    Id like to use the FileUtilsService.ReadString service but i can't since its input parameter is the file path.  When i do, i get the following error...
    Caused by: ALC-FUT-001-011: File rO0ABXNyABZjb20uYWRvYmUuaWRwLkRvY3VtZW50yAEFUxsO+CEDACNJAAtfY2FsbGJhY2tJZFoADV9kZXNlcmlhb Gl6ZWRJABBfZGlzcG9zYWxUaW1lb3V0WgAJX2Rpc3Bvc2VkWgAZX2lzRGlzcG9zYWxUaW1lb3V0RGVmYXVsdFoAE19 pc1RyYW5zYWN0aW9uQm91bmRKAAdfbGVuZ3RoSQAOX21heElubGluZVNpemVaAAhfb3duRmlsZVoAC19wYXNzaXZhd GVkWgALX3BlcnNpc3RlbnRJABFfc2VuZGVyQ2FsbGJhY2tJZFoAEV9zZW5kZXJQYXNzaXZhdGVkWgARX3NlbmRlclB lcnNpc3RlbnRJAA5fc2VuZGVyVmVyc2lvbkkABl9zdGF0ZUwAC19hdHRyaWJ1dGVzdAATTGphdmEvdXRpbC9IYXNoT WFwO0wACF9jYWNoZUlkdAAfTGNvbS9hZG9iZS9pZHAvRG9jdW1lbnRDYWNoZUlEO0wADF9jYWxsYmFja1JlZnQAIUx jb20vYWRvYmUvaWRwL0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Hx8fHx8fHxZfHx8fHx8fHx8fDAyfHx8fHx8TnwyMDEyfDJ8MTR8DQpJTU01MjU3XzAxLTIwMTFfMnx8fHx8fHx8f Hxhc2RmfDI1NnwyMDEyfDAyfDAxfDIwMTJ8MDN8MDJ8fHx8YXxhfDI1Mnx8fHxZfHx8fHx8fHx8fHx8fHx8DQpJTU0 1MjU3XzAxLTIwMTFfM3xOfHx8fHx8fHx8fDIwMDB8Nnx8fGFzZGZ8YXNkZnxhc2RmfDI1Nnx8fHx8fHx8fHx8fHx8f Hx8fHx8DQpJTU01MjU3XzAxLTIwMTFfNHxOfE58fE58TnxOfHxOfE58fE58TnxOfA0KSU1NNTI1N18wMS0yMDExXzV 8U2luZ2xlfDAxfHwyMDEyfDAyfDE4fDIwMTJ8MDN8MDN8MjM0fGFzZGZ8fGFzZGZhc3x8fHxFeGNoYW5nZS1Qcm8uO S40MDEuRnVsbC5XSU4uZW5fQ0EuRU5VLTEwLTIwMTF8DQoNCnBwdwYAAAAAAAB0AAp0ZXh0L3BsYWlucHNyABFqYXZ hLnV0aWwuSGFzaE1hcAUH2sHDFmDRAwACRgAKbG9hZEZhY3RvckkACXRocmVzaG9sZHhwP0AAAAAAAAx3CAAAABAAA AADdAAKd3NmaWxlbmFtZXQAJ0M6XFVzZXJzXENodWxseS5QYXJrXERlc2t0b3BcaGRzY2FuLnR4dHQACGJhc2VuYW1 ldAAKaGRzY2FuLnR4dHQABGZpbGVxAH4AFXh3NwAtYWRvYmUvaWRwL0RvY3VtZW50UHVsbFNlcnZhbnQvYWRvYmVqY l9MQ19ERVYx//////////94 does not exist.
    at com.adobe.livecycle.fileutils.FileUtilsService.readDocument(FileUtilsService.java:363)
    which is what i expected...
    I've also tried with the Script.executeScript to call some java code but im not too strong in java and in all the examples i find, the file pointer requires a file path.
    import java.io.*;
    FileInputStream f = new FileInputStream(patExecContext.getProcessDataValue("/process_data/inDoc"));
    OR
    File f = new File(patExecContext.getProcessDataValue("/process_data/inDoc"));
    OR
    File f = patExecContext.getProcessDataValue("/process_data/inDoc");
    Any clue how to resolve my problem?

    Try the following code snippet to read the String content from the file recieved through watched folder endpoint.
    com.adobe.idp.Document inputDoc = patExecContext.getProcessDataDocumentValue("/process_data/inDoc");
    java.io.InputStream inStream = inputDoc.getInputStream();
    byte[] dataBuffer = new byte[inStream.available()];
    inStream.read(dataBuffer);
    String strData = new String(dataBuffer);
    patExecContext.setProcessDataStringValue("/process_data/outStr",strData);
    The code is not tested, hence if you find any mistakes, correct and test the functionality.
    Nith

  • Assistance with reading the contents of a file, taking some of these contents to make a new file

    Hello,
    I have mulitiple .txt files in a folder each with the following type of Move-ClusterGroup instructions for each VM in our cluster:
    Move-ClusterGroup "SCVMM MYVM1 Resources" -Node HYPERVA01
    Move-ClusterGroup "SCVMM MYVM2 Resources" -Node HYPERVA01
    Move-ClusterGroup "SCVMM MYVM3 Resources" -Node HYPERVA01
    I want to read through each .txt file in that folder location and create the same number of .txt files to start each VM.  The resulting files would have this data in them:
    Start-ClusterResource "SCVMM MYVM1 Resources"
    Start-ClusterResource "SCVMM MYVM2 Resources"
    Start-ClusterResource "SCVMM MYVM3 Resources"
    Any tips on where I can start with this task?
    Thank you.

    This will read all the .txt files in the specified folder and createsnew .txt files in the same folder with the desired content appending _new to the name:
    $folder="c:\myFolder"
    $files=Get-ChildItem $folder -Filter "*.txt"
    foreach ($file in $files){
    $outFileName=[IO.Path]::GetFileNameWithoutExtension($file.Name) + "_new.txt"
    Get-Content $file.FullName | foreach{
    Add-Content $folder\$outFileName "Start-ClusterResource ""$($_.Split('"')[1])"""

Maybe you are looking for

  • Pages document saved as doc not readable by word

    Hi all, Lately I'm having trouble exporting my Pages documents to Microsoft Word format. I've tried the "Export" option directly available in the File menu, as well as the "Save as a copy" option in the Save dialog box. De document is correctly saved

  • Monitoring BI PROCESS CHAIN with Solution Manager BPMON

    Hello, I'm trying to setup the monitoring of BI process chain using the BPMON I setup the process chain monitoring using  BPmon application monitoring "BI Process Chain Monitoring" (BOBIPCMO) but than I'm not able to read the process chain names,step

  • SOLVED - BIOS UPDATE "SYSTEM DOES NOT CONTAIN the NECESSARY WMI SUPPORT for this VERSION of HPQflash

    If you get infamous error when updating HP Portables (laptops/notebooks/ netbooks) BIOS within Windows: "SYSTEM DOES NOT CONTAIN THE NECESSARY WMI SUPPORT FOR THIS VERSION OF HPQFLASH": I am posting a solution found for own business laptop (HP 8540W

  • Shop on behalf - Limit CC list on only allowed

    Hello all, EBP 5.0, R/3 4.7, classic scenario. In Shop-on-behalf is there possibility to limit search for Cost centres only to allowed list. We are using RFC user with SAP_ALL but would like to limit before call is executed that user who iz searching

  • Defining metadata at the folder level.

    We are migrating from Content DB to Webcenter Content 11.1.1.7, using FrameworkFolders. Our old Content Management solution (Content DB), allowed us to define metadata on a folder level. For example a group of metadata (a category in Content DB) coul