Read info about files in specific folder into internal table

Hi Experts
I need to have last modified date and filename information read into an internal table. I need to read in the information of all files in a specific (UNIX) folder (I do not know the name of the single files).
I really hope someone can help.
Thanks a lot
Kind regards,
Torben

Hi Guys
Thanks a lot for you input.
I managed to get my program to works as follows:
REPORT  ZDELETE_ARCHIVING_FILES.
*Step 1: Get the list of files in the directory into internal table :
DATA: DLIST    LIKE EPSFILI OCCURS 0 WITH HEADER LINE,
      DPATH    LIKE EPSF-EPSDIRNAM,
      MDATE    LIKE SY-DATUM,
      MTIME    LIKE SY-UZEIT.
DATA: BEGIN OF FATTR OCCURS 0,
          FILE_NAME  LIKE EPSF-EPSFILNAM,
          FILE_SIZE  LIKE EPSF-EPSFILSIZ,
          FILE_OWNER LIKE EPSF-EPSFILOWN,
          FILE_MODE  LIKE EPSF-EPSFILMOD,
          FILE_TYPE  LIKE EPSF-EPSFILTYP,
          FILE_MTIME(12),
      END OF FATTR.
DATA: P_PATH(50) TYPE C.
CONCATENATE '/ARCHIVE/' sy-sysid '/archive' INTO P_PATH.
*        WRITE: / P_PATH.
DPATH = P_PATH.
*Get files in folder - read into internal table DLIST
*if filenames are longer than 40 characters
*then use FM SUBST_GET_FILE_LIST.
CALL FUNCTION 'EPS_GET_DIRECTORY_LISTING'
     EXPORTING
          DIR_NAME               = DPATH
     TABLES
          DIR_LIST               = DLIST
     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 EQ 0.
*Step 2: Read the file attributes into an internal table
*Read info about the files (attributes) into the internal table FATTR
*as we need info about the last time it was changed (MTIME)
  LOOP AT DLIST.
    CALL FUNCTION 'EPS_GET_FILE_ATTRIBUTES'
         EXPORTING
              FILE_NAME              = DLIST-NAME
              DIR_NAME               = DPATH
         IMPORTING
              FILE_SIZE              = FATTR-FILE_SIZE
              FILE_OWNER             = FATTR-FILE_OWNER
              FILE_MODE              = FATTR-FILE_MODE
              FILE_TYPE              = FATTR-FILE_TYPE
              FILE_MTIME             = FATTR-FILE_MTIME
         EXCEPTIONS
              READ_DIRECTORY_FAILED  = 1
              READ_ATTRIBUTES_FAILED = 2
              OTHERS                 = 3.
    IF SY-SUBRC EQ 0.
      FATTR-FILE_NAME = DLIST-NAME.
      APPEND FATTR.
    ENDIF.
  ENDLOOP.
  SORT FATTR BY FILE_NAME.
  DATA: time(10), date LIKE sy-datum.
  DATA: months TYPE i.
  DATA: e_file TYPE string.
  LOOP AT FATTR.
  CLEAR: time, months, e_file.
    IF FATTR-FILE_NAME(10) = 'archive_BW'.
*Convert the unix time into readable time
      PERFORM p6_to_date_time_tz(rstr0400) USING FATTR-FILE_MTIME
                                                 time
                                                 date.
*Calculate the number of months between date (MTIME) and current day
*ex 31.03.2009 - 01.04.2009 = 1 month
*ex 01.02.2009 - 01.04.2009 = 2 month
    CALL FUNCTION 'MONTHS_BETWEEN_TWO_DATES'
      EXPORTING
        i_datum_von = date
        i_datum_bis = sy-datum
      IMPORTING
        e_monate = months.
        CONCATENATE DPATH '/' FATTR-FILE_NAME INTO e_file.
*        WRITE: / FATTR-FILE_NAME,
*                 FATTR-FILE_SIZE,
*                 date,
*                 time,
*                 sy-datum,
*                 months,
*                 e_file.
*Step 3: Delete files where months > 1
      IF months > 1.
        OPEN dataset e_file for output in text mode encoding default.
        DELETE dataset e_file.
        CLOSE dataset e_file.
      ENDIF. "months > 1
    ENDIF.
  ENDLOOP.
