Skip to Content
author's profile photo Former Member
Former Member

Files to be upload are many

Hi ,

We have a scenario where we have to upload data from around 500 files which will be dumpted at one location.

We can have a proper name also for them but is it possible that all will be read and updated .

Incase you have any code related to same , please share.

Regards

Rahul

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • author's profile photo Former Member
    Former Member
    Posted on May 19, 2008 at 03:02 PM

    Rahul,

    Am assuming that in your case all the files are dumped on the application server. If that is the case use the below function module to get all the file names from the dumped directory.

    EPS_GET_DIRECTORY_LISTING

    Now read file names one by one and use OPEN DATASET <filename>................CLOSE DATASET for each file.

    ********Reward points if useful.

    Regards,

    Kiran Bobbala.

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Rahul,

      this code is what u are searching for.

      Reward Points if it is usefull, are very appreciated 😊

      Andrea

      FORM get_all_files .
      
        DATA: BEGIN OF file,
                dirname(75) TYPE c, " name of directory. (possibly truncated.)
                name(75)    TYPE c, " name of entry. (possibly truncated.)
                type(10)    TYPE c,            " type of entry.
                len(8)      TYPE p,            " length in bytes.
                owner(8)    TYPE c,            " owner of the entry.
                mtime(6)    TYPE p, " last modification date, seconds since 1970
                mode(9)     TYPE c, " like "rwx-r-x--x": protection mode.
                useable(1)  TYPE c,
                subrc(4)    TYPE c,
                errno(3)    TYPE c,
                errmsg(40)  TYPE c,
                mod_date    TYPE d,
                mod_time(8) TYPE c,            " hh:mm:ss
                seen(1)     TYPE c,
                changed(1)  TYPE c,
              END OF file.
      
        DATA: BEGIN OF searchpoints OCCURS 10,
                dirname(75) TYPE c,            " name of directory.
                sp_name(75) TYPE c,            " name of entry. (may end with *)
                sp_cs(10)   TYPE c, " ContainsString pattern for name.
              END OF searchpoints.
      
        DATA len TYPE i.
      
      *Lettura della data/ora del file
        searchpoints-dirname = pathdata. "For example /usr/sap/tmp/
      
        CALL 'C_DIR_READ_FINISH'             " just to be sure
             ID 'ERRNO'  FIELD file-errno
             ID 'ERRMSG' FIELD file-errmsg.
      
        CALL 'C_DIR_READ_START' ID 'DIR'    FIELD searchpoints-dirname
                                ID 'FILE'   FIELD searchpoints-sp_name
                                ID 'ERRNO'  FIELD file-errno
                                ID 'ERRMSG' FIELD file-errmsg.
        CHECK sy-subrc EQ 0.
        DO.
          CLEAR file.
          CALL 'C_DIR_READ_NEXT'
            ID 'TYPE'   FIELD file-type
            ID 'NAME'   FIELD file-name
            ID 'LEN'    FIELD file-len
            ID 'OWNER'  FIELD file-owner
            ID 'MTIME'  FIELD file-mtime
            ID 'MODE'   FIELD file-mode
            ID 'ERRNO'  FIELD file-errno
            ID 'ERRMSG' FIELD file-errmsg.
      
          IF sy-subrc EQ 0.
            IF file-name CS pfname.
              len = STRLEN( file-name ).
              CHECK len = 12.  "Get only files length 12 char -> u can omiss this
              CONCATENATE pathdata file-name INTO ilistfile-filename.
              APPEND ilistfile. "The file list
            ENDIF.
          ELSE.
            EXIT.
          ENDIF.
        ENDDO.
      
      ENDFORM.                    " get_all_files
      

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.