-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathzcf_intfmonitor.clas.abap
More file actions
108 lines (81 loc) · 3.76 KB
/
Copy pathzcf_intfmonitor.clas.abap
File metadata and controls
108 lines (81 loc) · 3.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
"! <p class="shorttext synchronized" lang="en">SAP Interface Monitor</p>
CLASS zcf_intfmonitor DEFINITION
PUBLIC
FINAL
CREATE PRIVATE .
PUBLIC SECTION.
"! <p class="shorttext synchronized" lang="en">Creates new Interface Monitor to store data</p>
"!
"! @parameter id_intfid | <p class="shorttext synchronized" lang="en">Interface Id</p>
"! @parameter ro_instance | <p class="shorttext synchronized" lang="en">SAP Interface Monitor</p>
"! @exception not_found | <p class="shorttext synchronized" lang="en">Interface not found</p>
"! @exception unable_to_create_instance | <p class="shorttext synchronized" lang="en">Unable to create instance</p>
CLASS-METHODS new
IMPORTING
!id_intfid TYPE zzeintfid
RETURNING
VALUE(ro_instance) TYPE REF TO zif_intfmonitor
EXCEPTIONS
not_found
unable_to_create_instance .
"! <p class="shorttext synchronized" lang="en">Retrieves existing Interface Monitor for reading data</p>
"!
"! @parameter id_guid | <p class="shorttext synchronized" lang="en">Process Guid</p>
"! @parameter ro_instance | <p class="shorttext synchronized" lang="en">SAP Interface Monitor</p>
"! @exception not_found | <p class="shorttext synchronized" lang="en">Not found</p>
"! @exception unable_to_create_instance | <p class="shorttext synchronized" lang="en">Unable to create instance</p>
CLASS-METHODS find_by_guid
IMPORTING
!id_guid TYPE zzeintfprocguid
RETURNING
VALUE(ro_instance) TYPE REF TO zif_intfmonitor
EXCEPTIONS
not_found
unable_to_create_instance .
PROTECTED SECTION.
PRIVATE SECTION.
ENDCLASS.
CLASS zcf_intfmonitor IMPLEMENTATION.
METHOD find_by_guid.
DATA: ls_head TYPE zintfmonitor020,
ls_custo TYPE zintfmonitor010.
TRY.
ls_head = zcl_zintfmonitor020_read=>get_details( id_guid ).
ls_custo = zcl_zintfmonitor010_read=>get_details( ls_head-intfid ).
CREATE OBJECT ro_instance TYPE (ls_custo-clsname).
ro_instance->initialize( id_guid = ls_head-guid
is_detail = ls_head-detail ).
* Retrieve saved data
ro_instance->read( ).
CATCH ZCX_INTFMONITOR .
MESSAGE e000(zintfmonitor) WITH id_guid RAISING not_found.
* There is no Interface execution with id '&1'.
CATCH cx_sy_create_object_error.
MESSAGE e002(zintfmonitor) WITH ls_custo-clsname ls_head-intfid RAISING unable_to_create_instance.
* Unable to create instance from class '&1' of interface '&2'.
ENDTRY.
ENDMETHOD.
METHOD new.
DATA: ls_custo TYPE zintfmonitor010,
ld_guid TYPE zzeintfprocguid,
ls_detail TYPE zeintfmonitor_detail.
TRY.
ls_custo = zcl_zintfmonitor010_read=>get_details( id_intfid ).
CREATE OBJECT ro_instance TYPE (ls_custo-clsname).
ld_guid = cl_system_uuid=>create_uuid_c32_static( ).
ls_detail-intfid = id_intfid.
ls_detail-procdate = sy-datum.
ls_detail-proctime = sy-uzeit.
ls_detail-procby = sy-uname.
ls_detail-procendtype = zcl_zintfmonitor020_read=>mc_procendtype-undefined.
ro_instance->initialize( id_guid = ld_guid
is_detail = ls_detail ).
CATCH ZCX_INTFMONITOR .
MESSAGE e001(zintfmonitor) WITH id_intfid RAISING not_found.
* Interface id '&1' does not exist.
CATCH cx_sy_create_object_error.
MESSAGE e002(zintfmonitor) WITH ls_custo-clsname id_intfid RAISING unable_to_create_instance.
* Unable to create instance from class '&1' of interface '&2'.
ENDTRY.
ENDMETHOD.
ENDCLASS.