-
Notifications
You must be signed in to change notification settings - Fork 10
/
zdsh_builder_show.prog.abap
1723 lines (1448 loc) · 57.3 KB
/
zdsh_builder_show.prog.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
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
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
*&---------------------------------------------------------------------*
*& Report ZDSH_BUILDER_SHOW
*& Edit Dashboard Builder definition
*&---------------------------------------------------------------------*
*& Author: Frank Buchholz, SAP CoE Security Services
*&
*& 16.01.2018 Initial version
*& 16.08.2018 Variant SEC_BASELINE extended
*& 19.10.2020 Adjusted data type for formal parameter of form routine
*& 02.02.2021 Interactive option to move item to another parent id (inactive, see comment ### - use with extreme caution!)
*& 04.02.2021 New option to show keys only
*& 12.02.2021 Rearrange columns to show texts in one line
*& 19.02.2021 Add some texts
*& to do:
*& Check authorization for SM_DSHO not only for dashboard but for category, too.
*&---------------------------------------------------------------------*
REPORT zdsh_builder_edit
LINE-SIZE 1023.
CONSTANTS: c_program_version(10) TYPE c VALUE '19.02.2020'.
* Dashboard item Transport key Element type Table
* Dashboard category: Security Baseline R3TR DSHE YCP54M5B614VV681 CAT AGS_DSH_CAT
* Dashboard: Security Baseline ABAP R3TR DSHE ZC60Q0QER8T6511Q DSH AGS_DSH_HEADER
* Group: System Configuration R3TR DSHE YZ587XO6J7YEP28O KPI AGS_KPI_CONF
* Tile: Password Policy R3TR DSHE YQ3R6Y8U5M83DA6A KPI AGS_KPI_CONF
* Drilldown view: Password Policy (Overview) R3TR DSHE YP95L70GT14B441K DRV AGS_KPI_DRILLDOW
* Drilldown view: Password Policy (Details) R3TR DSHE ZQ9PFT0SW08EY1W9 DRV AGS_KPI_DRILLDOW
* Tile: Standard Users R3TR DSHE YK7S0802GCZ4852G KPI AGS_KPI_CONF
* Drilldown view: Standard Users (Overview) R3TR DSHE YB907K0L6068696O DRV AGS_KPI_DRILLDOW
* Drilldown view: Standard Users (User) R3TR DSHE YG64J8H63OZQVN1A DRV AGS_KPI_DRILLDOW
* Drilldown view: Standard Users (Profile Parameter) R3TR DSHE YXO19I67SW3J45FI DRV AGS_KPI_DRILLDOW
* ...
DATA:
* All
ls_tadir TYPE tadir, "(X) Directory of Repository Objects
ls_ags_dsh_elt_dir TYPE ags_dsh_elt_dir, "(X) Dashboard element directory
lt_ags_dsh_elt_dir TYPE TABLE OF ags_dsh_elt_dir, "(X) Dashboard element directory
* Category
ls_ags_dsh_cat TYPE ags_dsh_cat, "(X) solman dashboard category
ls_ags_dsh_cat_txt TYPE ags_dsh_cat_txt, "(X) text for dashboard category
* Dashboard
ls_ags_dsh_header TYPE ags_dsh_header, "(X) dashboard header table, incl. CATEGORY
ls_ags_dsh_head_txt TYPE ags_dsh_head_txt, "(X) dashboard header text table
ls_ags_dsh_gflt_hd TYPE ags_dsh_gflt_hd, "(X) dashboard global filter header
* Group (KPI_KIND = KPG) / KPI Item
ls_ags_kpi_conf TYPE ags_kpi_conf, "(X) dashboard KPI defintion, incl. PARENT_ID of dashboard
ls_ags_kpi_conf_txt TYPE ags_kpi_conf_txt, "(X) dashboard KPI defintion text table, incl. PARENT_ID of dashboard
ls_ags_dsh_kfg_conf TYPE ags_dsh_kfg_conf, "(X) kpi data source setting key figures for columns
ls_ags_dsh_flt_conf TYPE ags_dsh_flt_conf, "(X) kpi data source setting filter
ls_ags_dsh_ds_conf TYPE ags_dsh_ds_conf, "(X) data sources for tile/drilldown chart configuration
ls_dsh_kpi_thres_hd TYPE dsh_kpi_thres_hd, "(X) kpi threshold defintion
* Drilldown
ls_ags_kpi_drilldow TYPE ags_kpi_drilldow, "(X) KPI drilldown definition, incl. PARENT_ID of KPI item
ls_ags_dsh_dril_txt TYPE ags_dsh_dril_txt, "(X) text table for AGS_DSH_DRIL_TXT, incl. PARENT_ID of KPI item
ls_ags_dsh_dim_conf TYPE ags_dsh_dim_conf, "(X) rows: selected characteristics
* LS_AGS_DSH_FLT_CONF type AGS_DSH_FLT_CONF, "(X) kpi data source setting filter
* Other tables (not used by Security Baseline Template)
ls_ags_dsh_condit TYPE ags_dsh_condit, "condition setting
ls_ags_dsh_ds_flt TYPE ags_dsh_ds_flt, "data source level predefined filters(like monid/sid/client)
ls_ags_dsh_gflt_lst TYPE ags_dsh_gflt_lst, "global filter lastset table
ls_ags_dsh_gflt_map TYPE ags_dsh_gflt_map, "global filter mapping table
ls_ags_dsh_gflt_opr TYPE ags_dsh_gflt_opr, "global filter available operator(EQ;NE;BT)
ls_ags_kpi_to_appl TYPE ags_kpi_to_appl, "jump to url for drilldown table
ls_dsh_kpi_threstxt TYPE dsh_kpi_threstxt, "kpi threshold defintion text table
ls_ags_dsh_thre_dim TYPE ags_dsh_thre_dim, "threshold setting: characteristic values (header)
ls_ags_monty_conf TYPE ags_monty_conf, "BPA key figure monetary value configuration
ls_ags_std_kpi_info TYPE ags_std_kpi_info, "dashboard KPI defintion
ls_dsh_semantic_set TYPE dsh_semantic_set, "semantics setting for dashboard charactertics
ls_dsh_sematic_set2 TYPE dsh_sematic_set2, "semantics setting for dashboard charactertics
ls_dsh_time_flt_rol TYPE dsh_time_flt_rol "kpi data source setting time filter rolling pattern
.
DATA:
posid TYPE i VALUE 19, " Line position of ID = lenName + 1
posdata TYPE i VALUE 39, " Line position of data = posID + 16 + 1 + 2 + 1
postext TYPE i VALUE 110. " Line position of text
*&---------------------------------------------------------------------*
TABLES sscrfields.
SELECTION-SCREEN: FUNCTION KEY 1. "Dashboard Builder
SELECTION-SCREEN BEGIN OF BLOCK dsh WITH FRAME TITLE text001.
* Categories DEFTP = CAT
DATA s_catid LIKE ls_ags_dsh_elt_dir-eltuid.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 1(25) ss_catid FOR FIELD scatid.
SELECT-OPTIONS scatid FOR s_catid MATCHCODE OBJECT catid_hlp
DEFAULT 'YCP54M5B614VV681' "Security Baseline
.
SELECTION-SCREEN END OF LINE.
* Dashboards DEFTP = DSH
DATA s_dshid LIKE ls_ags_dsh_elt_dir-eltuid.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 1(25) ss_dshid FOR FIELD sdshid.
SELECT-OPTIONS sdshid FOR s_catid MATCHCODE OBJECT dshid_hlp.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
PARAMETERS pkeys AS CHECKBOX DEFAULT ' '.
SELECTION-SCREEN COMMENT 5(28) ss_keys FOR FIELD pkeys.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK dsh.
SELECTION-SCREEN BEGIN OF BLOCK tech WITH FRAME TITLE text002.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 1(28) ss_ptech FOR FIELD ptech.
PARAMETERS ptech AS CHECKBOX DEFAULT ' '.
SELECTION-SCREEN END OF LINE.
* Items
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 1(25) ss_id FOR FIELD seltuid.
SELECT-OPTIONS seltuid FOR ls_ags_dsh_elt_dir-eltuid.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK tech.
SELECTION-SCREEN SKIP.
SELECTION-SCREEN COMMENT /1(60) ss_vers.
*&---------------------------------------------------------------------*
INITIALIZATION.
DATA: functxt TYPE smp_dyntxt.
functxt-icon_id = icon_wd_application.
functxt-quickinfo = 'Dashboard Builder'(001).
functxt-icon_text = 'Builder'(002).
sscrfields-functxt_01 = functxt.
text001 = 'Dashboard Builder'(001).
ss_catid = 'Dashboard Category'(003).
* 'YCP54M5B614VV681' "Security Baseline
ss_dshid = 'Dashboard'(004).
* 'ZC60Q0QER8T6511Q' "Security Baseline ABAP
* 'YXXL1O2PPW5N18FS' "Security Baseline Critical Authorizations
* 'YF69KB598Z3R1DXW' "Security Baseline JAVA
* 'YG9ZNW0KGG6U57E0' "Security Notes ABAP with Configuration
text002 = 'Technical view'(005).
ss_id = 'Item'(006).
ss_ptech = 'Technical view'(005).
ss_keys = 'Show keys only'.
CONCATENATE 'Program version:'(VER) c_program_version INTO ss_vers
SEPARATED BY space.
CONCATENATE 'Show Dashboard Definition'(010)
'(' 'Version'(023) c_program_version ')'
INTO sy-title SEPARATED BY space.
*&---------------------------------------------------------------------*
AT SELECTION-SCREEN.
CASE sscrfields-ucomm.
WHEN 'FC01'.
* Dashboard Builder
DATA: lv_url TYPE string.
* call function 'AGS_DSH_GET_BUILDER_URL'
* IMPORTING
* EV_URL = lv_URL
* .
*data: lv_url type string.
CALL METHOD cl_wd_utilities=>construct_wd_url
EXPORTING
application_name = 'AGS_DSH_ISLAND_TILES' " Application
* IN_HOST = " Requested Host if Not Own
* IN_PORT = " Requested Port Number
* IN_PROTOCOL = " Requested Log
* IN_PARAMETERS = " Additional parameters
* IN_CLIENT = " Requested Client ('csf', 'XmlClient', ...)
* IN_FORWARD_ACCESSIBILITY_FLAG = ABAP_TRUE " Forward the Accessibility Flag if Required
in_forward_language = abap_true " Forwarding Logon Language
in_forward_client = abap_true " Forwarding Client
* IN_FORWARD_THEME = " Forwarding of sap-theme parameter
* NAMESPACE = 'sap' " Namespace
* IN_SERVER = " HTTP Framework (iHTTP) HTTP Server
IMPORTING
* OUT_HOST = " Host Name
* OUT_PORT = " Port Number
* OUT_PROTOCOL = " Log
* OUT_LOCAL_URL = " URL (Relative to the Current Server)
out_absolute_url = lv_url " Absolute URL (Incl. Log, Host, Port)
* VH_SWITCH =
.
PERFORM call_url
USING lv_url.
ENDCASE.
FORM call_url
USING lv_url TYPE string.
* URL generation see report /UI2/START_URL
* <https>://<server>:<port>/sap/bc/ui5_ui5/ui2/ushell/shells/abap/FioriLaunchpad.html<action>?sap-client=<client>
**********************************************************************
* create entries in table HTTPURLLOC for the below application string.
* these entries have to point to the reverse proxy (e.g. SAP WebDispatcher).
**********************************************************************
* single sign-on
CONSTANTS lc_icf_url TYPE string VALUE '/sap/public/myssocntl'. "#EC SYNTCHAR
DATA lv_sso_active TYPE abap_bool.
CALL METHOD cl_icf_tree=>if_icf_tree~service_from_url
EXPORTING
url = lc_icf_url
hostnumber = 0
authority_check = abap_false
IMPORTING
icfactive = lv_sso_active
EXCEPTIONS
wrong_application = 1
no_application = 2
not_allow_application = 3
wrong_url = 4
no_authority = 4
OTHERS = 5.
IF sy-subrc NE 0.
lv_sso_active = abap_false.
ENDIF.
* if lv_sso_active eq abap_false.
* message e027(bsp_wd) with lc_icf_url.
* endif.
DATA lv_urlc TYPE c LENGTH 1024.
lv_urlc = lv_url.
* start browser with single sign-on
IF lv_sso_active = abap_true.
DATA lv_container TYPE REF TO cl_gui_container. "#EC NEEDED
DATA lv_viewer TYPE REF TO cl_gui_html_viewer.
CREATE OBJECT lv_viewer
EXPORTING
parent = lv_container
EXCEPTIONS
cntl_error = 1
cntl_install_error = 2
dp_install_error = 3
dp_error = 4
OTHERS = 5.
IF sy-subrc NE 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4
DISPLAY LIKE 'E'.
ENDIF.
CALL METHOD lv_viewer->enable_sapsso
EXPORTING
enabled = abap_true
EXCEPTIONS
cntl_error = 1
OTHERS = 2.
IF sy-subrc NE 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4
DISPLAY LIKE 'E'.
ENDIF.
CALL METHOD lv_viewer->detach_url_in_browser
EXPORTING
url = lv_urlc
EXCEPTIONS
cntl_error = 1
OTHERS = 2.
IF sy-subrc NE 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4
DISPLAY LIKE 'E'.
ENDIF.
CALL METHOD cl_gui_cfw=>flush
EXCEPTIONS
cntl_system_error = 1
cntl_error = 2
OTHERS = 3.
IF sy-subrc NE 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4
DISPLAY LIKE 'E'.
ENDIF.
* start browser without single-sign-on
ELSE.
CALL FUNCTION 'CALL_BROWSER'
EXPORTING
url = lv_urlc
* WINDOW_NAME = ' '
new_window = abap_true
EXCEPTIONS
frontend_not_supported = 1
frontend_error = 2
prog_not_found = 3
no_batch = 4
unspecified_error = 5
OTHERS = 6.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE 'S' NUMBER sy-msgno WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4
DISPLAY LIKE 'E'.
ENDIF.
ENDIF.
ENDFORM. " CALL_URL
*&---------------------------------------------------------------------*
* Table AGS_DSH_ELT_DIR
* ELTUID Key
* DEFTP Type
* MAPNAME Short text
AT SELECTION-SCREEN ON VALUE-REQUEST FOR seltuid-low.
PERFORM f4_seltuid USING 'SELTUID'.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR seltuid-high.
PERFORM f4_seltuid USING 'SELTUID'.
*
FORM f4_seltuid USING l_dynprofield TYPE help_info-dynprofld.
DATA: progname TYPE sy-repid,
dynnum TYPE sy-dynnr,
dynpro_values TYPE TABLE OF dynpread,
field_value LIKE LINE OF dynpro_values,
field_tab TYPE TABLE OF dfies WITH HEADER LINE.
STATICS:
value_tab LIKE ags_dsh_elt_dir OCCURS 0.
DATA: ls_system_info TYPE ags_sr_s_lmdb_system.
progname = sy-repid.
dynnum = sy-dynnr.
IF value_tab[] IS INITIAL.
SELECT * FROM ags_dsh_elt_dir
INTO TABLE value_tab
WHERE deftp NE 'CAT'
AND deftp NE 'DSH'
ORDER BY deftp eltuid.
ENDIF.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
ddic_structure = 'AGS_DSH_ELT_DIR'
retfield = 'ELTUID'
dynpprog = progname
dynpnr = dynnum
dynprofield = l_dynprofield
value_org = 'S'
* MULTIPLE_CHOICE = 'X'
TABLES
* field_tab = field_tab
value_tab = value_tab
EXCEPTIONS
parameter_error = 1
no_values_found = 2.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
ENDFORM. "F4_SELDEFT
*&---------------------------------------------------------------------*
START-OF-SELECTION.
CONCATENATE 'Show Dashboard Definition'(010)
'(' 'Version'(023) c_program_version ')'
INTO sy-title SEPARATED BY space.
* Check authority (simplified)
AUTHORITY-CHECK OBJECT 'SM_DSHO'
ID 'ACTVT' FIELD '03'
ID 'DSHID' DUMMY
ID 'CATID' DUMMY.
IF sy-subrc <> 0.
* Missing authority &1: ACTVT = &2 / DSHID = &3 / CATID = &4
MESSAGE e002(dsh_builder) WITH 'SM_DSHO' '03 (display)' '' ''.
ENDIF.
* Get DDIC texts for KPI rendering type
DATA: ls_kpi_rendering_type_text TYPE dd07v,
lt_kpi_rendering_type_text TYPE TABLE OF dd07v.
CALL FUNCTION 'DDUT_DOMVALUES_GET'
EXPORTING
name = 'DSH_RENDERING_TYPE'
* LANGU = SY-LANGU
texts_only = 'X'
TABLES
dd07v_tab = lt_kpi_rendering_type_text
EXCEPTIONS
illegal_input = 1
OTHERS = 2.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
* Get DDIC texts for drilldown rendering type
DATA: ls_drill_rendering_type_text TYPE dd07v,
lt_drill_rendering_type_text TYPE TABLE OF dd07v.
CALL FUNCTION 'DDUT_DOMVALUES_GET'
EXPORTING
name = 'DSH_DRILL_RENDER_TYPE'
* LANGU = SY-LANGU
texts_only = 'X'
TABLES
dd07v_tab = lt_drill_rendering_type_text
EXCEPTIONS
illegal_input = 1
OTHERS = 2.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
FORMAT RESET.
* Dashboard element directory
IF ptech IS INITIAL.
PERFORM write_dashboards.
ENDIF.
CHECK ptech = 'X'.
* 1. Category
IF scatid[] IS NOT INITIAL.
SELECT * FROM ags_dsh_elt_dir INTO TABLE lt_ags_dsh_elt_dir
WHERE eltuid IN scatid
AND deftp = 'CAT'.
LOOP AT lt_ags_dsh_elt_dir INTO ls_ags_dsh_elt_dir.
PERFORM write_element.
ENDLOOP.
IF sy-subrc = 0.
SKIP.
ENDIF.
ENDIF.
* 2. Dashboard
IF sdshid[] IS NOT INITIAL.
SELECT * FROM ags_dsh_elt_dir INTO TABLE lt_ags_dsh_elt_dir
WHERE eltuid IN sdshid
AND deftp = 'DSH'.
LOOP AT lt_ags_dsh_elt_dir INTO ls_ags_dsh_elt_dir.
PERFORM write_element.
ENDLOOP.
IF sy-subrc = 0.
SKIP.
ENDIF.
ENDIF.
* Other items
IF seltuid[] IS NOT INITIAL.
SELECT * FROM ags_dsh_elt_dir INTO TABLE lt_ags_dsh_elt_dir
WHERE eltuid IN seltuid.
* 3. Group
* Groups are KPIs having an entry in field AGS_KPI_CONF-KPI_ID with AGS_KPI_CONF-KPI_KIND = 'KGP'
* 4.1 KPI
LOOP AT lt_ags_dsh_elt_dir INTO ls_ags_dsh_elt_dir
WHERE deftp = 'KPI'.
DATA: ls_ags_kpi_conf_temp TYPE ags_kpi_conf.
SELECT SINGLE * FROM ags_kpi_conf INTO ls_ags_kpi_conf_temp
WHERE kpi_id = ls_ags_dsh_elt_dir-eltuid
AND kpi_kind = 'KGP'
.
IF sy-subrc = 0.
PERFORM write_element.
WRITE: / 'Group'(007).
DELETE lt_ags_dsh_elt_dir.
ENDIF.
ENDLOOP.
IF sy-subrc = 0.
SKIP.
ENDIF.
* 4.1 KPI
LOOP AT lt_ags_dsh_elt_dir INTO ls_ags_dsh_elt_dir
WHERE deftp = 'KPI'.
PERFORM write_element.
ENDLOOP.
IF sy-subrc = 0.
SKIP.
ENDIF.
* 4.2 KPI Child
LOOP AT lt_ags_dsh_elt_dir INTO ls_ags_dsh_elt_dir
WHERE deftp = 'CHD'.
PERFORM write_element.
ENDLOOP.
IF sy-subrc = 0.
SKIP.
ENDIF.
* 4.3 KPI Drilldown view
LOOP AT lt_ags_dsh_elt_dir INTO ls_ags_dsh_elt_dir
WHERE deftp = 'DRV'.
PERFORM write_element.
ENDLOOP.
IF sy-subrc = 0.
SKIP.
ENDIF.
ENDIF.
*&---------------------------------------------------------------------*
FORM write_element.
CHECK ptech = 'X'.
*----------------------------------------------------------------------
* Directory of Repository Objects
DATA: ls_tadir TYPE tadir.
CLEAR ls_tadir.
SELECT SINGLE * FROM tadir INTO ls_tadir
WHERE pgmid = 'R3TR'
AND object = 'DSHE'
AND obj_name = ls_ags_dsh_elt_dir-eltuid.
FORMAT COLOR COL_HEADING.
WRITE: / 'Dashboard element'(008),
AT posid ls_ags_dsh_elt_dir-eltuid INTENSIFIED,
AT posdata ls_ags_dsh_elt_dir-deftp.
CASE ls_ags_dsh_elt_dir-deftp.
WHEN 'CAT'. WRITE (15) 'Category'(009).
WHEN 'DSH'. WRITE (15) 'Dashboard'(004).
WHEN 'KPI'. WRITE (15) 'Key perf. index'(011).
WHEN 'CHD'. WRITE (15) 'Child KPI'(012).
WHEN 'DRV'. WRITE (15) 'Drilldown view'(013).
WHEN OTHERS. WRITE (15) ls_ags_dsh_elt_dir-deftp COLOR COL_NEGATIVE.
ENDCASE.
WRITE: ls_ags_dsh_elt_dir-mapname,
(2) space. " no icon here
WRITE: ls_tadir-devclass,
ls_tadir-author.
WRITE: AT sy-linsz space.
FORMAT RESET.
*----------------------------------------------------------------------
* solman dashboard category
SELECT * FROM ags_dsh_cat INTO ls_ags_dsh_cat
WHERE id = ls_ags_dsh_elt_dir-eltuid.
WRITE: / 'AGS_DSH_CAT',
AT posid(16) ls_ags_dsh_cat-namespace,
(2) space, " no icon here
AT posdata ls_ags_dsh_cat-created_by,
ls_ags_dsh_cat-created_at DD/MM/YYYY.
* text for dashboard category
SELECT SINGLE * FROM ags_dsh_cat_txt INTO ls_ags_dsh_cat_txt
WHERE id = ls_ags_dsh_cat-id
AND lang = sy-langu.
IF sy-subrc NE 0 AND sy-langu NE 'E'.
SELECT SINGLE * FROM ags_dsh_cat_txt INTO ls_ags_dsh_cat_txt
WHERE id = ls_ags_dsh_cat-id
AND lang = 'E'.
ENDIF.
IF sy-subrc = 0.
WRITE: / 'AGS_DSH_CAT_TXT',
AT posid ls_ags_dsh_cat_txt-name COLOR COL_NORMAL.
ENDIF.
ENDSELECT.
*----------------------------------------------------------------------
* dashboard header table
SELECT * FROM ags_dsh_header INTO ls_ags_dsh_header
WHERE id = ls_ags_dsh_elt_dir-eltuid
ORDER BY pos.
WRITE: / 'AGS_DSH_HEADER',
AT posid ls_ags_dsh_header-category,
(2) space, " no icon here
AT posdata
* (30) LS_AGS_DSH_HEADER-LOGO,
* LS_AGS_DSH_HEADER-NAMESPACE,
* LS_AGS_DSH_HEADER-CREATED_BY,
* LS_AGS_DSH_HEADER-CREATED_AT dd/mm/yyyy,
ls_ags_dsh_header-last_modified_by,
ls_ags_dsh_header-last_modified_at DD/MM/YYYY,
* LS_AGS_DSH_HEADER-LAST_MODIFIED_TS,
* LS_AGS_DSH_HEADER-AUTO_REFRESH,
* LS_AGS_DSH_HEADER-TIME_INTERVAL,
ls_ags_dsh_header-pos.
* dashboard header text table
SELECT SINGLE * FROM ags_dsh_head_txt INTO ls_ags_dsh_head_txt
WHERE id = ls_ags_dsh_header-id
AND lang = sy-langu.
IF sy-subrc NE 0 AND sy-langu NE 'E'.
SELECT SINGLE * FROM ags_dsh_head_txt INTO ls_ags_dsh_head_txt
WHERE id = ls_ags_dsh_header-id
AND lang = 'E'.
ENDIF.
IF sy-subrc = 0.
WRITE: / 'AGS_DSH_HEAD_TXT',
AT posid ls_ags_dsh_head_txt-name COLOR COL_NORMAL,
ls_ags_dsh_head_txt-description COLOR COL_NORMAL.
ENDIF.
* dashboard global filter header
SELECT * FROM ags_dsh_gflt_hd INTO ls_ags_dsh_gflt_hd
WHERE dsh_id = ls_ags_dsh_header-id.
WRITE: / 'AGS_DSH_GFLT_HD',
AT posid ls_ags_dsh_gflt_hd-gflt_id INTENSIFIED,
(2) space, " no icon here
AT posdata(30) ls_ags_dsh_gflt_hd-primary_ds,
ls_ags_dsh_gflt_hd-primary_ds_type,
ls_ags_dsh_gflt_hd-filter_field,
"LS_AGS_DSH_GFLT_HD-pos,
ls_ags_dsh_gflt_hd-sign,
ls_ags_dsh_gflt_hd-operator,
ls_ags_dsh_gflt_hd-low,
ls_ags_dsh_gflt_hd-high.
ENDSELECT.
ENDSELECT.
*----------------------------------------------------------------------
* dashboard KPI defintion
SELECT * FROM ags_kpi_conf INTO ls_ags_kpi_conf
WHERE parent_id = ls_ags_dsh_elt_dir-eltuid
ORDER BY pos.
* dashboard KPI defintion text table
CLEAR ls_ags_kpi_conf_txt.
SELECT SINGLE * FROM ags_kpi_conf_txt INTO ls_ags_kpi_conf_txt
WHERE parent_id = ls_ags_kpi_conf-parent_id
AND kpi_id = ls_ags_kpi_conf-kpi_id
AND lang = sy-langu.
IF sy-subrc NE 0 AND sy-langu NE 'E'.
SELECT SINGLE * FROM ags_kpi_conf_txt INTO ls_ags_kpi_conf_txt
WHERE parent_id = ls_ags_kpi_conf-parent_id
AND kpi_id = ls_ags_kpi_conf-kpi_id
AND lang = 'E'.
ENDIF.
WRITE: / 'AGS_KPI_CONF',
AT posid ls_ags_kpi_conf-kpi_id INTENSIFIED,
"ls_ags_kpi_conf-parent_id COLOR COL_POSITIVE,
*###
'@3N@' AS ICON HOTSPOT, "3N ICON_INSERT_RELATION
AT posdata ls_ags_kpi_conf-kpi_kind,
ls_ags_kpi_conf-pos,
ls_ags_kpi_conf-layout_type,
ls_ags_kpi_conf-rendering_type,
ls_ags_kpi_conf-ds_type,
(30) ls_ags_kpi_conf-ds_source,
"LS_AGS_KPI_CONF-DS_LAST_CHANGED_AT,
ls_ags_kpi_conf-ds_source_setting,
ls_ags_kpi_conf-drilldown_target_template,
ls_ags_kpi_conf-drilldown_target_id,
(30) ls_ags_kpi_conf-url,
ls_ags_kpi_conf-smart_init_vis,
ls_ags_kpi_conf-smart_init_chart.
HIDE: ls_ags_kpi_conf-parent_id,
ls_ags_kpi_conf-pos,
ls_ags_kpi_conf_txt-kpi_name.
IF ls_ags_kpi_conf_txt-kpi_name IS NOT INITIAL.
WRITE: / 'AGS_KPI_CONF_TXT',
AT posid "LS_AGS_KPI_CONF_TXT-KPI_ID intensified,
ls_ags_kpi_conf_txt-kpi_name COLOR COL_NORMAL,
ls_ags_kpi_conf_txt-kpi_description COLOR COL_NORMAL,
ls_ags_kpi_conf_txt-kpi_goal,
ls_ags_kpi_conf_txt-kpi_units.
ENDIF.
* Data source
SELECT * FROM ags_dsh_ds_conf INTO ls_ags_dsh_ds_conf
WHERE ds_setting_id = ls_ags_kpi_conf-kpi_id
ORDER BY pos.
WRITE: / 'AGS_KPI_CONF',
"AT posid "ls_ags_dsh_ds_conf-ds_setting_id INTENSIFIED,
"ls_AGS_DSH_DS_CONF-GUID,
AT posdata ls_ags_dsh_ds_conf-pos,
ls_ags_dsh_ds_conf-ds_type,
(30) ls_ags_dsh_ds_conf-ds_name.
ENDSELECT.
* Threshold
SELECT * FROM dsh_kpi_thres_hd INTO ls_dsh_kpi_thres_hd
WHERE kpi_id = ls_ags_kpi_conf-kpi_id.
WRITE: / 'DSH_KPI_THRES_HD',
"AT posid "ls_ags_dsh_ds_conf-threshold_id INTENSIFIED,
AT posdata(15) ls_dsh_kpi_thres_hd-kfg_id,
(15) ls_dsh_kpi_thres_hd-kfg_name,
ls_dsh_kpi_thres_hd-sign,
ls_dsh_kpi_thres_hd-zoption,
(10) ls_dsh_kpi_thres_hd-low,
(10) ls_dsh_kpi_thres_hd-high,
ls_dsh_kpi_thres_hd-rating.
ENDSELECT.
ENDSELECT.
*----------------------------------------------------------------------
* KPI drilldown definition
SELECT * FROM ags_kpi_drilldow INTO ls_ags_kpi_drilldow
WHERE parent_id = ls_ags_dsh_elt_dir-eltuid
ORDER BY pos.
WRITE: / 'AGS_KPI_DRILLDOW',
AT posid ls_ags_kpi_drilldow-kpi_id INTENSIFIED,
(2) space, " no icon here
AT posdata ls_ags_kpi_drilldow-pos,
ls_ags_kpi_drilldow-ds_type,
(30) ls_ags_kpi_drilldow-ds_source,
"LS_AGS_KPI_DRILLDOW-DS_LAST_CHANGED_AT,
ls_ags_kpi_drilldow-ds_source_setting,
ls_ags_kpi_drilldow-render_type,
ls_ags_kpi_drilldow-disable_visual_switch,
ls_ags_kpi_drilldow-jump_bics,
ls_ags_kpi_drilldow-target_url_type,
ls_ags_kpi_drilldow-appl_target_url,
ls_ags_kpi_drilldow-drilldown_type,
ls_ags_kpi_drilldow-jump_type.
* text table for AGS_DSH_DRIL_TXT
SELECT SINGLE * FROM ags_dsh_dril_txt INTO ls_ags_dsh_dril_txt
WHERE parent_id = ls_ags_kpi_drilldow-parent_id
AND kpi_id = ls_ags_kpi_drilldow-kpi_id
AND lang = sy-langu.
IF sy-subrc NE 0 AND sy-langu NE 'E'.
SELECT SINGLE * FROM ags_dsh_dril_txt INTO ls_ags_dsh_dril_txt
WHERE parent_id = ls_ags_kpi_drilldow-parent_id
AND kpi_id = ls_ags_kpi_drilldow-kpi_id
AND lang = sy-langu.
ENDIF.
IF sy-subrc = 0.
WRITE: / 'AGS_DSH_DRIL_TXT',
AT posid "LS_AGS_DSH_DRIL_TXT-PARENT_ID intensified,
"LS_AGS_DSH_DRIL_TXT-KPI_ID intensified,
ls_ags_dsh_dril_txt-drilldown_name COLOR COL_NORMAL.
ENDIF.
* Data source
SELECT * FROM ags_dsh_ds_conf INTO ls_ags_dsh_ds_conf
WHERE ds_setting_id = ls_ags_kpi_drilldow-kpi_id
ORDER BY pos.
WRITE: / 'AGS_KPI_CONF',
AT posid ls_ags_dsh_ds_conf-ds_setting_id INTENSIFIED,
"ls_AGS_DSH_DS_CONF-GUID,
AT posdata ls_ags_dsh_ds_conf-pos,
ls_ags_dsh_ds_conf-ds_type,
(30) ls_ags_dsh_ds_conf-ds_name.
ENDSELECT.
ENDSELECT.
*----------------------------------------------------------------------
* rows: selected characteristics
SELECT * FROM ags_dsh_dim_conf INTO ls_ags_dsh_dim_conf
WHERE id = ls_ags_dsh_elt_dir-eltuid
ORDER BY pos.
WRITE: / 'AGS_DSH_DIM_CONF',
AT posid ls_ags_dsh_dim_conf-dim_id INTENSIFIED,
(2) space, " no icon here
AT posdata "LS_AGS_DSH_DIM_CONF-DIM_NAME color col_group,
ls_ags_dsh_dim_conf-pos,
ls_ags_dsh_dim_conf-sort_type,
ls_ags_dsh_dim_conf-sort_direction,
ls_ags_dsh_dim_conf-kfg_member .
ENDSELECT.
* kpi data source setting filter
SELECT * FROM ags_dsh_flt_conf INTO ls_ags_dsh_flt_conf
WHERE id = ls_ags_dsh_elt_dir-eltuid
ORDER BY pos.
WRITE: / 'AGS_DSH_FLT_CONF',
AT posid "LS_AGS_DSH_FLT_CONF-ID,
ls_ags_dsh_flt_conf-dim_id INTENSIFIED,
(2) space, " no icon here
AT posdata ls_ags_dsh_flt_conf-serialno INTENSIFIED,
"LS_AGS_DSH_FLT_CONF-DIM_NAME color col_group,
ls_ags_dsh_flt_conf-kind,
(30) ls_ags_dsh_flt_conf-dim_text,
ls_ags_dsh_flt_conf-sign,
ls_ags_dsh_flt_conf-operator,
(60) ls_ags_dsh_flt_conf-low,
(60) ls_ags_dsh_flt_conf-low_text,
(60) ls_ags_dsh_flt_conf-high,
(60) ls_ags_dsh_flt_conf-high_text,
(60) ls_ags_dsh_flt_conf-text,
ls_ags_dsh_flt_conf-time_relevant,
ls_ags_dsh_flt_conf-time_rolling_id,
ls_ags_dsh_flt_conf-pos,
ls_ags_dsh_flt_conf-ref_kfg.
ENDSELECT.
* kpi data source setting key figures for columns
SELECT * FROM ags_dsh_kfg_conf INTO ls_ags_dsh_kfg_conf
WHERE id = ls_ags_dsh_elt_dir-eltuid
ORDER BY pos.
WRITE: / 'AGS_DSH_KFG_CONF',
AT posid ls_ags_dsh_kfg_conf-kfg_id INTENSIFIED,
(2) space, " no icon here
AT posdata
"LS_AGS_DSH_KFG_CONF-KFG_NAME color col_group,
ls_ags_dsh_kfg_conf-pos,
ls_ags_dsh_kfg_conf-sort_type,
ls_ags_dsh_kfg_conf-sort_direction,
ls_ags_dsh_kfg_conf-kfg_member.
ENDSELECT.
ENDFORM.
*----------------------------------------------------------------------
FORM write_dashboards.
DATA: ls_ags_dsh_header TYPE ags_dsh_header,
lt_ags_dsh_header TYPE TABLE OF ags_dsh_header.
* Dashboards
SELECT * FROM ags_dsh_header INTO TABLE lt_ags_dsh_header
WHERE id IN sdshid
AND category IN scatid
ORDER BY category pos.
LOOP AT lt_ags_dsh_header INTO ls_ags_dsh_header.
PERFORM write_dashboard
USING ls_ags_dsh_header-id.
ULINE.
ENDLOOP.
ENDFORM.
FORM write_dashboard
USING l_dashboard TYPE sysuuid_16.
DATA: ls_tadir TYPE tadir,
ls_ags_dsh_cat TYPE ags_dsh_cat,
ls_ags_dsh_cat_txt TYPE ags_dsh_cat_txt,
ls_ags_dsh_header TYPE ags_dsh_header,
ls_ags_dsh_head_txt TYPE ags_dsh_head_txt,
lt_ags_dsh_gflt_hd TYPE TABLE OF ags_dsh_gflt_hd,
ls_ags_dsh_gflt_hd TYPE ags_dsh_gflt_hd,
ls_ags_kpi_conf TYPE ags_kpi_conf,
lt_ags_kpi_conf TYPE TABLE OF ags_kpi_conf.
* Dashboard
SELECT SINGLE * FROM ags_dsh_header INTO ls_ags_dsh_header
WHERE id = l_dashboard.
SELECT SINGLE * FROM ags_dsh_head_txt INTO ls_ags_dsh_head_txt
WHERE id = l_dashboard
AND lang = sy-langu.
IF sy-subrc NE 0 AND sy-langu NE 'E'.
SELECT SINGLE * FROM ags_dsh_head_txt INTO ls_ags_dsh_head_txt
WHERE id = l_dashboard
AND lang = 'E'.
ENDIF.
* Category
SELECT SINGLE * FROM ags_dsh_cat INTO ls_ags_dsh_cat
WHERE id = ls_ags_dsh_header-category.
SELECT SINGLE * FROM ags_dsh_cat_txt INTO ls_ags_dsh_cat_txt
WHERE id = ls_ags_dsh_header-category
AND lang = sy-langu.
IF sy-subrc NE 0 AND sy-langu NE 'E'.
SELECT SINGLE * FROM ags_dsh_cat_txt INTO ls_ags_dsh_cat_txt
WHERE id = ls_ags_dsh_header-category
AND lang = 'E'.
ENDIF.
FORMAT RESET.
* Category COL_HEADING
* Dashboard COL_KEY
* Group COL_GROUP
* KPI COL_TOTAL
* Drilldown COL_NORMAL
* Category
CLEAR ls_tadir.
SELECT SINGLE * FROM tadir INTO ls_tadir
WHERE pgmid = 'R3TR'
AND object = 'DSHE'
AND obj_name = ls_ags_dsh_cat-id.
FORMAT COLOR COL_HEADING.
WRITE: /(16) 'Category'(009),
AT posid ls_ags_dsh_cat-id,
(2) space, " no icon here
AT posdata(18) ls_tadir-devclass,
"ls_tadir-author,
"ls_ags_dsh_cat-created_by,
"ls_ags_dsh_cat-created_at DD/MM/YYYY,
AT postext ls_ags_dsh_cat_txt-name,
AT sy-linsz space.
* ---
* Dashboard
CLEAR ls_tadir.
SELECT SINGLE * FROM tadir INTO ls_tadir
WHERE pgmid = 'R3TR'
AND object = 'DSHE'
AND obj_name = ls_ags_dsh_header-id.
FORMAT COLOR COL_KEY.
WRITE: /(16) 'Dashboard'(004),
AT posid ls_ags_dsh_header-id,
(2) space, " no icon here
AT posdata(18) ls_tadir-devclass,
"ls_tadir-author,
"ls_ags_dsh_header-created_by,
"ls_ags_dsh_header-created_at DD/MM/YYYY,
AT postext ls_ags_dsh_head_txt-name,
(50) ls_ags_dsh_head_txt-description,
AT sy-linsz space.
FORMAT RESET.
* IF ls_ags_dsh_head_txt-description IS NOT INITIAL.
* WRITE: / ls_ags_dsh_head_txt-description UNDER ls_ags_dsh_head_txt-name.
* ENDIF.
IF pkeys IS INITIAL.
* Global filtes of Dashboard
SELECT * FROM ags_dsh_gflt_hd INTO TABLE lt_ags_dsh_gflt_hd
WHERE dsh_id = ls_ags_dsh_header-id
ORDER BY pos.
LOOP AT lt_ags_dsh_gflt_hd INTO ls_ags_dsh_gflt_hd.
WRITE: /(16) 'Global Filter'(014),
AT posid(16) space, " no id
"LS_AGS_DSH_GFLT_HD-GFLT_ID,
AT posdata(18) ls_ags_dsh_gflt_hd-primary_ds_type,
ls_ags_dsh_gflt_hd-primary_ds.
* Data Source
IF ls_ags_dsh_gflt_hd-primary_ds_type = 'FM'.
DATA: ls_tftit TYPE tftit.
SELECT SINGLE * FROM tftit INTO ls_tftit
WHERE spras = sy-langu
AND funcname = ls_ags_dsh_gflt_hd-primary_ds.
IF sy-subrc NE 0 AND sy-langu NE 'E'.
SELECT SINGLE * FROM tftit INTO ls_tftit
WHERE spras = 'E'
AND funcname = ls_ags_dsh_gflt_hd-primary_ds.
ENDIF.
WRITE: AT postext ls_tftit-stext.
ENDIF.
WRITE: /(16) 'Field'(015),
AT posid(16) space, " no id
AT posdata(18) ls_ags_dsh_gflt_hd-filter_field,
ls_ags_dsh_gflt_hd-sign,
ls_ags_dsh_gflt_hd-operator,
ls_ags_dsh_gflt_hd-low,