Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

code to get a document

Former Member
0 Kudos
411

Hi,

I am trying to show the documents saved for the projects.

For this I created a FM to pull all the names of the documents saved for a project.

But how do I get them to open the document by double clicking on the output of the FM.Is there some other method to do all this.

The point is I must be able to open a document by double clicking on its name.

Thank you,

1 ACCEPTED SOLUTION
Read only

Former Member
0 Kudos
377

Which kind of document?

Max

6 REPLIES 6
Read only

Former Member
0 Kudos
378

Which kind of document?

Max

Read only

0 Kudos
377

word document or pdf document

Read only

0 Kudos
377

U can use the fm WS_EXCUTE

Max

Read only

0 Kudos
377

Can you please say How this FM works?

Thanks

Read only

0 Kudos
377

Hi

This is an easy sample to open a file pdf

CALL FUNCTION 'WS_EXECUTE'
  EXPORTING
    COMMANDLINE           = 'C:my_file.pdf'       <------ Document
    PROGRAM                  = 'AcroRd32.exe'       <------- program
* IMPORTING
*   RBUFF                    =
* EXCEPTIONS
*   FRONTEND_ERROR           = 1
*   NO_BATCH                 = 2
*   PROG_NOT_FOUND           = 3
*   ILLEGAL_OPTION           = 4
*   GUI_REFUSE_EXECUTE       = 5
*   OTHERS                   = 6
          .
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

Max

Read only

0 Kudos
377

Hi

U can try to this little program:

PARAMETERS: P_EXT LIKE SOOD-FILE_EXT,
                                  FILE(100).


DATA: PROGRAM LIKE  SOXPC-PATH.

CALL FUNCTION 'SO_PROGNAME_GET_WITH_PATH'
  EXPORTING
    DOCTYPE                 = P_EXT
 IMPORTING
   PATHNAME                = PROGRAM
* TABLES
*   RE                      =
 EXCEPTIONS
   PATH_NOT_FOUND          = 1
   PROGRAM_NOT_FOUND       = 2
   NO_BATCH                = 3
   X_ERROR                 = 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.


CALL FUNCTION 'WS_EXECUTE'
  EXPORTING
    COMMANDLINE              = FILE
    PROGRAM                  = PROGRAM
* IMPORTING
*   RBUFF                    =
 EXCEPTIONS
   FRONTEND_ERROR           = 1
   NO_BATCH                 = 2
   PROG_NOT_FOUND           = 3
   ILLEGAL_OPTION           = 4
   GUI_REFUSE_EXECUTE       = 5
   OTHERS                   = 6
          .
IF SY-SUBRC <> 0.
  MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
          WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

Max