2012 Oct 31 5:32 PM
Hi Experts,
I have created a static class which calls a BAPI to create job.
The way i am handling error message is as shown below:
APPEND LINES OF lt_return TO et_message_log.->exporting parameter
LOOP AT lt_return INTO lw_return WHERE type CA 'AE'.
RAISE EXCEPTION TYPE cx_bapi_error
EXPORTING
status = lt_return.
ENDLOOP.
ET_MESSAGE_LOG is export parameter of the class.
This method is also used by workflow and the concerned person is saying that the method doesnt return an error because it isnt handling exceptions.
When i test the method in se24 it raises exception popup CX_BAPI_ERROR and when i close pop-up i am getting error in message log.
Is this the right way to raise exception ? I dont know why workflow cannot capture these errors.
Please advice,.
Hi Experts,
I have created a static class which calls a BAPI to create job.
The way i am handling error message is as shown below:
APPEND LINES OF lt_return TO et_message_log.->exporting parameter
LOOP AT lt_return INTO lw_return WHERE type CA 'AE'.
RAISE EXCEPTION TYPE cx_bapi_error
EXPORTING
status = lt_return.
ENDLOOP.
ET_MESSAGE_LOG is export parameter of the class.
This method is also used by workflow and the concerned person is saying that the method doesnt return an error because it isnt handling exceptions.
When i test the method in se24 it raises exception popup CX_BAPI_ERROR and when i close pop-up i am getting error in message log.
Is this the right way to raise exception ? I dont know why workflow cannot capture these errors.
Please advice,.
2012 Oct 31 5:51 PM
Hi,
please post the whole signature of the method.
Does this signature contain the exception CX_BAPI_ERROR ?
And you need only one RAISE-statement outside the loop:
LOOP AT lt_return INTO lw_return WHERE type CA 'AE'.
EXIT.
ENDLOOP.
IF SY-SUBRC EQ 0.
RAISE EXCEPTION TYPE cx_bapi_error
EXPORTING
status = lt_return.
ENDIF.
Regards
Dirk
2012 Oct 31 6:24 PM
Hi Drik,
The signature do contain the exception CX_BAPI_ERROR.
OK. i can raise the statement once but will that help?
2012 Nov 01 8:14 PM
Hi
the exception will always be raised just once because the loop will be left the first time.
No it won't help, just makes the code cleaner.
The signature is ok. Does the task contain an exit corresponding with the exception?
2012 Nov 02 6:58 PM
I was expecting workflow to catch the exception raised from workflow class which i build.
But then i myself had to handle the exception and this was the problem.
Thanks all
2012 Oct 31 6:18 PM
How did you define exceptions and corresponding exception handlers in your Workflow (Exceptions Tab Page) ?
Regards,
Raymond