@@ -16,4 +16,102 @@ Integrate your abap2UI5 apps into SAP Fiori Launchpads. Find all information her
1616* Action: display
1717* URL: /sap/bc/ui5_ui5/sap/z2ui5
1818* ID: z2ui5
19- * Parameter: app_start / Z2UI5_CL_MY_APP
19+ * Parameter: app_start / Z2UI5_CL_MY_APP
20+
21+
22+
23+ ### Launchpad KPIs
24+
25+ <i class =" fa-brands fa-github " ></i > [ Repository] ( https://github.com/abap2UI5-addons/launchpad-kpi )
26+
27+ Find more information in the blog article on [ LinkedIn.] ( https://www.linkedin.com/pulse/abap2ui5-host-your-apps-sap-fiori-launchpad-33-kpis-abap2ui5-uuxxe/ )
28+
29+ ##### Key Features
30+ * KPI Connector: Send KPIs of your abap2UI5 Apps to SAP Fiori Launchpad
31+ * User-Friendly: Implement just a single interface and method to return the KPI value
32+ * Project Consistency: Easily integrable with your abap2UI5 apps
33+ * Compatibility: Runs with SAP Netweaver (v.7.30 or higher) or S/4 Private (Standard ABAP)
34+
35+ ##### Functionality
36+ <img width =" 800 " alt =" image " src =" https://github.com/abap2UI5/abap2UI5-connector_launchpad_kpi/assets/102328295/c7db9e46-6876-40d8-a632-be79e2fbcb91 " >
37+ <br >
38+
39+ ##### Preview
40+ <img width =" 621 " alt =" Pasted Graphic 3 " src =" https://github.com/abap2UI5/abap2UI5-connector_launchpad_kpi/assets/102328295/1b24c31e-5570-4324-92d0-5db915394ceb " ><br >
41+
42+ ##### Approach
43+ (1/4) Use a single Interface:
44+ ``` abap
45+ INTERFACE z2ui5_if_lp_kpi
46+ PUBLIC.
47+
48+ METHODS count
49+ IMPORTING
50+ filter TYPE string
51+ RETURNING
52+ VALUE(result) TYPE i.
53+
54+ ENDINTERFACE.
55+ ```
56+ (2/4) Which can be used on app level to return KPIs:
57+ ``` abap
58+ CLASS z2ui5_cl_lp_kpi_hello_world DEFINITION
59+ PUBLIC
60+ FINAL
61+ CREATE PUBLIC .
62+
63+ PUBLIC SECTION.
64+ INTERFACES z2ui5_if_proxy_kpi.
65+ INTERFACES z2ui5_if_app.
66+
67+ ENDCLASS.
68+
69+ CLASS z2ui5_cl_proxy_kpi_hello_world IMPLEMENTATION.
70+
71+ METHOD z2ui5_if_lp_kpi~count.
72+ "kpi calculation....
73+ result = 10.
74+ ENDMETHOD.
75+
76+ METHOD z2ui5_if_app~main.
77+ "abap2UI5 app logic here...
78+ ENDMETHOD.
79+
80+ ENDCLASS.
81+ ```
82+ (3/4) A generic OData service takes care of everything else (which just returns n dummy entries):
83+ ``` abap
84+ METHOD /iwbep/if_mgw_appl_srv_runtime~get_entityset.
85+
86+ DATA lt_result TYPE zcl_z2ui5_proxy_kpi_mpc=>tt_entity.
87+ DATA(lt_filter_cond) = io_tech_request_context->get_filter( )->get_filter_select_options( ).
88+
89+ TRY.
90+ DATA(lv_classname) = to_upper( lt_filter_cond[ property = `CLASS` ]-select_options[ 1 ]-low ).
91+ CATCH cx_root.
92+ INSERT VALUE #( id = `ERROR_NO_PARAMETER_FOUND_WITH_NAME_CLASS` ) INTO TABLE lt_result.
93+ copy_data_to_ref( EXPORTING is_data = lt_result CHANGING cr_data = er_entityset ).
94+ RETURN.
95+ ENDTRY.
96+
97+ TRY.
98+ DATA(lv_filter) = to_upper( lt_filter_cond[ property = `FILTER` ]-select_options[ 1 ]-low ).
99+ CATCH cx_root.
100+ ENDTRY.
101+
102+ DATA li_lp_kpi TYPE REF TO z2ui5_if_lp_kpi.
103+ CREATE OBJECT li_lp_kpi TYPE (lv_classname).
104+ DATA(lv_count) = li_lp_kpi->count( lv_filter ).
105+
106+ DO lv_count TIMES.
107+ INSERT VALUE #( id = sy-index ) INTO TABLE lt_result.
108+ ENDDO.
109+
110+ copy_data_to_ref( EXPORTING is_data = lt_result CHANGING cr_data = er_entityset ).
111+
112+ ENDMETHOD.
113+ ```
114+ (4/4) Maintain the KPI at the Launchpad with the following endpoint:
115+ ```
116+ .../sap/opu/odata/sap/Z2UI5_PROXY_KPI_SRV/ENTITYCollection/$count?$filter=CLASS eq 'z2ui5_cl_proxy_kpi_hello_world'
117+ ```
0 commit comments