Move the contents of old file into another  before writing in applcn srvr

Hi Friends,
As per the requirement I need to move the contents of the previous file into an archieve folder which is being created by the previous run of the program in the application server.
After the old file has been moved I need to craete the new file in the directory.
So at any time only one file should be present in the application server.
All the previous files will be in the Archieve folder.
Please suggest how can I move the contents of the privious file in the archieve directory.
Thanks and regards,
Smriti Singh
Please do not duplicate post
Edited by: Rob Burbank on Feb 24, 2009 11:16 AM

Hi Smriti,
check this
1) use the function module  'EPS_GET_DIRECTORY_LISTING' --- to gett the details of files n application dir
eq.
call function 'EPS_GET_DIRECTORY_LISTING'
    exporting
      dir_name               = p_file
    tables
      dir_list               = it_dir_list
    exceptions
      invalid_eps_subdir     = 1
      sapgparam_failed       = 2
      build_directory_failed = 3
      no_authorization       = 4
      read_directory_failed  = 5
      too_many_read_errors   = 6
      empty_directory_list   = 7
      others                 = 8.
  if sy-subrc <> 0.
    message id sy-msgid type sy-msgty number sy-msgno
            with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  endif.
2) then use this code to archive
open dataset w_file1 for output in text mode encoding default. "Open Backup File
  if sy-subrc <> 0.
    write: /1 ' error creating file with status - ', sy-subrc.
    exit.
  endif.
  open dataset w_dirname for input in text mode encoding default."Open Real File
  if sy-subrc <> 0.
    error_flag = 'X'.
    write: /1 ' error opening input file with status - ', sy-subrc.
    exit.
  endif.
*" To read the input file into a internal table
  do.
    read dataset w_dirname into inrec_lpcfab.
    if sy-subrc <> 0.
      exit.
    else.
      if not inrec_lpcfab is initial.
        append inrec_lpcfab.
        transfer inrec_lpcfab to w_file1 length 180.
      endif.
    endif.
  enddo.
  close dataset w_dirname.

