How to work with files in folders on Application/Presentation Server

Hi,
I am working on interface program in which files are populated in folders in application/presentation server in the format 'ABCsy-datumsy-uzeit.txt'(e.g.ABC20051022161450.txt,ABC20051022161455.txt ) in directory c:\temp.
I want to sort all these files and read in sorted manner.
can anybody help me out in this.
waiting for reply.
thanks & regards,
Nitin

Hi,
  This logic will work for files on presentation server,
DATA:  l_count TYPE i,
       l_filename TYPE string,
       t_files TYPE string OCCURS 0 WITH HEADER LINE,
       BEGIN OF t_files_sorted OCCURS 0,
         file_prefix(3),
         file_date LIKE sy-datum,
         file_time LIKE sy-uzeit,
         file_extension(4),
       END OF t_files_sorted,
       t_text TYPE TABLE OF w3html.
CALL METHOD cl_gui_frontend_services=>directory_list_files
  EXPORTING
    directory                   = 'C:\Temp'
    FILTER                      = '*.txt'
     files_only                  = 'X'
   DIRECTORIES_ONLY            =
  CHANGING
    file_table                  = t_files[]
    count                       = l_count
  EXCEPTIONS
    cntl_error                  = 1
    directory_list_files_failed = 2
    wrong_parameter             = 3
    error_no_gui                = 4
    OTHERS                      = 5.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
           WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
LOOP AT t_files.
  t_files_sorted = t_files.
  APPEND t_files_sorted.
ENDLOOP.
SORT t_files_sorted BY file_date file_time.
LOOP AT t_files_sorted.
  CONCATENATE 'C:\Temp\' t_files_sorted INTO l_filename.
  CALL METHOD cl_gui_frontend_services=>gui_upload
    EXPORTING
      filename                = l_filename
     FILETYPE                = 'ASC'
     HAS_FIELD_SEPARATOR     = SPACE
     HEADER_LENGTH           = 0
   IMPORTING
     FILELENGTH              =
     HEADER                  =
    changing
      data_tab                = t_text[]
    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.
  MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.
*****Your processing here..
ENDLOOP.
Also, use the FM that MAX has if you have to work with files on application server by replacing code in the above logic at appropriate places, like replace
cl_gui_frontend_services=>directory_list_files
with the corresponding fm
and replace cl_gui_frontend_services=>gui_upload
with OPEN DATASET...
     CLOSE DATASET...
logic.
Hope this helps..
Sri
Message was edited by: Srikanth Pinnamaneni

