-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathzcl_debug_obj_to_graph.clas.abap
128 lines (101 loc) · 3.7 KB
/
zcl_debug_obj_to_graph.clas.abap
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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
********************************************************************************
* The MIT License (MIT)
*
* Copyright (c) 2018 Marcello Urbani
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
********************************************************************************
class zcl_debug_obj_to_graph definition public final create public .
public section.
methods display_graph importing !name type string.
methods popup returning value(varname) type string.
protected section.
private section.
constants c_newline like cl_abap_char_utilities=>newline value cl_abap_char_utilities=>newline ##NO_TEXT.
data uploadpath type string.
data downloadpath type string.
methods get_temp_file_url
returning
value(r_result) type string.
endclass.
class zcl_debug_obj_to_graph implementation.
method display_graph.
data: lx_root type ref to cx_root,
factory type ref to zcl_debug_obj_graph_factory,
graph type ref to zcl_abap_graph.
try.
if name is initial.
return.
endif.
factory = zcl_debug_obj_graph_factory=>create( ).
graph = factory->create_graph( name ).
if graph is bound.
zcl_abap_graph_utilities=>show_in_browser( graph = graph comments = factory->logs ).
else.
message 'Unknown variable'(006) type 'I'.
endif.
catch cx_tpda_varname.
message 'Unknown variable'(006) type 'I'.
catch cx_root into lx_root.
message lx_root type 'I'.
endtry.
endmethod.
method get_temp_file_url.
data: separator type c,
guid type guid_32.
cl_gui_frontend_services=>get_file_separator(
changing
file_separator = separator
exceptions
others = 4 ).
if sy-subrc = 0.
"will not work with local variables...
cl_gui_frontend_services=>get_upload_download_path(
changing
upload_path = uploadpath
download_path = downloadpath
exceptions
others = 6 ).
endif.
if sy-subrc = 0.
call function 'GUID_CREATE'
importing
ev_guid_32 = guid.
if downloadpath is initial.
concatenate guid '.html' into r_result.
else.
concatenate downloadpath separator guid '.html' into r_result.
endif.
endif.
endmethod.
method popup.
data: ok type abap_bool.
call function 'POPUP_GET_STRING'
exporting
label = 'Variable name'
importing
value = varname
okay = ok.
if ok = abap_false.
clear varname.
else.
translate varname to upper case.
endif.
endmethod.
endclass.