ENDIF.

Similar Messages

  • Error while reading excel file from application server into internal table.

    Hi experts,
    My requirement is to read an excel file from application server into internal table.
    Hence I have created an excel file fm_test_excel.xls in desktop and uploaded to app server using CG3Z tcode (as BIN file type).
    Now in my program I have used :
    OPEN DATASET v_filename FOR INPUT IN text mode encoding default.
    DO.
    READ DATASET v_filename INTO wa_tab.
    The statement OPEN DATASET works fine but I get a dump (conversion code page error) at READ DATASET statement.
    Error details:
    A character set conversion is not possible.
    At the conversion of a text from codepage '4110' to codepage '4103':
    - a character was found that cannot be displayed in one of the two
    codepages;
    - or it was detected that this conversion is not supported
    The running ABAP program 'Y_READ_FILE' had to be terminated as the conversion
    would have produced incorrect data.
    The number of characters that could not be displayed (and therefore not
    be converted), is 445. If this number is 0, the second error case, as
    mentioned above, has occurred.
    An exception occurred that is explained in detail below.
    The exception, which is assigned to class 'CX_SY_CONVERSION_CODEPAGE', was not
    caught and
    therefore caused a runtime error.
    The reason for the exception is:
    Characters are always displayed in only a certain codepage. Many
    codepages only define a limited set of characters. If a text from a
    codepage should be converted into another codepage, and if this text
    contains characters that are not defined in one of the two codepages, a
    conversion error occurs.
    Moreover, a conversion error can occur if one of the needed codepages
    '4110' or '4103' is not known to the system.
    If the conversion error occurred at read or write of  screen, the file
    name was '/usr/sap/read_files/fm_test_excel.xls'. (further information about
    the file: "X 549 16896rw-rw----201105170908082011051707480320110517074803")
    Also let me know whether this is the proper way of reading excel file from app server, if not please suggest an alternative .
    Regards,
    Karthik

    Hi,
    Try to use OPEN DATASET v_filename FOR INPUT IN BINARY mode encoding default. instead of OPEN DATASET v_filename FOR INPUT IN text mode encoding default.
    As I think you are uploading the file in BIN format to Application server and trying to open text file.
    Regards,
    Umang Mehta

  • Pull multiple excel files in a folder into a table.

    Hello,
    I am using the instructions available in the link below to pull multiple excel files in a folder into a table.
    http://stackoverflow.com/questions/6190578/how-to-import-excel-files-with-different-names-and-same-schema-into-database 
    The instructions use two variables FilePath & FolderPath which i would like to record into another table. I dont have coding experience and therefore i am stuck. I see the code above but i am unable to modify for my usage.
    Any help would be greatly appreciated.

    TopCat,
    If you wanna read the Filepath/FOlderpath values from a table int he database, use the Single row resultset option of Execute SQL task. That should help. refer:
    http://stackoverflow.com/questions/18828498/ssis-set-multiple-variables-via-a-single-sql-task
    http://technet.microsoft.com/en-us/library/cc280492.aspx (populating a variable with resultset section)
    For recording the path variable data to a table in database, use ExecuteSQL task to achieve the functionality again:
    Bind the variable data into  a sql variable : smthin like
    "INSERT INTO Data_Result(Result) VALUES ('"+@[USER::my_data]+"')"
    Then use this sql variable as the statement to be executed in execute sql task.
    Thanks,
    Jay
    <If the post was helpful mark as 'Helpful' and if the post answered your query, mark as 'Answered'>

  • Issue with uploading XML file from application server into internal table

    i Need to fetch the XML file from the application server and place into internal table and i am getting error message while using the functional module   SMUM_XML_PARSE and the error message is "line   1 col   1-unexpected symbol; expected '<', '</', entity reference, character data, CDATA section, processing instruction or comment" and could you please let me know how to resolve this issue?  
        TYPES: BEGIN OF T_XML,
                 raw(2000) TYPE C,
               END OF T_XML.
    DATA:GW_XML_TAB TYPE  T_XML.
    DATA:  GI_XML_TAB TYPE TABLE OF T_XML INITIAL SIZE 0.
    DATA:GI_STR TYPE STRING.
    data:  GV_XML_STRING TYPE XSTRING.
    DATA: GI_XML_DATA TYPE  TABLE OF SMUM_XMLTB INITIAL SIZE 0.
    data:GI_RETURN TYPE STANDARD TABLE OF BAPIRET2.
        OPEN DATASET LV_FILE1 FOR INPUT IN TEXT MODE ENCODING DEFAULT.
        IF SY-SUBRC NE 0.
          MESSAGE 'File does not exist' TYPE 'E'.
        ELSE.
          DO.
    * Transfer the contents from the file to the work area of the internal table
            READ DATASET LV_FILE1 INTO GW_XML_TAB.
            IF SY-SUBRC EQ 0.
              CONDENSE GW_XML_TAB.
    *       Append the contents of the work area to the internal table
              APPEND GW_XML_TAB TO GI_XML_TAB.
            ELSE.
              EXIT.
            ENDIF.
          ENDDO.
        ENDIF.
    * Close the file after reading the data
        CLOSE DATASET LV_FILE1.
        IF NOT GI_XML_TAB IS INITIAL.
          CONCATENATE LINES OF GI_XML_TAB INTO GI_STR SEPARATED BY SPACE.
        ENDIF.
    * The function module is used to convert string to xstring
        CALL FUNCTION 'SCMS_STRING_TO_XSTRING'
          EXPORTING
            TEXT   = GI_STR
          IMPORTING
            BUFFER = GV_XML_STRING
          EXCEPTIONS
            FAILED = 1
            OTHERS = 2.
        IF SY-SUBRC <> 0.
          MESSAGE 'Error in the XML file' TYPE 'E'.
        ENDIF.
      ENDIF.
      IF GV_SUBRC = 0.
    * Convert XML to internal table
        CALL FUNCTION 'SMUM_XML_PARSE'
          EXPORTING
            XML_INPUT = GV_XML_STRING
          TABLES
            XML_TABLE = GI_XML_DATA
            RETURN    = GI_RETURN.
      ENDIF.
      READ TABLE GI_RETURN TRANSPORTING NO FIELDS WITH KEY TYPE = 'E'.
      IF SY-SUBRC EQ 0.
        MESSAGE 'Error converting the input XML file' TYPE 'E'.
      ELSE.
        DELETE GI_XML_DATA WHERE TYPE <> 'V'.
        REFRESH GI_RETURN.
      ENDIF.

    Could you please tel me  why the first 8 lines were removed, till <Soap:Body and also added the line <?xml version="1.0" encoding="UTF-8"?> in the beggining .
    Becuase there will be lot of  XML files will be coming from the Vendor daily and that should be uploaded in the application server and should update in the SAP tables based on the data in the XML file.
    what information i need to give to vendor that do not add the first 8 lines in the XML file and add the line in the beggining <?xml version="1.0" encoding="UTF-8"?>   ??????
    Is there any other way we can do with out removing the lines?

  • How to transfer excel files(on ftp server) into internal table?

    hello,everyone
    pls tell me how to transfer excel files those on a ftp server into internal table?
    ps.i know the function 'ftp_server_to_r3',it can help to transfer flat file.

    Hi,
    I believe you want to get the data from the FTP Server to R3.
    I am also sending the code. Have a look and it would help you.
    First get the Password and user name and the FTP Server Path where file is stored and FTP Server Host name
    FUNCTION zfi_ftp_get.
    *"*"Local Interface:
    *"  IMPORTING
    *"     VALUE(I_FILENAME) TYPE  C
    *"  TABLES
    *"      T_BLOB STRUCTURE  ZFI_TLM_LENGTH OPTIONAL " is a table type with a field called line of length 992
    *"      RETURN STRUCTURE  BAPIRET2 OPTIONAL
      DATA : i_password(30)     TYPE c,
             i_user(30)         TYPE c,
             i_host(30)         TYPE c,
             i_rfc_destination  TYPE rfcdes-rfcdest,
             i_length           TYPE i,
             i_folder_path(100) TYPE c.
      DATA:   lv_blob_length   TYPE i.
      DATA:   lv_length        TYPE i,  "Password length
              lv_key           TYPE i VALUE 26101957,
              lv_password(30)  TYPE c,
              lv_ftp_handle    TYPE i,
              lv_cmd(80)       TYPE c.
      DATA: BEGIN OF result OCCURS 0,
            line(100) TYPE c,
            END OF result.
      TYPES: BEGIN OF ty_dummy,
             line(392) TYPE c,
           END   OF ty_dummy.
      DATA: lt_dummy TYPE TABLE OF ty_dummy,
            ls_dummy LIKE LINE  OF lt_dummy.
      i_password        = 'vnhdh'.
      i_user            = 'sdkgd'.
      i_host            = 'sbnksbg'.
      i_rfc_destination = 'SAPFTP'.
      i_length          = '992'.
      i_folder_path     = '/hioj/hohjk/hh'.
      lv_length = STRLEN( i_password ).
      CALL FUNCTION 'HTTP_SCRAMBLE'
        EXPORTING
          SOURCE      = i_password
          sourcelen   = lv_length
          key         = lv_key
        IMPORTING
          destination = lv_password.
      CALL FUNCTION 'FTP_CONNECT'
        EXPORTING
          user            = i_user
          password        = lv_password
          host            = i_host
          rfc_destination = i_rfc_destination
        IMPORTING
          handle          = lv_ftp_handle
        EXCEPTIONS
          not_connected   = 1
          OTHERS          = 2.
      IF sy-subrc = 1.
        return-type = 'E' .
        return-message = 'FTP Connection not Successful'.
        APPEND return.
      ELSEIF sy-subrc = 2.
        return-type = 'E' .
        return-message = 'FTP Connection not Successful'.
        APPEND return.
      ELSEIF sy-subrc EQ 0.
        return-type = 'S' .
        return-message = 'FTP Connection Successful'.
        APPEND return.
        CONCATENATE 'cd' i_folder_path INTO lv_cmd SEPARATED BY space.
        CALL FUNCTION 'FTP_COMMAND'
          EXPORTING
            handle        = lv_ftp_handle
            command       = lv_cmd
          TABLES
            data          = result
          EXCEPTIONS
            command_error = 1
            tcpip_error   = 2.
        IF sy-subrc = 1.
          return-type = 'E' .
          return-message = 'Command Error Occured during open of FTP Folder'.
          APPEND return.
        ELSEIF sy-subrc = 2.
          return-type = 'E' .
          return-message = 'TCIP Error Occured during open of FTP Folder'.
          APPEND return.
        ELSE.
          REFRESH t_blob.
          lv_blob_length = 992.
          TRANSLATE i_filename TO LOWER CASE.
          CALL FUNCTION 'FTP_SERVER_TO_R3'
            EXPORTING
              handle      = lv_ftp_handle
              fname       = i_filename         
            IMPORTING
              blob_length = lv_blob_length
            TABLES
              blob        = lt_dummy.
          t_blob[] = lt_dummy[].
        ENDIF.
      ENDIF.
    ENDFUNCTION.
    Regards
    Sajid
    Edited by: shaik sajid on Nov 16, 2010 7:25 AM

  • How to upload all excel files data from one folder into internal table.

    Dear All,
    I have one requirement, It is like I want to upload the frontend file data into my internal table, But here my scenario is;
    If I have one folder ( Called : Temp) in my frontend system, in this folder ( Called : Temp)  I have 100 excel files. In each excel file I have some 1000u2019s of entries. All these data of every file I want to take into my internal table.
    If I have one file I can go for, CALL METHOD cl_gui_frontend_services=>file_open_dialog and then upload method to upload. But I want to take all these excel files from that folder at a time, is there any class or any thing is there..? plz help..
    Thanks...
    Edited by: satishsuri on Jan 11, 2011 9:33 AM

    Hi satishsuri ,
    You will have to use 3 methods together :
    CALL METHOD cl_gui_frontend_services=>directory_browse "Browse the Directory
    CALL METHOD cl_gui_frontend_services=>directory_list_files "Get all the files from the directory
    CALL METHOD cl_gui_frontend_services=>gui_upload "Upload each file in a loop
    Example:
    TYPES: BEGIN OF ty_data,
             line TYPE string,
          END OF ty_data.
    DATA: str_file TYPE string,
          str_dir TYPE string,
          it_file_table TYPE STANDARD TABLE OF file_info,
          wa_file_table TYPE file_info,
          v_count TYPE i,
          it_data TYPE STANDARD TABLE OF ty_data,
          wa_data TYPE ty_data.
    CALL METHOD cl_gui_frontend_services=>directory_browse
      CHANGING
        selected_folder = str_dir.
    CALL METHOD cl_gui_frontend_services=>directory_list_files
      EXPORTING
        directory  = str_dir
      CHANGING
        file_table = it_file_table
        count      = v_count.
    LOOP AT it_file_table INTO wa_file_table.
      CONCATENATE str_dir wa_file_table-filename INTO str_file SEPARATED BY '\'.
      CALL METHOD cl_gui_frontend_services=>gui_upload
        EXPORTING
          filename = str_file
          filetype = 'ASC'
        CHANGING
          data_tab = it_data.
      LOOP AT it_data INTO wa_data.
        WRITE : / wa_data-line.
      ENDLOOP.
      ULINE.
    ENDLOOP.
    Regards,
    Jovito

  • How to read a txt file then insert them into db tables

    Hi,
    Please help me to solve this problem. This is what I need to do:
    1. read a text file which holds the values to be inserted into some database tables. For example it holds ename, deptno, sal, dname for emp and dept tables. These are in a text file now.
    2. Then I need to insert these data into db tables like emp and dept, and check if there are dups or voilate any constraints. The records to be inserted are usually > 100,000, so I am also looking for a fast way to do this.
    3. This operation happens regularly, so I need to schedule the job. I know this can be done by using procedures and dbms_jobs.
    Any help will be greately appreciated.

    Generally, in 8i, folks would use sql loader to accomplish this. Sql loader does exactly what you want, but is an external application, so it would probably be easiest to schedule it to run using your operating system's scheduler (i.e. cron on Unix, Task Scheduler on Windows). You could certainly write a PL/SQL procedure that called the external sql loader application, and use the Oracle scheduler to schedule it, but that strikes me as more effort than it's worth.
    If you're using 9i, you could look into external tables, which would simplify the process greatly.
    Justin

  • Upload a file of Excel Format into Internal Table!!!

    Dear All,
    Currently i have a question for upload a file of excel format, I can just convert the file of excel format to text format first. Then it would be OK.
    As we all know, Frequently,The users would always like to provide the excel format to us. Thus, Is there any solutions directly uploaded the file of Excel format into database for web dynpro for ABAP? Not web dynpro for Java.
    Appreciated what you reply!
    Thanks in advance.
    Richard

    Richard,
    I saw my developer use LSMW to load the excel file to the db table. You must careful with the data that you're going to upload.
    Cheers.
    P/S Point reward is appreciated.

  • Upload excel file (xls) into internal table in SRM 4.0

    Hi experts!
    I need upload a xls file into internal table (in ABAP report) in EBP machine for i work with data in the sheets. Can you help me?
    Best Regard!

    Hi Zeky,
    Try GUI_UPLOAD method of the class CL_GUI_FRONTEND_SERVICES
    or FM ALSM_EXCEL_TO_INTERNAL_TABLE
    Please look at this threads too:
    /people/thomas.jung3/blog/2004/09/02/creating-a-bsp-extension-for-downloading-a-table
    Upload XLS file from Application server into internal table.
    Regards,
    Marcin Gajewski
    please reward points for helpful answers

  • How to read only particualr columns from excel sheet to internal table

    Hi,
    I have and excel sheet which has around 20 columns, in which i want to read only 6 columns. They are at different column positions, means the 1st column, 6thcolumn, 8th column so on..
    Can we do this in sap? do we have any FM to do this?
    Thanks.
    Praveena.

    hi,
    Use the below logic to fetch the data into internal table..You need to read the data cell by cell and update the internal table,
    DATA l_count TYPE sy-tabix.
       CONSTANTS: lc_begin_col TYPE i VALUE '1',
                  lc_begin_row TYPE i VALUE '2',
                  lc_end_col   TYPE i VALUE '2',
                  lc_end_row   TYPE i VALUE '3000'.
      CLEAR p_i_excel_data. REFRESH p_i_excel_data.
    * Function module to read excel file and convert it into internal table
       CALL FUNCTION 'KCD_EXCEL_OLE_TO_INT_CONVERT'
         EXPORTING
           filename                = p_p_file
           i_begin_col             = lc_begin_col
           i_begin_row             = lc_begin_row
           i_end_col               = lc_end_col
           i_end_row               = lc_end_row
         TABLES
           intern                  = i_data
         EXCEPTIONS
           inconsistent_parameters = 1
           upload_ole              = 2
           OTHERS                  = 3.
    * Error in file upload
       IF sy-subrc NE 0 .
         MESSAGE text-006 TYPE 'E'.
         EXIT.
       ENDIF.
       IF i_data[] IS INITIAL .
         MESSAGE text-007 TYPE 'E'.
         EXIT.
       ELSE.
         SORT i_data BY row col .
    * Loop to fill data in Internal Table
         LOOP AT i_data .
           MOVE i_data-col TO l_count .
           ASSIGN COMPONENT l_count OF STRUCTURE p_i_excel_data TO <fs_source> .
           MOVE i_data-value TO <fs_source> .
           AT END OF row .
    * Append data into internal table
             APPEND p_i_excel_data.
             CLEAR p_i_excel_data.
           ENDAT .
         ENDLOOP .
       ENDIF .

  • Question about reading csv file into internal table

    Some one (thanks those nice guys!) in this forum have suggested me to use FM KCD_CSV_FILE_TO_INTERN_CONVERT to read csv file into internal table. However, it can be used to read a local file only.
    I would like to ask how can I read a CSV file into internal table from files in application server?
    I can't simply use SPLIT as there may be comma in the content. e.g.
    "abc","aaa,ab",10,"bbc"
    My expected output:
    abc
    aaa,ab
    10
    bbb
    Thanks again for your help.

    Hi Gundam,
    Try this code. I have made a custom parser to read the details in the record and split them accordingly. I have also tested them with your provided test cases and it work fine.
    OPEN DATASET dsn FOR input IN TEXT MODE ENCODING DEFAULT.
    DO.
    READ DATASET dsn INTO record.
      PERFORM parser USING record.
    ENDDO.
    *DATA str(32) VALUE '"abc",10,"aaa,ab","bbc"'.
    *DATA str(32) VALUE '"abc","aaa,ab",10,"bbc"'.
    *DATA str(32) VALUE '"a,bc","aaaab",10,"bbc"'.
    *DATA str(32) VALUE '"abc","aaa,ab",10,"b,bc"'.
    *DATA str(32) VALUE '"abc","aaaab",10,"bbc"'.
    FORM parser USING str.
    DATA field(12).
    DATA field1(12).
    DATA field2(12).
    DATA field3(12).
    DATA field4(12).
    DATA cnt TYPE i.
    DATA len TYPE i.
    DATA temp TYPE i.
    DATA start TYPE i.
    DATA quote TYPE i.
    DATA rec_cnt TYPE i.
    len = strlen( str ).
    cnt = 0.
    temp = 0.
    rec_cnt = 0.
    DO.
    *  Start at the beginning
      IF start EQ 0.
        "string just ENDED start new one.
        start = 1.
        quote = 0.
        CLEAR field.
      ENDIF.
      IF str+cnt(1) EQ '"'.  "Check for qoutes
        "CHECK IF quotes is already set
        IF quote = 1.
          "Already quotes set
          "Start new field
          start = 0.
          quote = 0.
          CONCATENATE field '"' INTO field.
          IF field IS NOT INITIAL.
            rec_cnt = rec_cnt + 1.
            CONDENSE field.
            IF rec_cnt EQ 1.
              field1 = field.
            ELSEIF rec_cnt EQ 2.
              field2 = field.
            ELSEIF rec_cnt EQ 3.
              field3 = field.
            ELSEIF rec_cnt EQ 4.
              field4 = field.
            ENDIF.
          ENDIF.
    *      WRITE field.
        ELSE.
          "This is the start of quotes
          quote = 1.
        ENDIF.
      ENDIF.
      IF str+cnt(1) EQ ','. "Check end of field
        IF quote EQ 0. "This is not inside quote end of field
          start = 0.
          quote = 0.
          CONDENSE field.
    *      WRITE field.
          IF field IS NOT INITIAL.
            rec_cnt = rec_cnt + 1.
            IF rec_cnt EQ 1.
              field1 = field.
            ELSEIF rec_cnt EQ 2.
              field2 = field.
            ELSEIF rec_cnt EQ 3.
              field3 = field.
            ELSEIF rec_cnt EQ 4.
              field4 = field.
            ENDIF.
          ENDIF.
        ENDIF.
      ENDIF.
      CONCATENATE field str+cnt(1) INTO field.
      cnt = cnt + 1.
      IF cnt GE len.
        EXIT.
      ENDIF.
    ENDDO.
    WRITE: field1, field2, field3, field4.
    ENDFORM.
    Regards,
    Wenceslaus.

  • To relocate mail.log, mail.log_current file to specific folder

    Hi
    We have configured CommSuite 6 in single host. The output of “imsimta version”:
    Sun Java(tm) System Messaging Server 7.0-0.04 32bit (built Jun 20 2008)
    libimta.so 7.0-0.04 32bit (built 01:01:00, Jun 20 2008)
    Using /opt/sun/comms/messaging/config/imta.cnf
    SunOS mail 5.10 Generic_120012-14 i86pc i386 i86pc
    Output of imta_tailor file:
    IMTA_USER=mailsrv
    IMTA_USER_USERNAME=nobody
    IMTA_WORLD_GROUP=mail
    IMTA_LOG=/logs/messaging/imta
    IMTA_PRIMARY_LOG=/logs/messaging/imta/mail.log_current
    IMTA_SECONDARY_LOG=/logs/messaging/imta/mail.log_yesterday
    IMTA_TERTIARY_LOG=/logs/messaging/imta/mail.log
    We need to relocate mail.log, mail.log_current, mail.log_yesterday file to specific folder.
    After above setting we cannot be able to relocate above file.
    Pl. help us.
    Thanks
    P.K.

    world.group wrote:
    We have configured CommSuite 6 in single host. The output of &#147;imsimta version&#148;:Please note that CommSuite 6 update 1 is now available and it is advisable that you upgrade using the "commpkg upgrade" command.
    IMTA_LOG=/logs/messaging/imta
    IMTA_PRIMARY_LOG=/logs/messaging/imta/mail.log_current
    IMTA_SECONDARY_LOG=/logs/messaging/imta/mail.log_yesterday
    IMTA_TERTIARY_LOG=/logs/messaging/imta/mail.logThese parameters are now ignored as per the Messaging Server 7.0 release notes:
    http://wikis.sun.com/display/CommSuite6/Messaging+Server+7.0+Release+Notes#MessagingServer7.0ReleaseNotes-Ignoredimtatailorsettings
    We need to relocate mail.log, mail.log_current, mail.log_yesterday file to specific folder. You can relocate the MTA log directory through the use of symlinks.
    Regards,
    Shane.

  • Read local folder, return filenames into internal table

    Assume I have 3 files in c:\abc folder:
    a1.xls
    a2.xls
    a6.xls
    Is there a fm or code sample to pass in folder name (ie c:\abc) and returns a1.xls, a2.xls and a6.xls into internal table?

    Use Class CL_GUI_FRONTEND_SERVICES Method DIRECTORY_LIST_FILES to get list of file in a folder . FILE_TABLE will give the table with list of files
    data: begin of itab ,
            file(26) type c,
          end of itab.
    data: tab type table of itab.
    data : cnt type i.
    CALL METHOD CL_GUI_FRONTEND_SERVICES=>DIRECTORY_LIST_FILES
      EXPORTING
        DIRECTORY                   = 'C:\temp'
    *    FILTER                      = '*.*'
    *    FILES_ONLY                  =
    *    DIRECTORIES_ONLY            =
      CHANGING
        FILE_TABLE                  = tab
        COUNT                       = cnt
    *  EXCEPTIONS
    *    CNTL_ERROR                  = 1
    *    DIRECTORY_LIST_FILES_FAILED = 2
    *    WRONG_PARAMETER             = 3
    *    ERROR_NO_GUI                = 4
    *    NOT_SUPPORTED_BY_GUI        = 5
    *    others                      = 6
    IF SY-SUBRC <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.

  • Error While reading an Excel file from KM Folder.

    Hi Guru's,
    In my PDK Application I am trying to read an Excel file from KM Folder.
    Workbook workbook = Workbook.getWorkbook(new File("/irj/go/km/docs/documents/test/Test.xls"));
    It gives an error:
    Error:java.io.FileNotFoundException: \irj\go\km\docs\documents\test\Test.xls (The system cannot find the path specified)
    Details of appli:
    In my JspDynpage I am calling a utility Java file.
    There I have to read an  Excel and to passit to JSP.
    Details of jar files  used:
      jxl-2.6
      com.sap.security.api.jar
    Regards,
    Ram

    Hi,
    You are trying to read file wrong way. In the tutorial of Java Excel Api: "JExcelApi can read an Excel spreadsheet from a file stored on the local filesystem or from some input stream.". You are trying to read from file system. So you must get file input stream then you can read it. Please search forums KM file read.

  • Read all the files in a folder over and over again

    I want to develop an application that reads all the files in a folder, and once its done reading those files it reads all the files again.
    The purpose for this application is to read all the files in a folder that are continuously being stored in that folder, so that when a new file is created, that file is also read by the application. I then need to compare the date and time in which the file was created to the actual date and time of the system, so that way I can get the most recent file, and then  I will do other operations with this file.
    The thing is that I know how to read all the files in a directory, but I don't know how to cycle through those files again, in order to look for the most recent one, and I don't know how to make the comparison of the time stamps, because I need a precision of one second in the system time and the time the file was created.
    Can someone please help me?
    Thanks in advance!
    Solved!
    Go to Solution.

    I think that I just went the wrong direction.
    What I wanted to do in the first place, was to rename and overwrite every new file in a directory with the same name and file extension, so that every new file overwrites the old file. The thing is that the list folder only lists the files the first time and then keeps on telling me there are no files to be read even though there are new files.
    What I need now is a way to overwrite the old files with the same name, and keep searching for every new file that is going to be stored in the directory.
    I will leave the code that I have right now, so that you can tell me what do I need to modify in order to read every new file that's going to be created in that directory.
    Thanks in advance for your help!
    Attachments:
    Overwrite Files.vi ‏12 KB

Maybe you are looking for

  • How to open a file with a specific program

    I would like to do this in applescript instead of the terminal. I would like to pick the application and the file in the same command so to avoid opening a blank document. open -a textedit /Users/mac/Desktop/GNPRC.doc

  • I recently updated my iPhone to iOS 6.0 and all my contacts have updated

    Since completing the recent iPhone iOS 6.0 update, all my contact details have updated as well and I'd like to know how this happened. For example, a friend who I only had in with her first name, now has first and last name? Other contacts have added

  • Recording off when exported to Quicktime

    I created a presentation in Keynote, then recorded the slideshow to add voiceover.  I then exported to QuickTime, with the recorded timing feature checked off.  All seemed good, until about 3 slides into the presentation and the voiceover was off a s

  • Deleting Utterances Without Splitting

    Hey all, I am new to Garage Band having worked with Adobe Audition and Audacity for many years now. So far GB has not been intuitive to me so bear with my explanation of this issue. I have found nothing online or in this forum pertaining to my questi

  • Blackberry ID and secret question

    I have forgotten my blackberry id and the secret question. What can I do to reset them?