图表 GRAPHS

示例集合:https://blogs.sap.com/2013/09/18/drawing-graphical-charts-with-abap/

1、可以使用事物代码 DWDM 查看图表的示例

http://www.sapfans.com/forums/viewtopic.php?t=2083

2、可以使用function : GFW_PRES_SHOW 进行编辑简单的图表 

   参考地址 :http://www.sapfans.com/forums/viewtopic.php?f=31&t=326609

 实现两个图表在同一个容器中

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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
*&---------------------------------------------------------------------*
*& Report ZTEST_ZT_5
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
REPORT ZTEST_ZT_5.
*type pool declarations for graphical frame work
 
TYPE-POOLS: gfw.
 
*OK code declaration
 
DATA: ok_code TYPE sy-ucomm.
 
*structure declaration for graph 1 values
 
TYPES: BEGIN OF ty_gprval1.
 
       INCLUDE STRUCTURE gprval.
 
*     rowtxt(4) TYPE C,
 
*     val1(4) TYPE c,
 
*     val2(4) TYPE c,
 
TYPES : END OF ty_gprval1.
 
 
 
*structure declaration for graph 1 column names
 
TYPES: BEGIN OF ty_col1_texts.
 
*       coltxt(4) TYPE C,
 
       INCLUDE STRUCTURE gprtxt.
 
TYPES :END OF ty_col1_texts.
 
 
 
*data declarations for graph 1
 
DATA: grval1 TYPE STANDARD TABLE OF ty_gprval1,
 
      gprval1 TYPE ty_gprval1,
 
      col1_texts TYPE STANDARD TABLE OF ty_col1_texts,
 
      col1_wa TYPE ty_col1_texts.
 
 
 
*structure declaration for graph 2 values
 
TYPES: BEGIN OF ty_gprval2.
 
       INCLUDE STRUCTURE gprval.
 
*    rowtxt(10) TYPE C,
 
*    val1(4) TYPE c,
 
*    val2(4) TYPE c,
 
TYPES:END OF ty_gprval2.
 
 
 
*structure declaration for graph 2 column names
 
TYPES : BEGIN OF ty_col2_texts.
 
*        coltxt(40) TYPE C,
 
        INCLUDE STRUCTURE gprtxt.
 
TYPES : END OF ty_col2_texts.
 
 
 
*data declarations for graph2
 
DATA: grval2 TYPE STANDARD TABLE OF ty_gprval2,
 
      gprval2 TYPE ty_gprval2,
 
      col2_texts TYPE STANDARD TABLE OF ty_col2_texts,
 
      col2_wa TYPE ty_col2_texts.
 
 
 
*data declarations for containers,splitters,and custom container
 
DATA:custom_container TYPE REF TO cl_gui_custom_container,
 
     splitter TYPE REF TO cl_gui_splitter_container,
 
     cont1 TYPE REF TO cl_gui_container,
 
     cont2 TYPE REF TO cl_gui_container.
 
 
 
*Initialisation event
 
INITIALIZATION.
 
 
 
*start of selection event
 
START-OF-SELECTION.
 
 
 
*Call screen for the container for output
 
**Create a screen with custom control and name it as 'CONTAINER'(Here).
 
  CALL SCREEN 600.
 
 
 
*PBO module for the output display
 
*&----------------------------------------------------------------*
 
*&      Module  PBO_0600  OUTPUT
 
*&----------------------------------------------------------------*
 
MODULE pbo_0600 OUTPUT.
 
*Setting the GUI status for the splitter screen(EXIT button)
 
*  SET PF-STATUS 'SPLITGRAPH'.
 
 
 
*Setting the title for the splitter control
 
  SET TITLEBAR 'SPLITGRAPH'.
 
 
 
*Creating custom container
 
  CREATE OBJECT custom_container
 
    EXPORTING
 
      container_name = 'CONTAINER'.
 
 
 
*creating the splitter control
 
  CREATE OBJECT splitter
 
    EXPORTING
 
      parent  = custom_container
 
      rows    = 1
 
      columns = 2
 
      align   = 15.
 
 
 
*calling the container method of the splitter class
 
*for the first graphic
 
  CALL METHOD splitter->get_container
 
    EXPORTING
 
      row       = 1
 
      column    = 1
 
    RECEIVING
 
      container = cont1.
 
 
 
