Skip to content

Commit 6eb3c5a

Browse files
authored
Add files via upload
1 parent af1f76f commit 6eb3c5a

File tree

4 files changed

+25
-78
lines changed

4 files changed

+25
-78
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
# abap-exceptions
22

33
Exceptions that implement the message interface and that take a message in the constructor
4+
The interface does not consider types so a message from an exception like this can only be sent with "MESSAGE ... TYPE ..."

src/zcx_dynamic_check.clas.abap

Lines changed: 8 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@ class zcx_dynamic_check definition
88

99
interfaces: if_t100_message.
1010

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>
11+
"! <p class="shorttext synchronized" lang="EN">Creates an exception. Can use a t100 msg</p>
1312
"!
1413
"! @parameter i_t100_message | <p class="shorttext synchronized" lang="EN">t100 message</p>
1514
"! @parameter i_previous | <p class="shorttext synchronized" lang="EN"></p>
@@ -27,14 +26,6 @@ class zcx_dynamic_check definition
2726

2827
data var4 type sy-msgv4 read-only.
2928

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-
3829
endclass.
3930
class zcx_dynamic_check implementation.
4031

@@ -46,7 +37,7 @@ class zcx_dynamic_check implementation.
4637

4738
if i_t100_message is supplied.
4839

49-
me->load_message_in_sy_structure( i_t100_message ).
40+
cl_message_helper=>set_msg_vars_for_if_t100_msg( i_t100_message ).
5041

5142
me->var1 = sy-msgv1.
5243

@@ -56,14 +47,12 @@ class zcx_dynamic_check implementation.
5647

5748
me->var4 = sy-msgv4.
5849

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 ).
50+
me->if_t100_message~t100key = value #( msgid = sy-msgid
51+
msgno = sy-msgno
52+
attr1 = 'VAR1'
53+
attr2 = 'VAR2'
54+
attr3 = 'VAR3'
55+
attr4 = 'VAR4' ).
6756

6857
else.
6958

@@ -72,12 +61,5 @@ class zcx_dynamic_check implementation.
7261
endif.
7362

7463
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.
8264

8365
endclass.

src/zcx_no_check.clas.abap

Lines changed: 8 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@ class zcx_no_check definition
88

99
interfaces: if_t100_message.
1010

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>
11+
"! <p class="shorttext synchronized" lang="EN">Creates an exception. Can use a t100 msg</p>
1312
"!
1413
"! @parameter i_t100_message | <p class="shorttext synchronized" lang="EN">t100 message</p>
1514
"! @parameter i_previous | <p class="shorttext synchronized" lang="EN"></p>
@@ -27,14 +26,6 @@ class zcx_no_check definition
2726

2827
data var4 type sy-msgv4 read-only.
2928

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_no_check.
37-
3829
endclass.
3930
class zcx_no_check implementation.
4031

@@ -46,7 +37,7 @@ class zcx_no_check implementation.
4637

4738
if i_t100_message is supplied.
4839

49-
me->load_message_in_sy_structure( i_t100_message ).
40+
cl_message_helper=>set_msg_vars_for_if_t100_msg( i_t100_message ).
5041

5142
me->var1 = sy-msgv1.
5243

@@ -56,14 +47,12 @@ class zcx_no_check implementation.
5647

5748
me->var4 = sy-msgv4.
5849

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 ).
50+
me->if_t100_message~t100key = value #( msgid = sy-msgid
51+
msgno = sy-msgno
52+
attr1 = 'VAR1'
53+
attr2 = 'VAR2'
54+
attr3 = 'VAR3'
55+
attr4 = 'VAR4' ).
6756

6857
else.
6958

@@ -72,12 +61,5 @@ class zcx_no_check implementation.
7261
endif.
7362

7463
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.
8264

8365
endclass.

src/zcx_static_check.clas.abap

Lines changed: 8 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@ class zcx_static_check definition
88

99
interfaces: if_t100_message.
1010

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>
11+
"! <p class="shorttext synchronized" lang="EN">Creates an exception. Can use a t100 msg</p>
1312
"!
1413
"! @parameter i_t100_message | <p class="shorttext synchronized" lang="EN">t100 message</p>
1514
"! @parameter i_previous | <p class="shorttext synchronized" lang="EN"></p>
@@ -27,14 +26,6 @@ class zcx_static_check definition
2726

2827
data var4 type sy-msgv4 read-only.
2928

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_static_check.
37-
3829
endclass.
3930
class zcx_static_check implementation.
4031

@@ -46,7 +37,7 @@ class zcx_static_check implementation.
4637

4738
if i_t100_message is supplied.
4839

49-
me->load_message_in_sy_structure( i_t100_message ).
40+
cl_message_helper=>set_msg_vars_for_if_t100_msg( i_t100_message ).
5041

5142
me->var1 = sy-msgv1.
5243

@@ -56,14 +47,12 @@ class zcx_static_check implementation.
5647

5748
me->var4 = sy-msgv4.
5849

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 ).
50+
me->if_t100_message~t100key = value #( msgid = sy-msgid
51+
msgno = sy-msgno
52+
attr1 = 'VAR1'
53+
attr2 = 'VAR2'
54+
attr3 = 'VAR3'
55+
attr4 = 'VAR4' ).
6756

6857
else.
6958

@@ -72,12 +61,5 @@ class zcx_static_check implementation.
7261
endif.
7362

7463
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.
8264

8365
endclass.

0 commit comments

Comments
 (0)