cancel
Showing results for 
Search instead for 
Did you mean: 

How to display a desktop file via a user event ?

Former Member
0 Kudos

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.

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Thanks a lot .

Regards,

Gaurav.

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

Please remember to award points for helpful answers. Thanks.

Regards,

Rich Heilman

Former Member
0 Kudos

Please let me know how I may award you the points as I am new around here and am not aware of the same.

Regards,

Gaurav.

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

There should be some stars next to the answers that have been posted. Award points according to how much the answers have helped you. 2 for helful, 6 for very helpful, and 10 for solved problem. Thanks and welcome to the wonderful world of SDN.

Regards,

Rich Heilman

Former Member
0 Kudos

Dear Rich,

Thanks for your warm welcome.The stars all of them are grayed out on my screen.But from the next post ill duly keep your advice in mind.

Regards,

Gaurav.

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

Interesting...... Please come back later and try again. And make sure to mark your post as "solved" so others can easily see that you question has been answered. Thanks.

Regards,

Rich Heilman

Former Member
0 Kudos

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

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

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