Hi folks,
because I did not find a good explanation somewhere, I will just ask you for your experiences or better: Best practices:
Scenario: I created ABAP OO application, including a ZCL_VALIDATOR for some input checks. I have a Exception class ZCX_VALIDATOR, which has several TextIDs for the different checks in ZCL_VALIDATOR.
Now, a classic SAP Dynpro should call my application, give some input
like:
DATA lo_validator type ref to ZCL_VALIDATOR. try. lo_validator->CHECK_MATNR( iv_matnr = lv_matnr ) catch EXCEPTION TYPE ZCX_VALIDATOR into DATA(lo_exc). endtry.
Check_matnr does several checks and raises ZCX_VALIDATOR, but dependent on the error case, the GUI should show a 'E' or 'I'.
My approach would be like:
DATA lo_validator type ref to ZCL_VALIDATOR. try. lo_validator->CHECK_MATNR( iv_matnr = lv_matnr ) catch EXCEPTION TYPE ZCX_VALIDATOR into DATA(lo_exc). if lo_exc->textid-msgid eq 'abc'. MESSAGE type lo_exc DISPLAY LIKE 'I' else. MESSAGE type lo_exc DISPLAY LIKE 'E'. endtry.
Question: Is there any other way to to this?
Thanks for your thoughts on this.
Greetings
michael