Skip to Content

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

 OIFHeader1

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.

b. Create a component controller attribute – GO_FPM which stores the FPM Instance.  OIFHeader2

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( ).

endmethod.

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
    EXPORTING
      i_alias = ‘PAOC_HAP_DOCUMENT_WD_UI/CREATE’
    IMPORTING
      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  ).
    ENDIF.
  ENDIF.

endmethod.

e. To create the FPM based OIF Component and the respective Application and component configurations, you may use the FPM ACT(Application Creation Tool) – OIFHeader3 

 Update the OIF Component configuration with the custom WD Component details linking them to a UIBB.  OIFHeader5 

f. Also ensure that your component is maintained in Global Settings in your OIF Component configuration –  oifheader6

 Test your application to see the Header from the OTR –  

To report this post you need to login first.

4 Comments

You must be Logged on to comment or reply to a post.

  1. Tom Van Doorslaer
    Hi,

    The dynamic solution will definitely offer advantages in some case, where the title can differ depending on the situation.

    If it’s only for translation, than there is also the option to logon to the configuration editor in a different language and simply translate the text there.

    Depending on your logon language, the Configuration editor will create a translation entry.

    This option seems to be less known. (took me some time to figure it out as well)

    cheers,
    Tom

    (0) 
    1. Former Member Post author
      Tom,

      Thanks for pointing other option to perform this Translation activity. I could have mentioned the motive of this blog clearly(i.e. this blog is also written to bring the dynamic header). Though the Blog name implies my motive, but I could have been more clear in it’s introduction…

      So if I have to rephrase the blog introduction,I would do something like this –

      “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.
      There can also be scenarios where the headers should be dynamically populated based on certain conditions.
      You may have to perform the following steps to get the application title dynamically using OTR’s (which are translatable).”

      Regards
      Kuncham

      (0) 
  2. Former Member Post author
    I would like to add the following steps to this blog for bringing the dynamic header in OVP applications also.

    1. Ensure that your Custom WD Component implements the WD Interface – IF_FPM_OVP_CONF_EXIT to get the method – OVERRIDE_EVENT_OVP.
    2. Under this method – OVERRIDE_EVENT_OVP add the following code –

    method OVERRIDE_EVENT_OVP .
      data : lo_ovp type ref to IF_FPM_CNR_OVP,
             lo_fpm TYPE REF TO if_fpm,
             lo_fpm_floorplan TYPE REF TO CX_FPM_FLOORPLAN,
             lv_title TYPE STRING.

      TRY.
    *      Get the FPM instance
          lo_fpm   = cl_fpm_factory=>get_instance( ). “Retrieve handle to FPM

    * Get the OVP CNR API
          lo_ovp  ?= lO_FPM->GET_SERVICE( ‘CNR_OVP’ ).
          IF lo_ovp is BOUND.
            CALL METHOD cl_wd_utilities=>get_otr_text_by_alias
              EXPORTING
                alias      = ‘PAOC_HAP_DOCUMENT_WD_UI/CREATE’
              RECEIVING
                alias_text = lv_title.

            IF lv_title IS NOT INITIAL.
              LO_OVP->CHANGE_CONTENT_AREA_RESTRICTED( EXPORTING IV_CONTENT_AREA_ID = ‘PAGE_1’
                 iv_Title = lv_title ).
            ENDIF.
          ENDIF.
        CATCH CX_FPM_FLOORPLAN INTO LO_FPM_FLOORPLAN.
      ENDTRY.

    endmethod.

    Remaining everything stays the same.

    Regards
    Kuncham

    (0) 
  3. Former Member

    Hi,

    Alternatively, you can use the syntax $OTR: followed by your OTR text alias (as in Web Dynpro ABAP development) directly in the application title input field to make it dynamic. Thus, instead of “hardcoding” the value in your FPM component configuration, just write $OTR:Z… and the corresponding OTR text will be displayed at runtime in the correct language.

    Regards,

    Julien

    (0) 

Leave a Reply