|
| 1 | +"! <p class="shorttext synchronized" lang="EN">Excs. with Dynamic Check of RAISING Clause with t100 message</p> |
| 2 | +class zcx_dynamic_check definition |
| 3 | + public |
| 4 | + inheriting from cx_dynamic_check |
| 5 | + create public. |
| 6 | + |
| 7 | + public section. |
| 8 | + |
| 9 | + interfaces: if_t100_message. |
| 10 | + |
| 11 | + "! <p class="shorttext synchronized" lang="EN">Create an exception. Can use either a t100 msg or a text ID</p> |
| 12 | + "! Providing <strong>both</strong> text parameters will result in a <strong>short dump</strong> |
| 13 | + "! |
| 14 | + "! @parameter i_t100_message | <p class="shorttext synchronized" lang="EN">t100 message</p> |
| 15 | + "! @parameter i_previous | <p class="shorttext synchronized" lang="EN"></p> |
| 16 | + methods constructor |
| 17 | + importing |
| 18 | + i_t100_message type ref to if_t100_message optional |
| 19 | + i_previous like previous optional |
| 20 | + preferred parameter i_t100_message. |
| 21 | + |
| 22 | + data var1 type sy-msgv1 read-only. |
| 23 | + |
| 24 | + data var2 type sy-msgv2 read-only. |
| 25 | + |
| 26 | + data var3 type sy-msgv4 read-only. |
| 27 | + |
| 28 | + data var4 type sy-msgv4 read-only. |
| 29 | + |
| 30 | + protected section. |
| 31 | + |
| 32 | + methods load_message_in_sy_structure |
| 33 | + importing |
| 34 | + i_t100_message type ref to if_t100_message |
| 35 | + returning |
| 36 | + value(r_self) type ref to zcx_dynamic_check. |
| 37 | + |
| 38 | +endclass. |
| 39 | +class zcx_dynamic_check implementation. |
| 40 | + |
| 41 | + method constructor ##ADT_SUPPRESS_GENERATION. |
| 42 | + |
| 43 | + super->constructor( previous = i_previous ). |
| 44 | + |
| 45 | + me->textid = value #( ). |
| 46 | + |
| 47 | + if i_t100_message is supplied. |
| 48 | + |
| 49 | + me->load_message_in_sy_structure( i_t100_message ). |
| 50 | + |
| 51 | + me->var1 = sy-msgv1. |
| 52 | + |
| 53 | + me->var2 = sy-msgv2. |
| 54 | + |
| 55 | + me->var3 = sy-msgv3. |
| 56 | + |
| 57 | + me->var4 = sy-msgv4. |
| 58 | + |
| 59 | + me->if_t100_message~t100key = cond #( when i_t100_message is not initial |
| 60 | + then value #( msgid = sy-msgid |
| 61 | + msgno = sy-msgno |
| 62 | + attr1 = 'VAR1' |
| 63 | + attr2 = 'VAR2' |
| 64 | + attr3 = 'VAR3' |
| 65 | + attr4 = 'VAR4' ) |
| 66 | + else if_t100_message=>default_textid ). |
| 67 | + |
| 68 | + else. |
| 69 | + |
| 70 | + me->if_t100_message~t100key = if_t100_message=>default_textid. |
| 71 | + |
| 72 | + endif. |
| 73 | + |
| 74 | + endmethod. |
| 75 | + method load_message_in_sy_structure. |
| 76 | + |
| 77 | + cl_message_helper=>get_text_for_message( i_t100_message ). |
| 78 | + |
| 79 | + r_self = me. |
| 80 | + |
| 81 | + endmethod. |
| 82 | + |
| 83 | +endclass. |
0 commit comments