Similar Messages

  • Cannot print "working with files and folders htm

    When I try to print "Working with files-and-folders" from a Google search, it only prints part of it. I have changed my destination folder to no avail. Thank you or any help, Jack Menendez

    What's the best method for moving all my nonsystem related stuff over to this new driveIan has provided you with the best solution, SuperDuper.
    But if you have a 250 GB external, you really ought to clone your entire system,(only about 3 GB) so you have a backup.
    I keep mine with a complete clone of my internal, that way it is easy to boot from the external and run utilities like Disk Utility, TechToolPro, DiskWarrior, etc. on the internal and vice versa.
    If you run into a problem with say Preferences and don't know which one is the troublemaker, just trash the whole pref folder and use the good one from the clone. Font problem, same deal. And, if diaster ever strikes, you can just boot up from your external and keep right on working - fix the internal when you have time.
    That's my 2 cents anyway
    -mj
    [email protected]

  • How to work with file system in linux within a JSF app?

    I use this line in my backing bean to log some events:
    FileHandler fhxml = new FileHandler("../webapps/MyWebApp/Log/MyWebAppLog.xml", append);
    fhxml.setFormatter(new XMLFormatter());That works fine in windows but when I deploy it in my Tomcat 6 in linux It doesn't work. How can I work with file system in linux?

    You should never use relative paths to access the filesystem. The path would be relative to the current working directory which is not per se the same in all environments. To convert a relative web path to an absolute file system path, you need ServletContext#getRealPath(). Use this absolute file system path in the java.io stuff. In a JSF application on top of Servlet API you can get the underlying ServletContext by ExternalContext#getContext().
    Alternatively, if the file is located in one of the default paths of the classpath or if its path is added to the classpath, you can also just use ExternalContext#getResource() or even #getResourceAsStream() using just the file name.

  • How To Work With File Path in Forms

    Hi
    I have one button on form i use it to call microsoft word when i finsh work i want to save my word file then open save DIALOG box to save that file
    i want to take that path from save dialog box to text item in my form
    how can i do this ?

    If you are using Forms version 9.x or newer, you can use WebUtil to open Word on the client machine, Save the Word file, then do whatever you'd like with the path where the file was saved. If you are using an older version in client/server mode and not web, you would do something similar ony you would use OLE from within the form to call Word.
    In short, we cannot offer much information because you did not provide enough detail about what you are doing, how you are doing it and which product and platform versions you are using.
    WebUtil is included in Forms 10.1.2, so there is no need to download it. In version 9, you would need to manually download and configure it from here:
    http://www.oracle.com/technology/products/forms/htdocs/webutil/webutil.htm

  • How to work with files in alsb 3.0

    My requirements are 1)Take the file from calling system (How to do this) 2) perform logic on it 3) create a new response file in target/clinet system.

    My requirements are 1)Take the file from calling system (How to do this) 2) perform logic on it 3) create a new response file in target/clinet system.

  • Working with File Properties on the Application Server

    Hi,
    I am looking for a way to get the size of a file existing in a directory in the application server without reading it.
    Is there a function module or a static method that returns a file properties exists in the application server?
    Thanks,
    Eyal.

    hi Eyal,
    fm <b>EPS_GET_FILE_ATTRIBUTES   </b>
    regards Andreas

  • I worked with files in LR that were originally on my C drive, then were moved to an external HD for storage. I now want to do some more work on those files (which have the same file name as on the C drive). I plugged the drive into my computer and it show

    I worked with files in LR that were originally on my C drive, then were moved to an external HD for storage. I now want to do some more work on those files (which have the same file name as on the C drive). I plugged the drive into my computer and it shows in LR under folders as the F drive and the little green light is on, but LR is showing only the first 6 files and not the remaining 200 or so. How do I expand the F folder to expose all files?

    I worked with files in LR that were originally on my C drive, then were moved to an external HD for storage. I now want to do some more work on those files (which have the same file name as on the C drive). I plugged the drive into my computer and it shows in LR under folders as the F drive and the little green light is on, but LR is showing only the first 6 files and not the remaining 200 or so. How do I expand the F folder to expose all files?

  • How to deal with file(for example .xml)? what format of dir should be?

    I'd like to operate the file in disk, and want to use relative directory?
    How to deal with file dir? what format of dir should be?

    Hi Kamlesh,
    Thanks for your response.
    Actually, In the "Process External Bank Statement" window, i see that there are few entries which is for the previous year and which has not been reconciled. I have never worked practically on BRS and hence, i am scared to make any changes in the clients database without being confident on what i am doing. I need to reconcile for one of their Bank a/c for the month of April '08. I have the copy of the statements for the month ending 31st Mar 08 and 30th Apr 08. The closing balances are as below:
    31/03/08 - 2300000.00
    30/04/08 - 3100000.00
    Now my OB for Bank a/c for April '08 in SAP is 2300000.00 Dr.
    When i go to External Bank Reconciliation - Selection Criteria Screen (Manual Reconciliation), here are the detail that i enter:
    Last Balance: INR -7,000,000.00000 (Grayed out by the system)
    Ending Balance: INR -3,100,000.00000 (Entered by me)
    End Date: 30/04/08 (Entered by me)
    "Reconciliation Bank Statement" Screen opens up and shows the below balances in the screen:
    Cleared Book Balance: INR -7,000,000.00000
    Statement Ending Balance: INR -3,100,000.00000
    Difference: INR 3,800,000.00000
    As per the Bank statement, i have found all the transactions listed out here for the month of Apr '08 but, i also found that the open transactions for the previous month from April '08 have been lying in "Process External Bank Statement" window.
    Could you please help me solve my issue as to what needs to be done or could you also get me some links from where i can get few documents for processing External Bank Reconciliations?
    That will be of a great help for me. I need steps as to what needs to be done first and then the next so that i can arrive at the correct closing balance for the month April '08.
    Thanks in Advance....
    Regards,
    Kaushal

  • Working with files on mobile devices

    Hi everybody,
    at the moment we are running a Vibe 3.4 server which is used most of the time by normal pc clients with the users using the browser or the Vibe desktop client to connect. Now we are getting a tablet project using Vibe more via mobile access (Android based) . The Problem now is, I can do many things with my mobile Vibe access or the Vibe App but I havent figured out how to work with my files stored in Vibe while accessing them via a mobile device.
    Is there any possibility to open and work with the files/attachments?
    If no, is this a planned feature for the future?
    Any help, hint or trick is is greatly appreciated
    Regards,
    Andreas

    astock,
    It appears that in the past few days you have not received a response to your
    posting. That concerns us, and has triggered this automated reply.
    Has your problem been resolved? If not, you might try one of the following options:
    - Visit http://www.novell.com/support and search the knowledgebase and/or check all
    the other self support options and support programs available.
    - You could also try posting your message again. Make sure it is posted in the
    correct newsgroup. (http://forums.novell.com)
    Be sure to read the forum FAQ about what to expect in the way of responses:
    http://forums.novell.com/faq.php
    If this is a reply to a duplicate posting, please ignore and accept our apologies
    and rest assured we will issue a stern reprimand to our posting bot.
    Good luck!
    Your Novell Forums Team
    http://forums.novell.com

  • How to work with framewok

    Hi,
         I want to create a small program in Xcode which create a excel speedsheet with fiew sheet and put data into sheet using
         VisualBasicforApplication.framework.
         What can i do, so that i can create/write excel files in xcode on Mac OS X?
         Please help me as soon as possible.
    Thanks

    Originally Posted by skoltogyan
    How to work with database in the Teaming ?
    I need create some web-forms and store it in the database on the server.
    Any example - how i can do this with Teaming ?
    Please, Help me.
    Serg
    Hi Serg,
    Not sure what you are looking for and I'm also no dev...
    Maybe this link will help : Episode X: Teaming Templates | Novell User Communities

  • How to ZIP the files and folders/sub folder files using java

    HI All,
    I'm New to this Forum, Could anybody tell me how to zip the files and folders/sub folders using java. For example I have a folder with the name testfolder and side that folder I have some files and some sub folders inside subfolders I have some other files. I need to ZIP the files and folders as they are in same hierarchy.
    Any pointers or help wolud be appritiated.
    Thanks,
    Rajeshbabu V

    [http://www.devx.com/tips/Tip/14049]

  • How Ajax works with Struts framework

    How Ajax works with Struts framework .
    Thanks
    Ramki

    So we must write file name(like abc.do), If am using struts <html:link > tag like <html:like action="abc" >Click</html:link>, so with ajax we must call like <a href ="abc.do">Click</a> .
    But there is a problem, if am using ,
    <servlet-mapping>
    <servlet-name>MainServlet</servlet-name>
    <url-pattern>/r/*</url-pattern>
    </servlet-mapping>
    or
    <servlet-mapping>
    <servlet-name>MainServlet</servlet-name>
    <url-pattern>*.do</url-pattern>
    </servlet-mapping>
    here i am changing web.xml file based on client interest. At those situation we must change all jsp pages for <a href ="/r/abc">Click</a> .like,.
    It's very difficult.
    Is any other way to use ajax with Struts (Only struts tags)
    Thanks
    Ramki

  • How to work with DTR  and CBS?

    Hi
    I have designed one web dynpro application. Now I want to work on this application through DTR. Means i want to do versioning and all. How to work with DTR..? I have gone through lot of blogs and help available in SDN but i am unable to understand how to work with it.
    One more thing how to work with CBS. How to configure CBS. I have NWDS latest version 7.0.7. In window perspective i am unable to find JDI. can any one please explain me if u have worked on this with example
    If possible can any one send me the screen shots how to work with these ?
    Best Regards
    Ravi Shankar B

    Hi Ravi
    For you to work with DTR and CBS, firstly u will have to configure JDI on server.
    To configure the NWDI, please go through the links given below:
    http://help.sap.com/saphelp_nw2004s/helpdata/en/07/f6bc3d42f46c33e10000000a11405a/frameset.htm
    http://help.sap.com/saphelp_nw2004s/helpdata/en/71/0369404c65587ee10000000a155106/frameset.htm
    http://help.sap.com/saphelp_nw2004s/helpdata/en/43/26b84d6c823f66e10000000a11466f/frameset.htm
    In Nutshell, following steps will be performed:
    1) logon to Portal Devinf.
    2) click on CMS
    3) Go to landscape configurator
    4) create domain
    5) create tracks and add Software components in that track
    6) runtime systems ( dev/qa etc are configured
    7) in the transport studio, all the files listed are checked in through check - in tab.
    8) they move to developement tab.
    Once all these things are done, in your NWDS:
    1) Setting the devbox host name and server port in Window -> Preferences -> SAP
    J2EE Engine
    2) Setting Portal URL in Window -> Preferences -> JDI -> DC Pool and ping server,
    to check whether server is getting accessed from NWDS.
    3) Once server is set, login to DTR and go to DTR perspective. Create a client there, by doing a right click and filling up the required details.
    4) In the DC perspective, in the Local DCs view, perform import configuration.
    5) the dev track is not configured
    6) Under this, after logging into DTR, now you can create your project, check them in and create new versions.
    Thanks & regards,
    Anupreet

  • Work with Files in Java

    Hello!
    Can anyone help me. How can I API in Java Technology for files to find ?

    don't uite understand your question.
    here's the location of java API for File class, for working with File and Directory..
    http://java.sun.com/j2se/1.3/docs/api/java/io/File.html
    for reading and writing..you may want to look at th eio package for classes such as
    Reader, FileReader, BufferedReader, Writer, FileWriter, BufferedWriter
    here's java API
    http://java.sun.com/j2se/1.4.2/docs/api/

  • HOW TO MOVE FILES BETWEEN FOLDERS ON APPLICATION SERVER

    Hi ,
    I want to move files between folders on application servers and also on presentation server.
    Is any ABAP code available for it.
    Can anybody help me out in this.
    Waiting for reply.
    Thanks & regards,
    Nitin

    I am also interested in this post. The FB  ARCHIVFILE_SERVER_TO_SERVER workes fine for copying the file, however I also need to remove the file from its original location.
    Does anybody have a sugestion on how I can do that (in coding).
    Regards,
    Minim

Maybe you are looking for

  • Problem with SuperDrive in my MacBook Pro

    When I put a CD into my MacBook Pro's optical drive it tries to read it, then spits it out. When I try to put it in again it won't even go in all the way (it bounces out without being pulled in). What diagnostics/maintenance can I do on it before dec

  • Issue while generating MD5 if there are any special characters in the CLOB

    Hi Guys, I need your help... We are using dbms_crypto.hash to generate the MD5 hash value for a CLOB that will be sent to other feeder systems. The feeder systems validate the file by generating the MD5 hash value on their end and compare with the MD

  • Macbook's Airport Extreme

    Hi all, I bought a MBP 15,4" 2.0Ghz one week ago and I have noticed that I can not activate the pasive mode of my Airport Extreme from KisMAC. I have read on its website that the current version of KisMAC can not use on passive mode the AE of Macbook

  • ITunes 7.1 Locked

    I recently upgraded to 7.1 and now whenever I try and launch the application, I get an error message stating "The iTunes Music Folder is Locked, is on a Locked Drive, or you don't have permission". I have gone through all folders regarding my iTunes

  • Oracle 11g Active Data Guard help ?

    Hi Friends, I successfully setup an Active data guard environment(11g). But, I dont know when the PROD database is highly utilize , its read only tasks like reporting and backup are doing in STANDBY. How can I know which db (prod or stand by) is used