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

How to display a desktop file via a user event ?

Hello All,

Can anyone please suggest of a function module or any other method to display a desktop flat file through ABAP code on a user event.

Thank you.

Regards,

Gaurav.

Add a comment
10|10000 characters needed characters exceeded

Related questions

3 Answers

  • Posted on Oct 07, 2005 at 07:24 PM

    Do you mean open a text file? Take a look at this sample. Point the parameter to some text file on your PC and click execute. It should fire NotePad

    
    report zrich_0001
           no standard page heading
           line-size 300.
    
    data:
               ifile_table type table of file_table,
               xfile_table type file_table,
                return type i..
    
    parameters: p_file type file_table-filename
              default 'C:'.
    
    at selection-screen on value-request for p_file.
    
      clear ifile_table.  refresh ifile_table.
      call method cl_gui_frontend_services=>file_open_dialog
       exporting
          window_title       = 'Get File'
          multiselection     = space
       changing
          file_table         = ifile_table
          rc                 = return
       exceptions
          file_open_dialog_failed = 1
          cntl_error              = 2
          error_no_gui            = 3
          others                  = 4.
    
      read table ifile_table into xfile_table index 1.
      if sy-subrc  = 0.
        p_file = xfile_table.
      endif.
    
    start-of-selection.
    
      data: file type string.
    
      file  = p_file.
      call method cl_gui_frontend_services=>execute
        exporting
          document            =  file.
    
    

    Please remember to award points for helpful answers. Thanks.

    Regards,

    Rich Heilman

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 07, 2005 at 07:27 PM

    You can code this in PAI or AT USER COMMAND.

    CALL METHOD CL_GUI_FRONTEND_SERVICES=>EXECUTE

    EXPORTING

    • DOCUMENT =

    APPLICATION = 'NOTEPAD.EXE'

    PARAMETER = 'C:\test.txt'

    • DEFAULT_DIRECTORY =

    • MAXIMIZED =

    • MINIMIZED =

    • SYNCHRONOUS =

    • OPERATION = 'OPEN'

    • EXCEPTIONS

    • CNTL_ERROR = 1

    • ERROR_NO_GUI = 2

    • BAD_PARAMETER = 3

    • FILE_NOT_FOUND = 4

    • PATH_NOT_FOUND = 5

    • FILE_EXTENSION_UNKNOWN = 6

    • ERROR_EXECUTE_FAILED = 7

    • SYNCHRONOUS_FAILED = 8

    • NOT_SUPPORTED_BY_GUI = 9

    • others = 10

    .

    Cheers

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 07, 2005 at 07:43 PM

    Thanks a lot .

    Regards,

    Gaurav.

    Add a comment
    10|10000 characters needed characters exceeded

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.