Application Development 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: 

MESSAGE_TYPE_UNKNOWN in cl_gui_frontend_services=>execute

Former Member
0 Kudos

Dear Experts,

Pl see the code below. Sometimes it throws a dump with sy-subrc = 7. I am calling this method to execute a file. The reason of dump is not known or I am not able to trace it. Please advise on how to find the cause of dump or is there anything wrong with parameters. Most of the times it run fine. The Dump file is also attached for reference.

CALL METHOD cl_gui_frontend_services=>execute

EXPORTING

   document               = 'C:\WBSAP\WB.BAT'

   application            =  'cmd'

   parameter              =  gv_exenm  "'/c C:\C\int.exe'

   default_directory      = 'C:\WBSAP'

   maximized              = ' '

   minimized              = 'X'

   synchronous            = 'X'

   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

        .

IF sy-subrc <> 0.

  MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

        WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

Thanks & Regards,

Anil.

7 REPLIES 7

Former Member
0 Kudos

Hi,

As per the dump you have attched your dump is coming on the line  Message ID

IF sy-subrc <> 0.

  MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

        WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

It is happening due to the face that SY-MSGTY is blank.

Make sure you raise a proper message ( Type S/W/I/A/E ) when your SY-SUBRC value is not equal to '0'. You can hardcode the TYPE to any one of them along with proper message class(MSGID) and Number ( MSGNO). The dump should disapear.

But if you want to know exactly why the SY-SUBRC is '7" after the method call you may want to debug the method and put a break point at that specific exception ( ERROR_EXECUTE_FAILED ).

Hope this helps.

Regards,

R

0 Kudos

Hi Rudra,

You are right that dump is due to blank SY-MSGTY. As this is standard SAP method, so I cant put my own message type here, Im just calling this method to execute a .bat file which run fine and code is also running fine but once in a week or so I find dump in ST22. As the transaction is running at many location, so I cant trace the exact cause of dump.

I wanted some expert opinion about the possibility of the dump any one had encountered previously. I did not get this dump during debugging as it happens very often.

Regards,

Anil.

0 Kudos

Hi

I suppose the line of code:

IF sy-subrc <> 0.

  MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

        WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

was inserted automatically if you have used the PATTERN option in order to write the call of method correctly.

The problem is the most of standard functions and methods don't manage a message while raising an excption.

So you should raplace it with your code:

CALL METHOD cl_gui_frontend_services=>execute

EXPORTING

   document               = 'C:\WBSAP\WB.BAT'

   application            =  'cmd'

   parameter              =  gv_exenm  "'/c C:\C\int.exe'

   default_directory      = 'C:\WBSAP'

   maximized              = ' '

   minimized              = 'X'

   synchronous            = 'X'

   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

        .

*IF sy-subrc <> 0.

*  MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

*       WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

*ENDIF.

CASE SY-SUBRC.

      WHEN 1. MESSAGE E208(00) WITH 'GUI error'.

      WHEN 2. MESSAGE E208(00) WITH 'GUI error'.

      WHEN 3. ...........................................

  ENDCASE.

You need to know the meaning of the exceptions in order to raise a correct message, but you can also decide to raise a generic message (or no message)

IF sy-subrc <> 0.

   MESSAGE E208(00) WITH 'Program not found'.  

ENDIF.

Max

0 Kudos

Hi Max,

Thanks for the solution. The solution is last resort to combat this issue. I posted this message to know if there could be any specific reason causing this dump.

Is there any possibility of such dump due to connection broken for a moment between server and frontend?

Regards,

Anil.

0 Kudos

Sorry

There are many causes for that exception: what do you need to run?

Max

0 Kudos

Anyway thanks Max.

Regards,

Anil.

tomasz1
Explorer
0 Kudos

Hallo,

I have the similar problem. Occasionally the method EXECUTE throws the exception ERROR_EXECUTE_FAILED while opening an URL. How can I trace the cause of this error?

Regards,

Tom