Skip to Content
0
Former Member
Aug 06, 2010 at 01:28 PM

How to catch error or exception for FM JOB_OPEN in code

203 Views

Hi,

i am calling the FM 'JOB_OPEN' in my code to catch the error message when sy-subrc ne 0 but it is giving dump as there is nothing coming in sy-msgid, sy-msgtype. but when i just run this FM in SE37 then I am able to get the error for example when I pass blank for jobname then error comes is 'job missing' which is fine.

But this error I am not able to display from ABAP code which is as :

CALL FUNCTION 'JOB_OPEN'

EXPORTING

jobname = g_jobname

IMPORTING

jobcount = g_jobcount

EXCEPTIONS

cant_create_job = 1

invalid_job_data = 2

jobname_missing = 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.

Please suggest how to correct it ???

Thanks,

Mohan