From 5ed27f9ba634de1fd6f5a9e32863dc3141144566 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=BCnter=20Christian?= Date: Tue, 25 Nov 2025 17:42:32 +0000 Subject: [PATCH] add warning if ICF-nodes are inactive --- src/00/z2ui5_cl_demo_app_s_03.clas.abap | 14 ++++++++++++++ src/00/z2ui5_cl_demo_app_s_05.clas.abap | 13 +++++++++++++ 2 files changed, 27 insertions(+) diff --git a/src/00/z2ui5_cl_demo_app_s_03.clas.abap b/src/00/z2ui5_cl_demo_app_s_03.clas.abap index 436716ff..02cb1e06 100644 --- a/src/00/z2ui5_cl_demo_app_s_03.clas.abap +++ b/src/00/z2ui5_cl_demo_app_s_03.clas.abap @@ -40,6 +40,12 @@ CLASS z2ui5_cl_demo_app_s_03 IMPLEMENTATION. DATA(view) = z2ui5_cl_xml_view=>factory( ). + SELECT + SINGLE FROM icfservloc + FIELDS icfactive + WHERE icf_name = 'MIME_DEMO' + INTO @DATA(icfactive). + " Note, these are demo sounds and are part of the abap2UI5 sample repo. " They are NOT meant to use in production. view->_generic( name = `script` @@ -48,6 +54,14 @@ CLASS z2ui5_cl_demo_app_s_03 IMPLEMENTATION. && |function playError() \{ new Audio("/SAP/PUBLIC/BC/ABAP/mime_demo/z2ui5_demo_error.mp3").play(); \}| ). DATA(vbox) = view->page( title = `Play success and error sounds` )->vbox( class = `sapUiSmallMargin` ). + + IF icfactive = abap_false. + vbox->message_strip( + text = `ICF Service '/SAP/PUBLIC/BC/ABAP/mime_demo' is not active. Sounds will not play. Please activate the ICF service first.` + type = `Warning` + visible = abap_true ). + ENDIF. + vbox->message_strip( text = client->_bind( message-text ) type = client->_bind( message-type ) diff --git a/src/00/z2ui5_cl_demo_app_s_05.clas.abap b/src/00/z2ui5_cl_demo_app_s_05.clas.abap index 5c6de4a6..0e1d51a4 100644 --- a/src/00/z2ui5_cl_demo_app_s_05.clas.abap +++ b/src/00/z2ui5_cl_demo_app_s_05.clas.abap @@ -72,6 +72,12 @@ CLASS z2ui5_cl_demo_app_s_05 IMPLEMENTATION. METHOD z2ui5_on_render. + SELECT + SINGLE FROM icfservloc + FIELDS icfactive + WHERE icf_name = 'Z2UI5_SAMPLE' + INTO @DATA(icfactive). + DATA(view) = z2ui5_cl_xml_view=>factory( ). DATA(page) = view->shell( )->page( @@ -85,6 +91,13 @@ CLASS z2ui5_cl_demo_app_s_05 IMPLEMENTATION. tooltip = `Sample information` press = client->_event( 'CLICK_HINT_ICON' ) ). + IF icfactive = abap_false. + page->message_strip( + text = `ICF Service '/sap/bc/apc/sap/z2ui5_sample' is not active. WebSocket communication will not work. Please activate the ICF Service in transaction SICF.` + type = `Warning` + visible = abap_true ). + ENDIF. + DATA(form) = page->simple_form( editable = abap_true title = `Publish news` class = `sapUiTinyMarginBottom`