Skip to Content
avatar image
Former Member

CL_GUI_FRONTEND_SERVICES=>EXECUTE

I would like to open up a document in read-only format. Previously I was doing this via OLE but I now wish to use the object functionality. I believe I need to pass over a value in the 'parameters' parameter of the method. But which one? Is there any documentation on the use of this method?

Any help much appreciated.

Cheers

Ian

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

2 Answers

  • avatar image
    Former Member
    Jul 26, 2004 at 03:12 PM

    Hallo Ian,

    I understand your enthusiasm to escape from OLE-2. You don't necessarily have to use the "PARAMETER" parameter. The following simple example should work to display a document.

    I hope this helps.

    Gerard.

    REPORT ZGW_TEST1.

    DATA: G_FRONT_END TYPE REF TO CL_GUI_FRONTEND_SERVICES,

    G_FILE TYPE STRING.

    CREATE OBJECT FRONT_END.

    G_FILE = 'C:\GW_TEST.txt'.

    CALL METHOD CL_GUI_FRONTEND_SERVICES=>EXECUTE

    EXPORTING

    DOCUMENT = G_FILE

    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 NE 0.

    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

    ENDIF.

    Add comment
    10|10000 characters needed characters exceeded

  • Jul 26, 2004 at 06:32 PM

    Hi Gerard

    I think there is something you've misunderstood. Ian wants to open the file "read-only". That's why, (s)he requires the command-line for "winword.exe" to open a document read-only.

    By the way, since the method you are calling is static, I think there is no need to instantiate "CL_GUI_FRONTEND_SERVICES".

    *--Serdar

    Add comment
    10|10000 characters needed characters exceeded