Similar Messages

  • How to save the contents of one file into another file?

    Hai,
    i'm trying to save the contents of an existing file into a new file...
    for example.. if i'm having a ms word file namely ss.doc..
    now i want to save itz contents into another file namele dd.doc..
    How shall i do it..
    Can an one plzz explain me...
    senthil.

    Hi, Senthil.
    This Forum is not a general discussion forum.
    You don't believe that the InDesign SDK is a general purpose API. Do you?
    I think you must post issues like this where they belong, in this case in a Microsoft Word Forum.
    Best regards.
    Oscar.

  • How to copy the content of one file into another

    I have tried this code
    try {
                   fin = new FileInputStream("file path");
              catch(FileNotFoundException exc)
                   System.out.println("File not found");
                   return 0;
              catch(ArrayIndexOutOfBoundsException exc)
                   System.out.println("Usage: Showfile file");
                   return 0;
              while(true){
                   i=fin.read();
                   if(i==-1)
                        break;
                   cnt++;
              fin.close();*/
    now in this way i can lift one character at a time and copy it into another file (note i have not done the copy part in this code but that can be implemented) however this whole procedure is taking too much time if the size of the file is too big....kindly suggest another way to copy one file into another

    have you ever copied and pasted a large file in Windows or another OS? Larger files take more time to copy, that's just how it is.

  • Get the content of a file into a array

    Hy to all!I have txt file with the following content : 0 1 1 0
    1 1 1 0
    0 0 0 0. I want to extract the values to a bi-dimension array,like this: a[0][0] = 0,a[0][1] = 1,a[0][2] = 1....and so on.
    Anybody could give a little help.THX

    The first thing I can help you with is that this doesn't have anything to do with java serialization.
    Secondly, if you are new to java, the best forum is "New To Java" forum.
    Thirdly, make sure you have done a google search first for an answer because it is likely that many people have asked the same question before.
    The follow search gets over 2 million hits. [http://www.google.co.uk/search?q=java+read+content+of+a+file+into+a+array]

  • How to Display the content of Excel file into Webdynpro Table

    Hi Experts
    I am following the Blog to upload a file in to the webdynpro context,but my problem is after uploading a excel file i need to extract the content from that Excel file and that content should be displayed in the webdynpro table.Can any body please guide me how to read the content from excel and to Display in the Table.
    Thanks and Regards
    Kalyan

    HI,
    Take for example, if Excel file contains 4 fields,
    Add jxl.jar to JavaBuild path and Use this snippet
    File f=new File("sample.xls");
    Workbook w=Workbook.getWorkbook(f);
    Sheet sh=w.getSheet(0);
    int cols=sh.getColumns();
    int rows=sh.getRows();
    Cell c=null;
    String s1=null;
    String s2=null;
    String s3=null;
    String s4=null;
    ArrayList al=new ArrayList();
    int j=0;
    for(int i=1;i<rows;i++)
    ITableElement table=wdContext.createTableElementz
         s1=sh.getCell(0,i).getContents();
         s2=sh.getCell(1,i).getContents();
         s3=sh.getCell(2,i).getContents();
         s4=sh.getCell(3,i).getContents();
                             table.setName(s1);
         table.setAddress(s2);
         table.setDesignation(s3);
         table.setDummy(s4);
         al.add(j,table);
         j++;                    
    wdContext.nodeTable().bind(al);
    Regards
    LakshmiNarayana

  • Loading the Contents of a file into a JTable

    I am trying to load the content of a delimited (tab, comma, etc), into a JTable. The code is very simple and works for the most part. Here is some of it:
                   List tableRows = new ArrayList();
                   String lineItem = "";
                   InputStream in = new FileInputStream(fName);
                   InputStreamReader isr = new InputStreamReader(in);               
              BufferedReader br = new BufferedReader(isr);
         while((lineItem = br.readLine()) != null)
                        if(x == MAX)
                             break;
                        java.util.List rowData = new ArrayList();
                        StringTokenizer st = new StringTokenizer(lineItem, "\t");
                        while(st.hasMoreElements())
                             rowData.add(st.nextToken());
                        tableRows.add(rowData);     
                        x++;
    Basically, tableRows, ends up to be a List of Lists which I later use to populate the Object[][] for the JTable rows. This works perfect!
    My problem has to do with the tokenizer. In some situations, values in a line that is read contains "". For example an line read (quotes are showed only to distinquish values in the line):
    "item1", "item2", " ", "item4", " ", "item6", "item7"
    The tokenizer does not capture the " ". So instead of 7 tokens, it only sees 5.
    My question is, can someone tell me a better approach for tokenizing the string so that it captures everything?
    Thanks in advance,
    Augustine

    I am trying to load the content of a delimited (tab, comma, etc), into a JTable. The code is very simple and works for the most part. Here is some of it:
                   List tableRows = new ArrayList();
                   String lineItem = "";
                   InputStream in = new FileInputStream(fName);
                   InputStreamReader isr = new InputStreamReader(in);               
              BufferedReader br = new BufferedReader(isr);
         while((lineItem = br.readLine()) != null)
                        if(x == MAX)
                             break;
                        java.util.List rowData = new ArrayList();
                        StringTokenizer st = new StringTokenizer(lineItem, "\t");
                        while(st.hasMoreElements())
                             rowData.add(st.nextToken());
                        tableRows.add(rowData);     
                        x++;
    Basically, tableRows, ends up to be a List of Lists which I later use to populate the Object[][] for the JTable rows. This works perfect!
    My problem has to do with the tokenizer. In some situations, values in a line that is read contains "". For example an line read (quotes are showed only to distinquish values in the line):
    "item1", "item2", " ", "item4", " ", "item6", "item7"
    The tokenizer does not capture the " ". So instead of 7 tokens, it only sees 5.
    My question is, can someone tell me a better approach for tokenizing the string so that it captures everything?
    Thanks in advance,
    Augustine

  • How do I merge the content of one website into another with Business Catalyst?

    I have two websites, each of them are Business Catalyst websites.
    I would like to merge website 1 with website 2, so they are on the same domain.
    Each website will effectively be put into it's own directory on the same domain, with the homepage allowing a visitor to decide which website they would like to see.
    Is there an easy way to do this? I have a feeling it's a matter of copying all the content across, modifying the templates and doing everything manually page by page - which wouldn't be fun.
    Any help or suggestions would be appreciated.
    Thanks,
    Sam

    Hi alberon-sam,
    You will need to migrate your site as mentioned in this article: http://kb.worldsecuresystems.com/203/bc_2038.html?bc-partner

  • Best method to handle the content of several files into only one ?

    Hi all,
    I am currently looking for the best solution to handle several file contents into a unique file, like a sort of archive. The goal is to develop a desktop application based on an API providing file encryption/decryption into a "box". I need to have a single file because I want to make it easy to travel on network, removable medias, etc. I found some solutions but lets say I'm starting from scratch, I don't want to influence your answers.
    So, for you, what is the best solution ?
    Look forward to getting your help

    BalusC wrote:
    Indeed, check the java.util.zip API. http://www.google.com/search?q=java.util.zip+api+javase+site:sun.com
    Also see http://java.sun.com/developer/technicalArticles/Programming/compression/
    Lots of sample code.

  • How to store the content of a file in oracle table.

    Hello,
    I have a .xml file in unix , how can i upload the content of that file into a column of a table in oracle?

    Did you look at the link posted in response to the OP? At a quick look, it seems fairly reasonable to me.
    John

  • How to move the contents of an itab from one class to another...

    Hello Experts,
    How can I move the contents of an internal table for a given class to another class.
    I want to transfer the contents of my internal table lt_vbak to another class
    which is lcl_get_docflow. Below is my code:
    REPORT  zsd_orderstage
            NO STANDARD PAGE HEADING.
    * Data Dictionary Table/s                      *
    TABLES: vbak.
    * Global Structure/s                           *
    TYPES: BEGIN OF t_output,
            salesgroup    type vbak-vkgrp,
            salesorder    TYPE vbak-vbeln,
            custcode      TYPE vbak-kunnr,
            shipto        TYPE likp-kunnr,
            creation_date TYPE vbak-erdat,
            created_by    TYPE vbak-ernam,
            delorder      TYPE likp-vbeln,
            invnumber     TYPE vbrk-vbeln,
           END OF t_output.
    * Global Internal Table/s                      *
    DATA: gt_output TYPE STANDARD TABLE OF t_output.
    * SELECTION-SCREEN                             *
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
    PARAMETERS:     p_kunnr TYPE vbak-kunnr OBLIGATORY.
    SELECT-OPTIONS: s_group for vbak-vkgrp,
                    s_auart FOR vbak-auart,
                    s_erdat FOR vbak-erdat  OBLIGATORY,
                    s_ernam FOR vbak-ernam.
    SELECTION-SCREEN END OF BLOCK b1.
    *       CLASS lcl_main DEFINITION
    CLASS lcl_main DEFINITION ABSTRACT.
      PUBLIC SECTION.
        TYPES: BEGIN OF t_vbak,
              vbeln TYPE vbak-vbeln,
              erdat TYPE vbak-erdat,
              ernam TYPE vbak-ernam,
              auart TYPE vbak-auart,
              kunnr TYPE vbak-kunnr,
              vkgrp type vbak-vkgrp,
             END OF t_vbak.
        TYPES: BEGIN OF t_vbfa,
                vbelv   TYPE vbfa-vbelv,
                vbeln   TYPE vbfa-vbeln,
                vbtyp_n TYPE vbfa-vbtyp_n,
               END OF t_vbfa.
        TYPES: BEGIN OF t_likp,
                vbeln TYPE likp-vbeln,
                kunnr TYPE likp-kunnr,
               END OF t_likp.
        TYPES: BEGIN OF t_vbrk,
                vbeln TYPE vbrk-vbeln,
               END OF t_vbrk.
        DATA: gt_vbfa     TYPE STANDARD TABLE OF t_vbfa,
              gt_likp     TYPE HASHED TABLE OF t_likp
                          WITH UNIQUE KEY vbeln,
              gt_vbrk     TYPE HASHED TABLE OF t_vbrk
                          WITH UNIQUE KEY vbeln,
              gt_delivery TYPE STANDARD TABLE OF t_vbfa,
              gt_invoice  TYPE STANDARD TABLE OF t_vbfa.
    ENDCLASS.                    "lcl_main DEFINITION
    *       CLASS lcl_get_so DEFINITION
    CLASS lcl_get_so DEFINITION INHERITING FROM lcl_main.
      PUBLIC SECTION.
        DATA: lt_vbak TYPE STANDARD TABLE OF t_vbak.
        METHODS: get_sales_orders
                    RETURNING
                       value(re_vbak) TYPE t_vbak.
    ENDCLASS.                    "lcl_get_so DEFINITION
    *       CLASS lcl_get_so IMPLEMENTATION
    CLASS lcl_get_so IMPLEMENTATION.
      METHOD get_sales_orders.
        SELECT vbeln erdat ernam auart kunnr vkgrp
          FROM vbak
          INTO TABLE lt_vbak
         WHERE erdat IN s_erdat
           AND ernam IN s_ernam
           AND auart IN s_auart
           AND kunnr = p_kunnr.
      ENDMETHOD.                    "get_sales_orders
    ENDCLASS.                    "lcl_get_so IMPLEMENTATION
    *       CLASS lcl_get_docflow DEFINITION
    CLASS lcl_get_docflow DEFINITION INHERITING FROM lcl_main.
      PUBLIC SECTION.
        DATA: lt_vbfa TYPE STANDARD TABLE OF t_vbfa.
        METHODS: get_subsequent_docs
                    IMPORTING
                       value(im_vbak) TYPE t_vbak
                    EXPORTING
                       ex_vbfa TYPE t_vbfa.
    ENDCLASS.                    "get_docflow  INHERITING FRO
    *       CLASS lcl_get_docflow IMPLEMENTATION
    CLASS lcl_get_docflow IMPLEMENTATION.
      METHOD get_subsequent_docs.
      ENDMETHOD.                    "get_subsequent_docs
    ENDCLASS.                    "get_docflow IMPLEMENTATION
    * Global Internal Table/s                      *
    START-OF-SELECTION.
      DATA: o_get_so      TYPE REF TO lcl_get_so,
            o_get_docflow TYPE REF TO lcl_get_docflow.
      CREATE OBJECT: o_get_so,
                     o_get_docflow.
      CALL METHOD o_get_so->get_sales_orders.
    What I want is to pass the records of lt_vbak to method get_subsequent_docs. How do I do this guys?Thank you and take care!

    .

  • I got a new Macbook pro in March and transferred all of my old files into the new macbook from my old one. But ever since then, my iPhoto just does not open up. It says 'error' every time I try to open it, but I am still able to attach the iPhotos saved

    I got a new Macbook pro in March and transferred all of my old files into the new macbook from my old one. But ever since then, my iPhoto just does not open up. It says 'error' every time I try to open it, but I am still able to attach the iPhotos saved to emails. Help! How do I get my iPhoto back?

    Thanks, Sig.
    The old computer is a 2.6 Ghz Intel Core 2 Duo
    The new one is a 2.3 GHz intel core i7
    In going over this, thanks to "tallking it out" with you, I did discover the Text Edit problem.  Because I've still been unable to get the new computer text size (fonts or whatever) to match the old computer, I did not notice that the curser is now different--the line midway down the curser has to be placed on the line I am working upon, otherwise the edits go elsewhere on the page.  Now, with a bit of difficulty, I am able to get Text Edit to work correctly.
    If you have any ideas as to why my menu bar and Text Edit type are still so slow, I'd love to have them. 
    (I went through the process you suggested earlier, re my Trackpad preferences, and found no improvement.)

  • I would like to copy all the songs from one Ipod into another. All the songs are into my Itunes account, I tried to drag and drop the songs from the old Ipod to the new one but it doesn't work. Is there a way to do it ?

    Hello everybody,
    I would like to copy all the songs from one Ipod into another. All the songs are into my Itunes account, I tried to drag and drop the songs from the old Ipod to the new one but it doesn't work. Is there a way to do it ?
    I share one Itunes account with other people from my family and one person would like to keep the same songs on the new Ipod as the ones which were on the old one.
    Thanks in advance for your answer.
    Yan

    Hello Chris,
    Thanks for your answer. I was hoping for an easier answer. Too bad there is no drag and drop solution, it would have been much easier.
    Thanks for answering so fast.
    Bye.
    Yan

  • How to Convert the content in BLOB field into a PDF file...

    Hi,
    I am having PDF files stored in BLOB column of a table in Oracle Database (11G R2).
    I want to retrieve the files back and store them in hard disk. I am successful in storing the content as a file with '.doc' but if I store the file as '.pdf', adobe fails to open the file with error
    Adobe Reader could not open file 'xxx.pdf' because it is either not a supported file type or because the file has been damaged (for example it was sent as an email attachment and wasn't correctly decoded)
    I am using following example code to achieve my goal...
    Declare
    b blob;
    c clob;
    buffer VARCHAR2(32767);
    buffer_size CONSTANT BINARY_INTEGER := 32767;
    amount BINARY_INTEGER;
    offset NUMBER(38);
    file_handle UTL_FILE.FILE_TYPE;
    begin
    select blob_data into b from blobdata where id=1;
    c := blob2clob(b);
    file_handle := UTL_FILE.FOPEN('BLOB2FILE','my_file.pdf','w',buffer_size);
         amount := buffer_size;
         offset := 1;
         WHILE amount >= buffer_size
         LOOP
              DBMS_LOB.READ(c,amount,offset,buffer);
              -- buffer:=replace(buffer,chr(13),'');
              offset := offset + amount;
              UTL_FILE.PUT(file_handle,buffer);
              UTL_FILE.FFLUSH(file_handle);
         END LOOP;
         UTL_FILE.FCLOSE(file_handle);
    end;
    create or replace FUNCTION BLOB2CLOB ( p_blob IN BLOB ) RETURN CLOB
    -- typecasts BLOB to CLOB (binary conversion)
    IS
    || Purpose : To Convert a BLOB File to CLOB File
    || INPUT : BLOB File
    || OUTPUT : CLOB File
    || History: MB V5.0 24.09.2007 RCMS00318572 Initial version
    ln_file_check NUMBER;
    ln_file_size NUMBER;
    v_text_file CLOB;
    v_binary_file BLOB;
    v_dest_offset INTEGER := 1;
    v_src_offset INTEGER := 1;
    v_warning INTEGER;
    lv_data CLOB;
    ln_length NUMBER;
    csid VARCHAR2(100) := DBMS_LOB.DEFAULT_CSID;
    V_LANG_CONTEXT NUMBER := DBMS_LOB.DEFAULT_LANG_CTX;
    BEGIN
    DBMS_LOB.createtemporary (v_text_file, TRUE);
    SELECT dbms_lob.getlength(p_blob) INTO ln_file_size FROM DUAL;
    DBMS_LOB.converttoclob (v_text_file, p_blob, ln_file_size, v_dest_offset, v_src_offset, 0, v_lang_context, v_warning);
    SELECT dbms_lob.getlength(v_text_file) INTO ln_length FROM DUAL;
    RETURN v_text_file;
    END;

    user755667 wrote:
    Hi,
    I am having PDF files stored in BLOB column of a table in Oracle Database (11G R2).
    I want to retrieve the files back and store them in hard disk. I am successful in storing the content as a file with '.doc' but if I store the file as '.pdf', adobe fails to open the file with error
    Adobe Reader could not open file 'xxx.pdf' because it is either not a supported file type or because the file has been damaged (for example it was sent as an email attachment and wasn't correctly decoded)
    I am using following example code to achieve my goal...
    Declare
    b blob;
    c clob;
    buffer VARCHAR2(32767);
    buffer_size CONSTANT BINARY_INTEGER := 32767;
    amount BINARY_INTEGER;
    offset NUMBER(38);
    file_handle UTL_FILE.FILE_TYPE;
    begin
    select blob_data into b from blobdata where id=1;
    c := blob2clob(b);
    file_handle := UTL_FILE.FOPEN('BLOB2FILE','my_file.pdf','w',buffer_size);
         amount := buffer_size;
         offset := 1;
         WHILE amount >= buffer_size
         LOOP
              DBMS_LOB.READ(c,amount,offset,buffer);
              -- buffer:=replace(buffer,chr(13),'');
              offset := offset + amount;
              UTL_FILE.PUT(file_handle,buffer);
              UTL_FILE.FFLUSH(file_handle);
         END LOOP;
         UTL_FILE.FCLOSE(file_handle);
    end;
    create or replace FUNCTION BLOB2CLOB ( p_blob IN BLOB ) RETURN CLOB
    -- typecasts BLOB to CLOB (binary conversion)
    IS
    || Purpose : To Convert a BLOB File to CLOB File
    || INPUT : BLOB File
    || OUTPUT : CLOB File
    || History: MB V5.0 24.09.2007 RCMS00318572 Initial version
    ln_file_check NUMBER;
    ln_file_size NUMBER;
    v_text_file CLOB;
    v_binary_file BLOB;
    v_dest_offset INTEGER := 1;
    v_src_offset INTEGER := 1;
    v_warning INTEGER;
    lv_data CLOB;
    ln_length NUMBER;
    csid VARCHAR2(100) := DBMS_LOB.DEFAULT_CSID;
    V_LANG_CONTEXT NUMBER := DBMS_LOB.DEFAULT_LANG_CTX;
    BEGIN
    DBMS_LOB.createtemporary (v_text_file, TRUE);
    SELECT dbms_lob.getlength(p_blob) INTO ln_file_size FROM DUAL;
    DBMS_LOB.converttoclob (v_text_file, p_blob, ln_file_size, v_dest_offset, v_src_offset, 0, v_lang_context, v_warning);
    SELECT dbms_lob.getlength(v_text_file) INTO ln_length FROM DUAL;
    RETURN v_text_file;
    END;I skimmed this and stopped reading when i saw the BLOB to CLOB function.
    You can't convert binary data into character based data.
    So very likely this is your problem.

  • How to save the content of a JTextArea into a txt file?

    Hi, I want to save the content of a JTextArea into a txt file line by line. Here is part of my code(catch IOException part is omitted):
    String s = textArea.getText();
    File file = new File("file.txt");
    BufferedWriter bw = new BufferedWriter(new FileWriter(file));
    bw.write(s);
    bw.close();
    But I found in the file all is binary code instead of text, any people can help me?
    Thanks in advance

    I can see text in the file now, but the problem is
    when I write three lines in textarea, for example
    111
    222
    333
    then I open the txt file with notepad, it is
    111222333
    How to save them line by line? Use a PrintWriter. It lets you write lines (it's the same class as System.out).
    http://java.sun.com/j2se/1.4/docs/api/java/io/PrintWriter.html

  • How can I get the value for static content of 1 jsp into another jsp

    Hi, I have a jsp which have a header ,now i want this header value in another jsp dynamically.Can u tell me how I can do it?

    What I want to know is that , is it possible to get the value of a static content of one jsp into another jsp,something like getParameter() method that we use to get the value of a field in the jsp to a servlet,or to another jsp,the only difference here is I do not have a field here but a static jsp content .

Maybe you are looking for

  • On-line Action script course?

    Can anyone recommend an on-line Action script course? I'm working on a project where that will require more coding then I am use to dealing with. So I need to raise my skill set fast. I'm not sure where to receive the best time and financial investme

  • HT3290 RE Lumix Panasonic DMC ZS19  Can anyone tell me if you've found a way to import videos off the camera into iPhoto or iMovie?  -Ellen

    RE Lumix Panasonic DMC ZS19  Can anyone tell me if you've found a way to import videos off the camera into iPhoto or iMovie?  -Ellen

  • Sliding Panels widget

    Hi, I do not know if this is the right place. If not, please tell me where to ask. I do not know nothing of programing and my use of a program is to "click" on shortuct. I am familiar with using Tabbed panels, Accordion and Collapsible panel. But I w

  • My Intel imac  won't turn on

    Hi! My intel Imac suddenly, and without apparent reason, shut down, and won't turn back on. When I press the power button, sometimes it makes a small noise, but then nothing happens. I have unplugged all the cables, and also tried resetting the SMC,

  • Getting This Error - IO Already pending error Iplanet

    Hi, I'm getting this error on Iplanet Web Server 7.0.9 Does anyone know this issue? [14/Mar/2013:15:35:24] failure ( 5092): HTTP3068: Error receiving request from xx.x.xx.xx (IO already pending error) [14/Mar/2013:15:35:25] failure ( 5092): HTTP3068: