Dynamic Header in FPM OIF Application
There would be requirements where your application should be used in more than one language; in such scenarios you just cannot hardcode your application title in the IDR Component configuration. You may have to perform the following steps to get the application title dynamically using OTR’s (which are translatable).
a. Create your WD Component that implements the following interfaces
As addressed in FPM Cookbook, We implemented IF_FPM_OIF_CONF_EXIT interface to get the interface method – OVERRIDE_EVENT_OIF, which passes a handler object of type IF_OIF (respective IF_GAF). This handler object provides the API with information to manipulate the floorplan configuration at runtime.
c. Extract the FPM instance into GO_FPM component controller attribute in the hook method – WDDOINIT :
method WDDOINIT .
* Get FPM Instance
wd_this->go_fpm = cl_fpm_factory=>get_instance( ).
d. Dynamically build the Application title using the method – OVERRIDE_EVENT_OIF as shown below :
method OVERRIDE_EVENT_OIF .
DATA: lo_sotr TYPE REF TO cl_sotr.
DATA: lv_text TYPE STRING.
DATA: lo_idr TYPE REF TO if_fpm_idr.
* Create OTR Instance
CREATE OBJECT lo_sotr.
* Extract the OTR text
CALL METHOD lo_sotr->get_text_by_alias
i_alias = ‘PAOC_HAP_DOCUMENT_WD_UI/CREATE’
e_text = lv_text.
IF lv_text is not INITIAL.
* Get the IDR instance
lo_idr ?= wd_this->go_fpm->GET_SERVICE( cl_fpm_service_manager=>GC_KEY_IDR ).
IF lo_idr IS BOUND.
* Set the application title
lo_idr->SET_APPLICATION_TITLE( EXPORTING IV_TITLE = lv_text
IV_TITLE_TOOLTIP = lv_text ).