-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathzrfc_statrecs_summary.prog.abap
2807 lines (2455 loc) · 99.8 KB
/
zrfc_statrecs_summary.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 ZRFC_STATRECS_SUMMARY
*& Show Workload Statistic of RFC calls
*&---------------------------------------------------------------------*
*& created by:
*& Frank Buchholz
*& SAP Active Global Support - Security Services
*&
*& Source:
*& https://github.com/SAP-samples/security-services-tools
*&
*& Version history
*& 05.12.2010 Initial version
*& 06.12.2010 Show user group and user type for local accounts
*& Navigation to ABAP editor
*& Omit program name for RFC Server records
*& Hide unimportant columns
*& 09.12.2010 Use API to read directory and data
*& 12.12.2010 Show RFC destination options
*& 27.09.2012 Show unused client destinations
*& Enable subtotals
*& 28.09.2012 Optimize robustness
*& 04.03.2013 Show RFC authorizations of users
*& 05.03.2013 Show available or missing RFC authorizations
*& List view removed
*& New ALV for main list; choose ALV layout
*& 03.05.2013 Correct bug if user has FUNC authorizations
*& Special rule for function group SRFC depending on profile parameter auth/rfc_authority_check
*& 27.05.2013 Show profile parameter stat/rfcrec
*& 19.07.2013 Update TOTAL statistics for today using report SWNCTOTALT
*& 06.12.2013 Hint to solve an issue with form tt_convert_number_to_letter
*& 24.04.2014 Activate ALV total and sub-totals
*& 17.03.2015 Bug: Authorizations with ranges are not supported as the to-field is not used
*& 16.12.2015 Navigation to SM59 for CL and CLD
*& 20.07.2017 Support for all values of auth/rfc_authority_check
*& 26.07.2017 Show Trusted RFC flags
*& Table RFCSYSACL List of permitted trusted systems for the current system: Systems whose calls are trusted (to be used to SV/SVD)
*& Table RFCTRUST List of existing trusting systems: Systems who trust current system (to be used for CL/CLD)
*& 26.03.2018 Allow exclude selection for S_USER and S_DEST
*& 26.08.2022 Updated list of tast types
*& Prepare to analyse authorizations for S_RFCACL
*& 18.01.2023 Tooltip for column Logon Procedure (trusted, basic, no user)
*& 14.09.2023 Show SNC status of outgoing destinations
*& Show http connections, too
*& 15.09.2023 Optimization
*&---------------------------------------------------------------------*
REPORT ZRFC_STATRECS_SUMMARY.
constants: c_program_version(14) type c value '15.09.2023 FBT'.
* see function SWNC_COLLECTOR_GET_AGGREGATES
* in include LSCSM_COLLECTORU04
TYPE-POOLS: slis. "Necessary for ALV
TYPE-POOLS: icon, col.
TABLES sscrfields.
* Translate task type (if you get a syntax error with the first include, than try the second one)
*INCLUDE SAPWL_DECODE_TTYPE.
INCLUDE SAPWLSTAD_TT.
SELECTION-SCREEN: FUNCTION KEY 1. "Submit report SWNCTOTALT
* Parameters: see table SWNCMONI
selection-SCREEN BEGIN OF BLOCK bsel WITH FRAME TITLE bsel.
* component: TOTAL or instance name
selection-screen begin of line.
selection-SCREEN comment 1(31) t_COMP.
parameters: p_COMP TYPE SWNCHOSTNAME default 'TOTAL'.
selection-screen end of line.
* assigndsys: System id
selection-screen begin of line.
selection-SCREEN comment 1(31) t_SYS.
parameters: p_SYS TYPE SWNCSYSID DEFAULT SY-SYSID.
selection-screen end of line.
* periodtype: M month, W week, D day
selection-screen begin of line.
selection-SCREEN comment 1(31) t_PERIOD.
parameters: p_PERIOD TYPE SWNCPERITYPE default 'M'. "M / W / D
selection-screen end of line.
* periodstrt: Start date
selection-screen begin of line.
selection-SCREEN comment 1(31) t_STRT.
parameters: p_STRT TYPE SWNCDATUM default sy-datum.
selection-screen end of line.
* End date
selection-screen begin of line.
selection-SCREEN comment 1(31) t_ENDT.
parameters: p_ENDT TYPE SWNCDATUM default sy-datum.
selection-screen end of line.
selection-SCREEN END OF BLOCK bsel.
selection-SCREEN BEGIN OF BLOCK bdat WITH FRAME TITLE bdat.
selection-screen begin of line.
parameters: p_CL as checkbox default ' '.
selection-SCREEN comment 3(79) t_CL.
selection-screen end of line.
selection-screen begin of line.
parameters: p_CLH as checkbox default ' '.
selection-SCREEN comment 3(79) t_CLH.
selection-screen end of line.
selection-screen skip.
selection-screen begin of line.
parameters: p_SV as checkbox default 'X'.
selection-SCREEN comment 3(79) t_SV.
selection-screen end of line.
selection-screen begin of line.
parameters: p_SVH as checkbox default 'X'.
selection-SCREEN comment 3(79) t_SVH.
selection-screen end of line.
selection-screen skip.
selection-screen begin of line.
parameters: p_CLD as checkbox default ' '.
selection-SCREEN comment 3(79) t_CLD.
selection-screen end of line.
selection-screen begin of line.
parameters: p_CLDH as checkbox default ' '.
selection-SCREEN comment 3(79) t_CLDH.
selection-screen end of line.
selection-screen begin of line.
selection-screen POSITION 3.
parameters: p_CLDNU as checkbox default 'X'.
selection-SCREEN comment 5(31) t_CLDNU.
selection-screen end of line.
selection-screen skip.
selection-screen begin of line.
parameters: p_SVD as checkbox default ' '.
selection-SCREEN comment 3(79) t_SVD.
selection-screen end of line.
selection-screen begin of line.
parameters: p_SVDH as checkbox default ' '.
selection-SCREEN comment 3(79) t_SVDH.
selection-screen end of line.
selection-SCREEN END OF BLOCK bdat.
selection-SCREEN BEGIN OF BLOCK bfil WITH FRAME TITLE bfil.
* User
selection-screen begin of line.
selection-SCREEN comment 1(28) t_USER.
SELECT-OPTIONS: s_USER for sy-uname.
selection-screen end of line.
* RFC Destination
data: l_RFCDEST like RFCDES-RFCDEST.
selection-screen begin of line.
selection-SCREEN comment 1(28) t_DEST.
SELECT-OPTIONS: s_DEST for l_RFCDEST.
selection-screen end of line.
* RFC Function
data: l_FUNCNAME like RS38L-NAME.
selection-screen begin of line.
selection-SCREEN comment 1(28) t_FUNC.
SELECT-OPTIONS: s_FUNC for l_FUNCNAME.
selection-screen end of line.
* Function group
data: l_GROUP like RS38L-AREA.
selection-screen begin of line.
selection-SCREEN comment 1(28) t_GROUP.
SELECT-OPTIONS: s_GROUP for l_GROUP.
selection-screen end of line.
selection-SCREEN END OF BLOCK bfil.
* Layout of ALV output
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 1(31) ps_lout FOR FIELD p_layout.
PARAMETERS p_layout TYPE disvariant-variant.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN COMMENT 1(60) ss_vers.
* RFC Options
types:
begin of ts_RFCOPTIONS,
* RFCDEST TYPE RFCDISPLAY-RFCDEST, " Destination
RFCTYPE(60)," TYPE RFCDISPLAY-RFCTYPE, " Type text
RFCHOST(60)," TYPE RFCDISPLAY-RFCHOST, " Host
RFCSERVICE TYPE RFCDISPLAY-RFCSERVICE," Service
RFCSYSID TYPE RFCDISPLAY-RFCSYSID, " Systemid (if logon group)
PFADPRE(64)," TYPE RFCDISPLAY-PFADPRE, " Logon group or
RFCCLIENT TYPE RFCDISPLAY-RFCCLIENT, " Client
RFCUSER TYPE RFCDISPLAY-RFCUSER, " User (%_LOG01% = empty)
RFCAUTH(6)," TYPE RFCDISPLAY-RFCAUTH, " Password available = %PWD%
RFCSLOGIN TYPE RFCDISPLAY-RFCSLOGIN, " Trusted = Y
RFCSAMEUSR TYPE RFCDISPLAY-RFCSAMEUSR," Trusted with same user
"RFCTRUSTID_EXT type string, " Table RFCTRUST fields RFCTRUSTID TLICENSE_NR RFCMSGSRV
RFCSNC TYPE RFCDISPLAY-RFCSNC, " SNC/TLS
SSLAPPLIC TYPE RFCDISPLAY-SSLAPPLIC, " PSE
end of ts_RFCOPTIONS.
* Main result table
types: begin of ts_result,
RECORDTYPE(3),
DATE like sy-datum,
TASKTYPE(20), " like SWNCINCRFCH-TASKTYPE,
MANDT like SWNCINCRFCH-MANDT,
ACCOUNT like SWNCINCRFCH-ACCOUNT,
USTYP like USR02-USTYP,
CLASS like usr02-class,
USERID like SWNCINCRFCH-USERID, " RFC only
RFC_CALLER like SWNCINCRFCH-USERID, " RFC server only
TARGET like SWNCINCRFCH-TARGET,
LOCAL_DEST like SWNCINCRFCH-LOCAL_DEST, " RFC only
REMOT_DEST like SWNCINCRFCH-REMOT_DEST, " RFC only
FUNC_NAME like RS38L-NAME, " RFC only
GROUP like RS38L-AREA,
AUTH_S_RFC type string, " RFC only
AUTH_S_RFCACL type string, " RFC only
PROG_NAME like RS38L-PROGNAME, " RFC client only
PROTOCOL type string, " SWNCWEBPROT, HTTP only
HOST type SWNCTXT128, " HTTP only
PORT type SWNCTXT08, " HTTP only
PATH type SWNCTXT250, " HTTP only
ENTRY_ID like SWNCINCRFCH-ENTRY_ID,
COUNTER like SWNCINCRFCB-COUNTER,
RECEIVE like SWNCINCRFCB-RECEIVE, " Corresponding field for HTTP: DATA_RECEIVE
SEND like SWNCINCRFCB-SEND, " Corresponding field for HTTP: DATA_SEND
EXE_TIME like SWNCINCRFCB-EXE_TIME, " Corresponding field for HTTP: EXECUTION_TI
CALL_TIME like SWNCINCRFCB-CALL_TIME, " Corresponding field for HTTP: CALLTIME
CALLS like SWNCAGGRFCCLNTDEST-CALLS,
RFCOPTIONS type ts_RFCOPTIONS,
end of ts_result.
data: gs_result type ts_result,
gt_result type table of ts_result.
*-----------------------------------------------------------------------
* Authorizations
types:
begin of ts_FNAME,
FROM_VALUE type c length 30,
TO_VALUE type c length 30,
end of ts_FNAME,
tt_FNAME type standard table of ts_FNAME with default key,
begin of ts_user_auth,
mandt type usr02-mandt,
bname type usr02-bname,
USTYP type usr02-USTYP,
CLASS type usr02-CLASS,
FUGR type tt_FNAME, " authorizations for S_RFC
FUNC type tt_FNAME, " authorizations for S_RFC
S_RFCACL type string, " authorizations for S_RFCACL
end of ts_user_auth,
tt_user_auth type sorted table of ts_user_auth
with non-unique key mandt bname.
data: gt_user_auth type tt_user_auth,
gs_user_auth type ts_user_auth.
* ALV
types:
begin of ts_USER,
mandt type usr02-mandt,
bname type usr02-bname,
USTYP type usr02-USTYP,
CLASS type usr02-CLASS,
FUGR type RS38L-AREA,
FUNC type TFDIR-FUNCNAME,
COUNTER like SWNCINCRFCB-COUNTER,
end of ts_USER,
TT_USER type table of ts_USER.
data: gt_USER type TT_USER,
gs_USER type TS_USER.
*-----------------------------------------------------------------------
DATA: gs_alv_lout_variant TYPE disvariant.
data: l_stat_rfcrec(6).
*-----------------------------------------------------------------------
initialization.
concatenate 'Program version'(t00) c_program_version into SS_VERS
SEPARATED BY SPACE.
DATA: functxt TYPE smp_dyntxt.
functxt-icon_id = ICON_TOOLS.
functxt-quickinfo = 'Update TOTAL statistics for today'(023).
functxt-icon_text = 'Update TOTAL'(024).
sscrfields-functxt_01 = functxt.
bsel = 'Data Selection'(t01).
t_COMP = 'Component (TOTAL or <instance>'(t02).
t_SYS = 'System ID'(t03).
t_PERIOD = 'Period (M=month, W=week, D=day)'(t04).
t_STRT = 'Start datum'(t05).
t_ENDT = 'End datum'(t06).
bdat = 'Data Options'(t07).
* 1234567890123456789012345678901234567890123456789012345678901234567890123456789
t_CL = 'CL: Show RFC functions executed by RFC client in another system'(t08).
t_CLH = 'CL: Show HTTP calls executed by HTTP client in another system'(t19).
t_SV = 'SV: Show RFC functions executing in RFC server (and show RFC authorizations)'(t09).
t_SVH = 'SV: Show HTTP calls executing in HTTP server'(t20).
t_CLD = 'CLD: Show RFC destinations for other systems called by RFC client'(t10).
t_CLDH = 'CLD: Show HTTP destinations for other systems called by HTTP client'(t21).
t_CLDNU = 'show unused destinations, too'(t11).
t_SVD = 'SVD: Show RFC destinations calling into RFC server'(t12).
t_SVDH = 'SVD: Show http destinations calling into HTTP server'(t22).
bfil = 'Filter Options'(t13).
t_USER = 'User'(t14).
t_DEST = 'Destination'(t15).
t_FUNC = 'RFC function'(t16).
t_GROUP = 'Function group'(t17).
ps_lout = 'Layout'(t18).
*----------------------------------------------------------------------*
* AT SELECTION-SCREEN
*----------------------------------------------------------------------*
AT SELECTION-SCREEN.
CASE sscrfields-ucomm.
WHEN 'FC01'.
submit SWNCTOTALT AND RETURN.
MESSAGE i861(s06).
endcase.
*----------------------------------------------------------------------*
* AT SELECTION-SCREEN ON p_layout
*----------------------------------------------------------------------*
AT SELECTION-SCREEN ON p_layout.
CHECK NOT p_layout IS INITIAL.
PERFORM handle_at_selscr_on_p_layout USING p_layout sy-repid 'A'.
*
FORM handle_at_selscr_on_p_layout
USING id_varname TYPE disvariant-variant
id_repid TYPE sy-repid
id_save TYPE c.
DATA: ls_variant TYPE disvariant.
ls_variant-report = id_repid.
ls_variant-variant = id_varname.
CALL FUNCTION 'REUSE_ALV_VARIANT_EXISTENCE'
EXPORTING
i_save = id_save
CHANGING
cs_variant = ls_variant
EXCEPTIONS
wrong_input = 1
not_found = 2
program_error = 3
OTHERS = 4.
IF sy-subrc <> 0.
* Selected layout variant is not found
MESSAGE e204(0k).
ENDIF.
gs_alv_lout_variant-report = id_repid.
gs_alv_lout_variant-variant = id_varname.
ENDFORM. " handle_at_selscr_on_p_layout
*----------------------------------------------------------------------*
* AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_layout
*----------------------------------------------------------------------*
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_layout. " ( Note 890141 )
PERFORM handle_at_selscr_f4_p_layout USING sy-repid 'A'
CHANGING p_layout.
*
FORM handle_at_selscr_f4_p_layout
USING id_repid TYPE sy-repid
id_save TYPE c
CHANGING ed_varname TYPE disvariant-variant.
gs_alv_lout_variant-report = id_repid.
CALL FUNCTION 'REUSE_ALV_VARIANT_F4'
EXPORTING
is_variant = gs_alv_lout_variant
i_save = id_save
IMPORTING
es_variant = gs_alv_lout_variant
EXCEPTIONS
not_found = 1
program_error = 2
OTHERS = 3.
IF sy-subrc = 0.
ed_varname = gs_alv_lout_variant-variant.
ELSE.
MESSAGE s073(0k).
* Keine Anzeigevariante(n) vorhanden
ENDIF.
ENDFORM. " handle_at_selscr_f4_p_layout
*-----------------------------------------------------------------------
start-of-selection.
perform MAIN.
*-----------------------------------------------------------------------
* FORM MAIN
*-----------------------------------------------------------------------
FORM MAIN.
data: lt_DIRECTORY_KEYS TYPE TABLE OF SWNCMONIKEY,
ls_DIRECTORY_KEYS TYPE SWNCMONIKEY,
* lT_DIRECTORY_MONI TYPE TABLE OF SWNCMONIKEYRELID,
" RFC data
lt_rfcclnt TYPE swnc_t_aggrfccli, "wo
ls_rfcclnt TYPE LINE OF swnc_t_aggrfccli,
lt_rfcsrvr TYPE swnc_t_aggrfcsrv, "wq
ls_rfcsrvr TYPE LINE OF swnc_t_aggrfcsrv,
lt_rfcclntdest TYPE swnc_t_aggrfcclid, "wp
ls_rfcclntdest TYPE LINE OF swnc_t_aggrfcclid,
lt_rfcsrvrdest TYPE swnc_t_aggrfcsrvd, "wp
ls_rfcsrvrdest TYPE LINE OF swnc_t_aggrfcsrvd,
" HTTP data
lt_webc TYPE SWNC_T_AGGWEBCLNT,
ls_webc TYPE SWNCAGGWEBCLNT,
lt_webcd TYPE SWNC_T_AGGWEBDEST,
ls_webcd TYPE SWNCAGGWEBDEST,
lt_webs TYPE SWNC_T_AGGWEBCLNT,
ls_webs TYPE SWNCAGGWEBCLNT,
lt_websd TYPE SWNC_T_AGGWEBDEST,
ls_websd TYPE SWNCAGGWEBDEST,
division_factor TYPE SWNCDIVFACTOR value 1000.
* Authorization to show Workload Statistics (see transaction ST03N)
AUTHORITY-CHECK OBJECT 'S_ADMI_FCD'
ID 'S_ADMI_FCD' FIELD 'ST0R'.
IF sy-subrc <> 0.
MESSAGE E150(00) with 'Workload Statistics'(001).
ENDIF.
* Authorization check for retrieving user specific data
AUTHORITY-CHECK OBJECT 'S_TOOLS_EX'
ID 'AUTH' FIELD 'S_TOOLS_EX_A'.
IF sy-subrc <> 0.
* Warning is ok: If you do not have the authorization you will get
* anonymized data only
MESSAGE W008(S03). "authorization missing
ENDIF.
* Read Profile parameter
CALL 'C_SAPGPARAM' ID 'NAME' FIELD 'stat/rfcrec'
ID 'VALUE' FIELD l_stat_rfcrec.
TRANSLATE p_PERIOD TO UPPER CASE.
* Adjust selection
IF p_PERIOD = 'M'.
* Set date to first day of month
p_STRT+6(2) = '01'.
p_ENDT+6(2) = '01'.
ELSEIF p_PERIOD = 'W'.
* Set date to first day of week
DATA: n TYPE i.
n = ( ( sy-datum + 1 - sy-fdayw ) - p_STRT ) MOD 7.
IF n <> 0.
p_STRT = n + p_STRT - 7.
ELSE.
* no change
ENDIF.
n = ( ( sy-datum + 1 - sy-fdayw ) - p_ENDT ) MOD 7.
IF n <> 0.
p_ENDT = n + p_ENDT - 7.
ELSE.
* no change
ENDIF.
ENDIF.
* Prepare include respective exclude selection for S_USER and S_DEST
data: S_USER_SIGN like s_USER-SIGN,
S_DEST_SIGN like s_DEST-SIGN.
clear: S_USER_SIGN, S_DEST_SIGN.
loop at S_USER.
if s_USER-SIGN = 'I'.
if S_USER_SIGN is initial.
S_USER_SIGN = 'I'.
elseif S_USER_SIGN = 'E'.
MESSAGE E150(00) with 'Do not mix positive and negative selections for users'(028).
endif.
elseif s_USER-SIGN = 'E'.
if S_USER_SIGN is initial.
S_USER_SIGN = 'E'.
elseif S_USER_SIGN = 'I'.
MESSAGE E150(00) with 'Do not mix positive and negative selections for users'(028).
endif.
endif.
endloop.
loop at S_DEST.
if s_DEST-SIGN = 'I'.
if S_DEST_SIGN is initial.
S_DEST_SIGN = 'I'.
elseif S_DEST_SIGN = 'E'.
MESSAGE E150(00) with 'Do not mix positive and negative selections for destinations'(029).
endif.
elseif s_DEST-SIGN = 'E'.
if S_DEST_SIGN is initial.
S_DEST_SIGN = 'E'.
elseif S_DEST_SIGN = 'I'.
MESSAGE E150(00) with 'Do not mix positive and negative selections for destinations'(029).
endif.
endif.
endloop.
* Read directory
* GET_DIR_FROM_CLUSTER = ' ' -> DIRECTORY_KEYS
CALL FUNCTION 'SWNC_COLLECTOR_GET_DIRECTORY'
EXPORTING
GET_DIR_FROM_CLUSTER = ' '
* EXCLUDE_SUMMARY = ' '
* STORAGE_TYPE = ' ' " SPACE or 'A'
TABLES
* DIRECTORY_FULL =
* DIRECTORY_SHORT =
DIRECTORY_KEYS = lt_DIRECTORY_KEYS
* DIRECTORY_MONI = lt_DIRECTORY_MONI
EXCEPTIONS
NO_DATA_FOUND = 1
OTHERS = 2.
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
delete lt_DIRECTORY_KEYS
where COMPONENT ne p_COMP
or COMPTYPE ne cl_swnc_collector=>collector_wload " or cl_swnc_collector=>COLLECTOR_ASTAT
or ASSIGNDSYS ne p_SYS
or PERIODTYPE ne p_PERIOD
or PERIODSTRT < p_STRT
or PERIODSTRT > p_ENDT.
** GET_DIR_FROM_CLUSTER = 'X' -> DIRECTORY_MONI
* CALL FUNCTION 'SWNC_COLLECTOR_GET_DIRECTORY'
* EXPORTING
* GET_DIR_FROM_CLUSTER = 'X' " takes longer
** EXCLUDE_SUMMARY = ' '
** STORAGE_TYPE = ' ' " SPACE or 'A'
* TABLES
** DIRECTORY_FULL =
** DIRECTORY_SHORT =
** DIRECTORY_KEYS = lt_DIRECTORY_KEYS
* DIRECTORY_MONI = lt_DIRECTORY_MONI
* EXCEPTIONS
* NO_DATA_FOUND = 1
* OTHERS = 2
* .
* IF SY-SUBRC <> 0.
** MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
** WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
* ENDIF.
* delete lt_DIRECTORY_MONI
* where COMPONENT ne p_COMP
* or COMPTYPE ne cl_swnc_collector=>collector_wload
* or ASSIGNDSYS ne p_SYS
* or PERIODTYPE ne p_PERIOD
* or PERIODSTRT < p_STRT
* or PERIODSTRT > p_ENDT
* or ( RELID ne 'WO'
* and RELID ne 'WP'
* and RELID ne 'WQ'
* and RELID ne 'WR' ).
* Read data
loop at lt_DIRECTORY_KEYS into ls_DIRECTORY_KEYS.
clear gs_result.
gs_result-date = ls_DIRECTORY_KEYS-PERIODSTRT.
* RFC Client
* empty fields: RFC_CALLER, CALLS
* MANDT, ACCOUNT: calling user in RFC client (local system)
* USERID: called user in RFC server
* RFC_CALLER: empty
* RFCUSER: called user in RFC server (as defined in RFC dest. or "<same user>")
if p_CL = 'X'.
gs_result-recordtype = 'CL'.
clear lt_rfcclnt[].
CALL FUNCTION 'SWNC_COLLECTOR_GET_AGGREGATES'
EXPORTING
COMPONENT = ls_DIRECTORY_KEYS-COMPONENT
ASSIGNDSYS = ls_DIRECTORY_KEYS-ASSIGNDSYS
PERIODTYPE = ls_DIRECTORY_KEYS-PERIODTYPE
PERIODSTRT = ls_DIRECTORY_KEYS-PERIODSTRT
* SUMMARY_ONLY = ' '
* STORAGE_TYPE = 'A'
FACTOR = division_factor
TABLES
RFCCLNT = lt_rfcclnt "wo
* RFCCLNTDEST = lt_rfcclntdest "wp
* RFCSRVR = lt_rfcsrvr "wq
* RFCSRVRDEST = lt_rfcsrvrdest "wr
* WEBC = lt_webc " TYPE SWNCAGGWEBCLNT
* WEBCD = lt_webcd " TYPE SWNCAGGWEBDEST
* WEBS = lt_webs " TYPE SWNCAGGWEBCLNT
* WEBSD = lt_websd " TYPE SWNCAGGWEBDEST
EXCEPTIONS
NO_DATA_FOUND = 1
OTHERS = 2.
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
loop at lt_rfcclnt into ls_rfcclnt
where FUNC_NAME in s_FUNC.
if S_USER_SIGN = 'I'.
check ls_rfcclnt-account in s_USER
or ls_rfcclnt-userid in s_USER.
elseif S_USER_SIGN = 'E'.
check ls_rfcclnt-account in s_USER
AND ls_rfcclnt-userid in s_USER.
endif.
if S_DEST_SIGN = 'I'.
check ls_rfcclnt-TARGET in s_DEST
or ls_rfcclnt-LOCAL_DEST in s_DEST
or ls_rfcclnt-REMOT_DEST in s_DEST.
elseif S_DEST_SIGN = 'E'.
check ls_rfcclnt-TARGET in s_DEST
AND ls_rfcclnt-LOCAL_DEST in s_DEST
AND ls_rfcclnt-REMOT_DEST in s_DEST.
endif.
move-CORRESPONDING ls_rfcclnt to gs_result.
PERFORM translate_tasktype using ls_rfcclnt-tasktype.
perform get_function_group
using ls_rfcclnt-FUNC_NAME
changing gs_result-group.
check gs_result-GROUP in s_GROUP.
perform get_user_data
using ls_rfcclnt-mandt ls_rfcclnt-account
changing gs_result-USTYP gs_result-CLASS.
perform get_destination_data
using gs_result-TARGET
changing gs_result-rfcoptions.
append gs_result to gt_result.
endloop.
free lt_rfcclnt.
endif.
" HTTP Client
if p_CLH = 'X'.
gs_result-recordtype = 'CL'.
clear lt_webc[].
CALL FUNCTION 'SWNC_COLLECTOR_GET_AGGREGATES'
EXPORTING
COMPONENT = ls_DIRECTORY_KEYS-COMPONENT
ASSIGNDSYS = ls_DIRECTORY_KEYS-ASSIGNDSYS
PERIODTYPE = ls_DIRECTORY_KEYS-PERIODTYPE
PERIODSTRT = ls_DIRECTORY_KEYS-PERIODSTRT
* SUMMARY_ONLY = ' '
* STORAGE_TYPE = 'A'
FACTOR = division_factor
TABLES
* RFCCLNT = lt_rfcclnt "wo
* RFCCLNTDEST = lt_rfcclntdest "wp
* RFCSRVR = lt_rfcsrvr "wq
* RFCSRVRDEST = lt_rfcsrvrdest "wr
WEBC = lt_webc " TYPE SWNCAGGWEBCLNT
* WEBCD = lt_webcd " TYPE SWNCAGGWEBDEST
* WEBS = lt_webs " TYPE SWNCAGGWEBCLNT
* WEBSD = lt_websd " TYPE SWNCAGGWEBDEST
EXCEPTIONS
NO_DATA_FOUND = 1
OTHERS = 2.
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
loop at lt_webc into ls_webc.
if S_USER_SIGN = 'I'.
check ls_webc-account in s_USER.
elseif S_USER_SIGN = 'E'.
check ls_webc-account in s_USER.
endif.
if S_DEST_SIGN = 'I'.
check ls_webc-DESTINATION in s_DEST.
elseif S_DEST_SIGN = 'E'.
check ls_webc-DESTINATION in s_DEST.
endif.
move-CORRESPONDING ls_webc to gs_result.
gs_result-TARGET = ls_webc-DESTINATION.
gs_result-RECEIVE = ls_webc-DATA_RECEIVE.
gs_result-SEND = ls_webc-DATA_SEND.
gs_result-EXE_TIME = ls_webc-EXECUTION_TI.
gs_result-CALL_TIME = ls_webc-CALLTIME.
PERFORM translate_tasktype using ls_webc-tasktype.
perform translate_protocol USING gs_result-protocol.
perform get_user_data
using ls_webc-mandt ls_webc-account
changing gs_result-USTYP gs_result-CLASS.
perform get_destination_data
using gs_result-TARGET
changing gs_result-rfcoptions.
* if gs_result-protocol is INITIAL.
* if gs_result-rfcoptions-rfcsnc = 'X'.
* gs_result-protocol = 'https'.
* else.
* gs_result-protocol = 'http'.
* endif.
* endif.
* if gs_result-host is INITIAL.
* gs_result-host = gs_result-rfcoptions-rfchost.
* endif.
* if gs_result-port is INITIAL.
* gs_result-port = gs_result-rfcoptions-rfcsysid.
* endif.
* if gs_result-path is INITIAL.
* gs_result-path = gs_result-rfcoptions-PFADPRE.
* endif.
if gs_result-path = '@H3@'. " Don't show this as an icon.
clear gs_result-path.
endif.
append gs_result to gt_result.
endloop.
free lt_webc.
endif.
* RFC Server
* empty fields: CALLS
* MANDT, ACCOUNT: called user in RFC server (local system)
* USERID: called user in RFC server (local system)
* RFC_CALLER: called user in RFC server (local system)
* RFCUSER: empty
if p_SV = 'X'.
gs_result-recordtype = 'SV'.
clear lt_rfcsrvr[].
CALL FUNCTION 'SWNC_COLLECTOR_GET_AGGREGATES'
EXPORTING
COMPONENT = ls_DIRECTORY_KEYS-COMPONENT
ASSIGNDSYS = ls_DIRECTORY_KEYS-ASSIGNDSYS
PERIODTYPE = ls_DIRECTORY_KEYS-PERIODTYPE
PERIODSTRT = ls_DIRECTORY_KEYS-PERIODSTRT
* SUMMARY_ONLY = ' '
* STORAGE_TYPE = 'A'
FACTOR = division_factor
TABLES
* RFCCLNT = lt_rfcclnt "wo
* RFCCLNTDEST = lt_rfcclntdest "wp
RFCSRVR = lt_rfcsrvr "wq
* RFCSRVRDEST = lt_rfcsrvrdest "wr
* WEBC = lt_webc " TYPE SWNCAGGWEBCLNT
* WEBCD = lt_webcd " TYPE SWNCAGGWEBDEST
* WEBS = lt_webs " TYPE SWNCAGGWEBCLNT
* WEBSD = lt_websd " TYPE SWNCAGGWEBDEST
EXCEPTIONS
NO_DATA_FOUND = 1
OTHERS = 2.
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
loop at lt_rfcsrvr into ls_rfcsrvr
where FUNC_NAME in s_FUNC.
if S_USER_SIGN = 'I'.
check ls_rfcsrvr-account in s_USER
or ls_rfcsrvr-userid in s_USER
or ls_rfcsrvr-rfc_caller in s_USER.
elseif S_USER_SIGN = 'E'.
check ls_rfcsrvr-account in s_USER
AND ls_rfcsrvr-userid in s_USER
AND ls_rfcsrvr-rfc_caller in s_USER.
endif.
if S_DEST_SIGN = 'I'.
check ls_rfcsrvr-TARGET in s_DEST
or ls_rfcsrvr-LOCAL_DEST in s_DEST
or ls_rfcsrvr-REMOT_DEST in s_DEST.
elseif S_DEST_SIGN = 'E'.
check ls_rfcsrvr-TARGET in s_DEST
AND ls_rfcsrvr-LOCAL_DEST in s_DEST
AND ls_rfcsrvr-REMOT_DEST in s_DEST.
endif.
move-CORRESPONDING ls_rfcsrvr to gs_result.
clear gs_result-prog_name. "Not useful for RFC Server
PERFORM translate_tasktype using ls_rfcsrvr-tasktype.
perform get_function_group
using ls_rfcsrvr-FUNC_NAME
changing gs_result-group.
check gs_result-GROUP in s_GROUP.
perform get_user_data
using ls_rfcsrvr-mandt ls_rfcsrvr-account
changing gs_result-USTYP gs_result-CLASS.
perform get_authorization
using ls_rfcsrvr-mandt ls_rfcsrvr-account
gs_result-FUNC_NAME gs_result-GROUP
changing gs_result-AUTH_S_RFC
gs_result-AUTH_S_RFCACL.
append gs_result to gt_result.
endloop.
free lt_rfcsrvr.
endif.
" HTTP Server
if p_SVH = 'X'.
gs_result-recordtype = 'SV'.
clear lt_webs[].
CALL FUNCTION 'SWNC_COLLECTOR_GET_AGGREGATES'
EXPORTING
COMPONENT = ls_DIRECTORY_KEYS-COMPONENT
ASSIGNDSYS = ls_DIRECTORY_KEYS-ASSIGNDSYS
PERIODTYPE = ls_DIRECTORY_KEYS-PERIODTYPE
PERIODSTRT = ls_DIRECTORY_KEYS-PERIODSTRT
* SUMMARY_ONLY = ' '
* STORAGE_TYPE = 'A'
FACTOR = division_factor
TABLES
* RFCCLNT = lt_rfcclnt "wo
* RFCCLNTDEST = lt_rfcclntdest "wp
* RFCSRVR = lt_rfcsrvr "wq
* RFCSRVRDEST = lt_rfcsrvrdest "wr
* WEBC = lt_webc " TYPE SWNCAGGWEBCLNT
* WEBCD = lt_webcd " TYPE SWNCAGGWEBDEST
WEBS = lt_webs " TYPE SWNCAGGWEBCLNT
* WEBSD = lt_websd " TYPE SWNCAGGWEBDEST
EXCEPTIONS
NO_DATA_FOUND = 1
OTHERS = 2.
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
loop at lt_webs into ls_webs.
if S_USER_SIGN = 'I'.
check ls_webs-account in s_USER.
elseif S_USER_SIGN = 'E'.
check ls_webs-account in s_USER.
endif.
if S_DEST_SIGN = 'I'.
check ls_webs-DESTINATION in s_DEST.
elseif S_DEST_SIGN = 'E'.
check ls_webs-DESTINATION in s_DEST.
endif.
move-CORRESPONDING ls_webs to gs_result.
gs_result-TARGET = ls_webs-DESTINATION.
gs_result-RECEIVE = ls_webs-DATA_RECEIVE.
gs_result-SEND = ls_webs-DATA_SEND.
gs_result-EXE_TIME = ls_webs-EXECUTION_TI.
gs_result-CALL_TIME = ls_webs-CALLTIME.
PERFORM translate_tasktype using ls_webs-tasktype.
perform translate_protocol USING gs_result-protocol.
perform get_user_data
using ls_webs-mandt ls_webs-account
changing gs_result-USTYP gs_result-CLASS.
if gs_result-path = '@H3@'. " Don't show this as an icon.
clear gs_result-path.
endif.
append gs_result to gt_result.
endloop.
free lt_webs.
endif.
* RFC Client Destinations
* empty fields: RFC_CALLER, PROG_NAME , FUNC_NAME
* MANDT, ACCOUNT: calling user in RFC client (local system)
* USERID: called user in RFC server
* RFC_CALLER: empty
* RFCUSER: called user in RFC server (as defined in RFC dest. or "<same user>")
if p_CLD = 'X'.
gs_result-recordtype = 'CLD'.
CALL FUNCTION 'SWNC_COLLECTOR_GET_AGGREGATES'
EXPORTING
COMPONENT = ls_DIRECTORY_KEYS-COMPONENT
ASSIGNDSYS = ls_DIRECTORY_KEYS-ASSIGNDSYS
PERIODTYPE = ls_DIRECTORY_KEYS-PERIODTYPE
PERIODSTRT = ls_DIRECTORY_KEYS-PERIODSTRT
* SUMMARY_ONLY = ' '
* STORAGE_TYPE = 'A'
FACTOR = division_factor
TABLES
* RFCCLNT = lt_rfcclnt "wo
RFCCLNTDEST = lt_rfcclntdest "wp
* RFCSRVR = lt_rfcsrvr "wq
* RFCSRVRDEST = lt_rfcsrvrdest "wr
* WEBC = lt_webc " TYPE SWNCAGGWEBCLNT
* WEBCD = lt_webcd " TYPE SWNCAGGWEBDEST
* WEBS = lt_webs " TYPE SWNCAGGWEBCLNT
* WEBSD = lt_websd " TYPE SWNCAGGWEBDEST
EXCEPTIONS
NO_DATA_FOUND = 1
OTHERS = 2.
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
clear lt_rfcclntdest[].
ENDIF.
* Add not-used RFC destinations
if p_CLDNU = 'X'.
clear ls_rfcclntdest.
select RFCDEST from RFCDES into ls_rfcclntdest-TARGET
where RFCDEST in s_DEST
and RFCTYPE = '3'.
read table lt_rfcclntdest transporting no fields
with key TARGET = ls_rfcclntdest-TARGET.
if sy-subrc is not initial.
append ls_rfcclntdest to lt_rfcclntdest.
endif.
endselect.
endif.
loop at lt_rfcclntdest into ls_rfcclntdest.
if S_USER_SIGN = 'I'.
check ls_rfcclntdest-account in s_USER
or ls_rfcclntdest-userid in s_USER.
elseif S_USER_SIGN = 'E'.
check ls_rfcclntdest-account in s_USER
AND ls_rfcclntdest-userid in s_USER.
endif.
if S_DEST_SIGN = 'I'.
check ls_rfcclntdest-TARGET in s_DEST
or ls_rfcclntdest-LOCAL_DEST in s_DEST
or ls_rfcclntdest-REMOT_DEST in s_DEST.
elseif S_DEST_SIGN = 'E'.
check ls_rfcclntdest-TARGET in s_DEST
AND ls_rfcclntdest-LOCAL_DEST in s_DEST
AND ls_rfcclntdest-REMOT_DEST in s_DEST.
endif.
move-CORRESPONDING ls_rfcclntdest to gs_result.
PERFORM translate_tasktype using ls_rfcclntdest-tasktype.
perform get_user_data
using ls_rfcclnt-mandt ls_rfcclntdest-account
changing gs_result-USTYP gs_result-CLASS.
perform get_destination_data
using gs_result-TARGET
changing gs_result-rfcoptions.
if ls_rfcclntdest-tasktype = 0 and ls_rfcclntdest-counter = 0.
"if gs_result-rfcoptions-RFCTRUSTID_EXT is initial.
gs_result-tasktype = 'NOT USED'.
"else.
" gs_result-tasktype = 'NOT USED/REQUIRED'.
"endif.
endif.
append gs_result to gt_result.
endloop.
free lt_rfcclnt.
endif.
" HTTP Client destination
if p_CLDH = 'X'.
gs_result-recordtype = 'CLD'.
clear lt_webcd[].
CALL FUNCTION 'SWNC_COLLECTOR_GET_AGGREGATES'
EXPORTING
COMPONENT = ls_DIRECTORY_KEYS-COMPONENT
ASSIGNDSYS = ls_DIRECTORY_KEYS-ASSIGNDSYS
PERIODTYPE = ls_DIRECTORY_KEYS-PERIODTYPE
PERIODSTRT = ls_DIRECTORY_KEYS-PERIODSTRT
* SUMMARY_ONLY = ' '
* STORAGE_TYPE = 'A'
FACTOR = division_factor
TABLES
* RFCCLNT = lt_rfcclnt "wo
* RFCCLNTDEST = lt_rfcclntdest "wp
* RFCSRVR = lt_rfcsrvr "wq
* RFCSRVRDEST = lt_rfcsrvrdest "wr
* WEBC = lt_webc " TYPE SWNCAGGWEBCLNT
WEBCD = lt_webcd " TYPE SWNCAGGWEBDEST
* WEBS = lt_webs " TYPE SWNCAGGWEBCLNT
* WEBSD = lt_websd " TYPE SWNCAGGWEBDEST
EXCEPTIONS
NO_DATA_FOUND = 1
OTHERS = 2.
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.