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

How to open a picture?

Hi,

I want to open a picture while program is running. While program is running user need to open a picture, then user will browse a picture which is in computer. Then (s)he will open it.

Is is possible to implement this program?

Thanks.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Posted on Feb 16, 2005 at 03:55 PM

    This may not solve your problem, but maybe give you some ideas. This is a sample program which uses the HTML container to throw up a webpage, this can also be used to view a network directory, not sure that it works for local drives. If you "picture" resides on a network server, then you will be able to use this sample.

    Network server address like
    ServerName\Folder

    If pictures are on local drive, then your URL will be
    computername. You will need to "share out" the local drive to make it visiable.

    Rememeber, this is a quick a dirty way. There are better ways.

    Regards

    Rich Heilman

    Add a comment
    10|10000 characters needed characters exceeded

    • Here is another sample that may help you.

      User can select any folder, program will write the files to list display, then user can click on the file to open it up.

      
      report zrich_0003.
      
      data: gui_fs type ref to cl_gui_frontend_services.
      
      data: dir_tab type standard table of file_info.
      data: directory_folder type string.
      data: count type i.
      
      data: begin of list occurs 0,
            file(50) type c,
            end of list.
      
      start-of-selection.
      
        create object gui_fs.
      
        perform select_read_directory.
      
      
      at line-selection.
      
        perform execute_application using directory_folder
                                          list-file.
      
      
      ************************************************************************
      *  Form  EXECUTE_APPLICATION
      ************************************************************************
      form execute_application using directory_folder
                                     file.
      
        data: file_path type string.
      
        concatenate directory_folder '' file into file_path.
        condense file_path.
      
        call method gui_fs->execute
          exporting
            document               = file_path
            maximized              = 'X'
            synchronous            = 'X'
          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
            others                 = 8.
      
        if sy-subrc <> 0.
        endif.
      
      endform.
      
      ************************************************************************
      *  Form  SELECT_READ_DIRECTORY
      ************************************************************************
      form select_read_directory.
      
        call method gui_fs->directory_browse
          exporting
            window_title    = 'Select Directory'
            initial_folder  = 'c:'
          changing
            selected_folder = directory_folder
          exceptions
            cntl_error      = 1
            error_no_gui    = 2
            others          = 3.
      
        if sy-subrc <> 0.
      * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
      *            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        endif.
      
        call method cl_gui_cfw=>flush
             exceptions
                cntl_system_error = 1
                cntl_error        = 2.
        if sy-subrc <> 0.
          message e324(sbds).
        endif.
      
        call method gui_fs->directory_list_files
          exporting
            directory                   = directory_folder
      *    FILTER                      = '*.*'
           files_only                  = 'X'
      *    DIRECTORIES_ONLY            =
          changing
            file_table                  = dir_tab
            count                       = 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.
      
        list[] = dir_tab[].
      
        loop at list.
          write:/ list-file. hide list-file.
        endloop.
      
      endform.
      
      

      Regards,

      Rich Heilman

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.