diff --git a/src/zafl_viewer.prog.abap b/src/zafl_viewer.prog.abap
index a3cea7e..d8244f7 100644
--- a/src/zafl_viewer.prog.abap
+++ b/src/zafl_viewer.prog.abap
@@ -185,11 +185,24 @@ FORM display.
DATA: lr_functions TYPE REF TO cl_salv_functions.
+ IF zcl_afl_utilities=>get_distinct_count( tab_data = gt_log field_name = 'FNAME' ) = 1.
+ SELECT SINGLE cust_name1, cust_name2, cust_name3 FROM zafl_config
+ INTO @DATA(config).
+ ENDIF.
+
+ IF config IS INITIAL.
+ config = VALUE #(
+ cust_name1 = 'CUST_FIELD1'
+ cust_name2 = 'CUST_FIELD2'
+ cust_name3 = 'CUST_FIELD3'
+ ).
+ ENDIF.
+
PERFORM set_column USING '' lr_cols 'GUID' 'GUID' .
PERFORM set_column USING 'X' lr_cols 'FNAME' 'Function Module' .
- PERFORM set_column USING '' lr_cols 'CUST_FIELD1' 'CUST_FIELD1' .
- PERFORM set_column USING '' lr_cols 'CUST_FIELD2' 'CUST_FIELD2' .
- PERFORM set_column USING '' lr_cols 'CUST_FIELD3' 'CUST_FIELD3' .
+ PERFORM set_column USING '' lr_cols 'CUST_FIELD1' config-cust_name1.
+ PERFORM set_column USING '' lr_cols 'CUST_FIELD2' config-cust_name2.
+ PERFORM set_column USING '' lr_cols 'CUST_FIELD3' config-cust_name3.
PERFORM set_column USING '' lr_cols 'STATUS' 'Status Code' .
PERFORM set_column USING '' lr_cols 'TIMESTAMP' 'Timestamp' .
PERFORM set_column USING '' lr_cols 'TIME_COST' 'Time Cost' .
@@ -201,12 +214,10 @@ FORM display.
PERFORM set_column USING 'X' lr_cols 'TABLE_OUT' 'Tables Out' .
-
DATA(lr_events) = gr_alv->get_event( ).
-*... §6.1 register to the event USER_COMMAND
+
SET HANDLER gr_events->on_user_command FOR lr_events.
-*... §6.3 register to the event LINK_CLICK
SET HANDLER gr_events->on_link_click FOR lr_events.
@@ -217,10 +228,10 @@ ENDFORM.
FORM set_column USING i_hotspot TYPE xfeld
pr_cols TYPE REF TO cl_salv_columns
VALUE(fname)
- VALUE(text).
+ VALUE(text).
DATA: lr_column TYPE REF TO cl_salv_column_table.
-* Change the properties of the Columns KUNNR
+
TRY.
lr_column ?= pr_cols->get_column( fname ).
lr_column->set_long_text( CONV #( text ) ).
diff --git a/src/zafl_viewer.prog.xml b/src/zafl_viewer.prog.xml
index 0b4636b..94fd2e8 100644
--- a/src/zafl_viewer.prog.xml
+++ b/src/zafl_viewer.prog.xml
@@ -1940,6 +1940,35 @@
时间
14
+ -
+ I
+ T02
+ 开始日期
+ 20
+
+ -
+ I
+ T03
+ 结束日期
+ 18
+
+ -
+ I
+ T04
+ 开始时间
+ 20
+
+ -
+ I
+ T05
+ 结束时间
+ 18
+
+ -
+ R
+ ABAP FM Log Viewer
+ 70
+
-
S
P_DEND
@@ -1964,6 +1993,42 @@
开始时间
38
+ -
+ S
+ S_CF1
+ Custom Field1
+ 38
+
+ -
+ S
+ S_CF2
+ Custom Field2
+ 38
+
+ -
+ S
+ S_CF3
+ Custom Field3
+ 38
+
+ -
+ S
+ S_FM
+ 函数模块
+ 38
+
+ -
+ S
+ S_GUID
+ GUID
+ 38
+
+ -
+ S
+ S_STATUS
+ 状态
+ 38
+
diff --git a/src/zcl_afl_utilities.clas.abap b/src/zcl_afl_utilities.clas.abap
index 1817563..d2bdf64 100644
--- a/src/zcl_afl_utilities.clas.abap
+++ b/src/zcl_afl_utilities.clas.abap
@@ -1,16 +1,22 @@
-CLASS zcl_afl_utilities DEFINITION
- PUBLIC
- FINAL
- CREATE PUBLIC .
-
- PUBLIC SECTION.
-
- CLASS-METHODS re_process
- IMPORTING
- !guid TYPE guid .
- CLASS-METHODS is_prd
- RETURNING VALUE(result) TYPE abap_bool.
-
+class ZCL_AFL_UTILITIES definition
+ public
+ final
+ create public .
+
+public section.
+
+ class-methods RE_PROCESS
+ importing
+ !GUID type GUID .
+ class-methods IS_PRD
+ returning
+ value(RESULT) type ABAP_BOOL .
+ class-methods GET_DISTINCT_COUNT
+ importing
+ !TAB_DATA type ANY TABLE
+ !FIELD_NAME type CLIKE
+ returning
+ value(COUNT) type INT4 .
PROTECTED SECTION.
PRIVATE SECTION.
ENDCLASS.
@@ -20,6 +26,29 @@ ENDCLASS.
CLASS ZCL_AFL_UTILITIES IMPLEMENTATION.
+ METHOD get_distinct_count.
+
+ TYPES: BEGIN OF ty_temp,
+ field TYPE string,
+ END OF ty_temp.
+ DATA: count_table TYPE HASHED TABLE OF ty_temp WITH UNIQUE KEY field,
+ count_wa LIKE LINE OF count_table.
+
+ LOOP AT tab_data ASSIGNING FIELD-SYMBOL().
+ ASSIGN COMPONENT field_name OF STRUCTURE TO FIELD-SYMBOL().
+ IF sy-subrc <> 0.
+ RETURN.
+ ELSE.
+ count_wa-field = .
+ INSERT count_wa INTO TABLE count_table.
+ ENDIF.
+ ENDLOOP.
+
+ count = lines( count_table ).
+
+ ENDMETHOD.
+
+
METHOD is_prd.
DATA: role TYPE t000-cccategory.
diff --git a/src/zcl_afl_utilities.clas.testclasses.abap b/src/zcl_afl_utilities.clas.testclasses.abap
new file mode 100644
index 0000000..9b62fc0
--- /dev/null
+++ b/src/zcl_afl_utilities.clas.testclasses.abap
@@ -0,0 +1,73 @@
+*"* use this source file for your ABAP unit test classes
+CLASS ltc_get_distinct_count DEFINITION FINAL FOR TESTING
+DURATION SHORT RISK LEVEL HARMLESS.
+ PRIVATE SECTION.
+ METHODS: setup.
+ METHODS: empty_input FOR TESTING.
+ METHODS: general_input FOR TESTING.
+ METHODS: error_input FOR TESTING.
+ENDCLASS.
+
+CLASS ltc_get_distinct_count IMPLEMENTATION.
+
+ METHOD setup.
+
+ ENDMETHOD.
+ METHOD empty_input.
+
+ DATA: test_table TYPE STANDARD TABLE OF sflight.
+
+ DATA(count) = zcl_afl_utilities=>get_distinct_count( tab_data = test_table field_name = 'CARRID' ).
+ cl_abap_unit_assert=>assert_equals(
+ act = count
+ exp = 0
+ msg = |exp: 0, act:{ count }|
+ ).
+
+ ENDMETHOD.
+ METHOD general_input.
+
+ DATA: test_table TYPE STANDARD TABLE OF sflight.
+
+ test_table = VALUE #(
+ ( seatsmax = '1' )
+ ( seatsmax = '55332' )
+ ( seatsmax = '3' )
+ ( seatsmax = '4' )
+ ( seatsmax = '5' )
+ ( seatsmax = '6' )
+ ( seatsmax = '7' )
+ ( seatsmax = '8' )
+ ( seatsmax = '9' )
+ ( seatsmax = '5' )
+ ( seatsmax = '5' )
+ ( seatsmax = '2' )
+ ( seatsmax = '5' )
+ ( seatsmax = '1' )
+ ( seatsmax = '9' )
+ ( seatsmax = '9' )
+ ( seatsmax = '6' )
+ ).
+
+ DATA(count) = zcl_afl_utilities=>get_distinct_count( tab_data = test_table field_name = 'SEATSMAX' ).
+ cl_abap_unit_assert=>assert_equals(
+ act = count
+ exp = 10
+ msg = |exp: 10, act:{ count }|
+ ).
+
+ ENDMETHOD.
+ METHOD error_input.
+
+ DATA: test_table TYPE STANDARD TABLE OF sflight.
+
+ DATA(count) = zcl_afl_utilities=>get_distinct_count( tab_data = test_table field_name = 'XCARRID' ).
+ cl_abap_unit_assert=>assert_equals(
+ act = count
+ exp = 0
+ msg = |exp: 0, act:{ count }|
+ ).
+
+ ENDMETHOD.
+
+ENDCLASS.
diff --git a/src/zcl_afl_utilities.clas.xml b/src/zcl_afl_utilities.clas.xml
index 012d496..2b3add3 100644
--- a/src/zcl_afl_utilities.clas.xml
+++ b/src/zcl_afl_utilities.clas.xml
@@ -10,6 +10,7 @@
X
X
X
+ X