*calling the container method of the splitter class
 
*for the second graphic
 
  CALL METHOD splitter->get_container
 
    EXPORTING
 
      row       = 1
 
      column    = 2
 
    RECEIVING
 
      container = cont2.
 
 
 
**Graphic 1 display
 
  REFRESH : grval1,col1_texts.
 
  gprval1-rowtxt = 'Reports'.
 
  gprval1-val1 = 100.
 
  gprval1-val2 = 125.
 
  APPEND gprval1 TO grval1.
 
  gprval1-rowtxt = 'Tables'.
 
  gprval1-val1 = 200.
 
  gprval1-val2 = 600.
 
  APPEND gprval1 TO grval1.
 
  gprval1-rowtxt = 'Module-Pools'.
 
  gprval1-val1 = 135.
 
  gprval1-val2 = 150.
 
  APPEND gprval1 TO grval1.
 
  gprval1-rowtxt = 'Infotypes'.
 
  gprval1-val1 = 100.
 
  gprval1-val2 = 200.
 
  APPEND gprval1 TO grval1.
 
  col1_wa-coltxt = '2005'.
 
  APPEND col1_wa TO col1_texts.
 
  col1_wa-coltxt = '2006'.
 
  APPEND col1_wa TO col1_texts.
 
 
 
*Function module to display graph (Graph 1)
 
  CALL FUNCTION 'GFW_PRES_SHOW_MULT'
 
    EXPORTING
 
      parent            = cont1
 
      presentation_type = gfw_orient_rows
 
      show              = gfw_false
 
    TABLES
 
      values            = grval1
 
      column_texts      = col1_texts
 
    EXCEPTIONS
 
      error_occurred    = 1.
 
 
 
*Graphic 2 display
 
  REFRESH : grval2,col2_texts.
 
  gprval2-rowtxt = 'Dynamic actions'.
 
  gprval2-val1 = 3.
 
  gprval2-val2 = 5.
 
  APPEND gprval2 TO grval2.
 
  gprval2-rowtxt = 'TEM Reports'.
 
  gprval2-val1 = 27.
 
  gprval2-val2 = 30.
 
  APPEND gprval2 TO grval2.
 
  gprval2-rowtxt = 'Queries'.
 
  gprval2-val1 = 32.
 
  gprval2-val2 = 50.
 
  APPEND gprval2 TO grval2.
 
  gprval2-rowtxt = 'Others'.
 
  gprval2-val1 = 45.
 
  gprval2-val2 = 48.
 
  APPEND gprval2 TO grval2.
 
  col2_wa-coltxt = '2005'.
 
  APPEND col2_wa TO col2_texts.
 
  col2_wa-coltxt = '2006'.
 
  APPEND col2_wa TO col2_texts.
 
 
 
*Function module to display Graph 2
 
  CALL FUNCTION 'GFW_PRES_SHOW_MULT'
 
    EXPORTING
 
      parent            = cont2
 
      presentation_type = gfw_prestype_lines
 
      show              = gfw_true
 
    TABLES
 
      values            = grval2
 
      column_texts      = col2_texts
 
    EXCEPTIONS
 
      error_occurred    = 1.
 
ENDMODULE.                 " PBO_0600  OUTPUT
 
 
 
*PAI module : Based on user input,action is performed
 
*EXIT called to leave program when user clicks it
 
*&----------------------------------------------------------------*
 
*&      Module  PAI_0600  INPUT
 
*&----------------------------------------------------------------*
 
MODULE pai_0600.
 
  ok_code = sy-ucomm.
 
  IF ok_code EQ 'EXIT1'.
 
    LEAVE PROGRAM.
 
  ENDIF.
 
ENDMODULE.                 " PAI_0600  INPUT

 效果图 

 

 

 

 

3、可以使用SAP ALV自带的图表功能进行维护:

   参考地址:https://blogs.sap.com/2014/07/07/alv-graphs-an-accidental-discovery/

4、可以使用function :  MCS_BUSG3_MENU 进行编辑复杂的3D图表

参数示例:

 

 

 

 

 

 

posted on   TorranceZhao  阅读(325)  评论(0编辑  收藏  举报

导航

< 2025年3月 >
23 24 25 26 27 28 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 1 2 3 4 5
点击右上角即可分享
微信分享提示