Quantcast
Channel: SCN : Blog List - All Communities
Viewing all articles
Browse latest Browse all 2548

How to modify Fiori launchpad tiles in execution time

$
0
0

Fiori is based on roles, but sometimes customize launchpad could be difficult.

 

 

In my case, I need to customize different tiles from different countries. This task is easy and large task using roles. I can make many roles as countries but the result was more than 50 roles.

 

For these reason I modified the standard method in Fiori launchpad to hidden tiles in execution time with some rules.

 

- First of all, we need to create enhancements in class  /UI2/CL_GW_ABSTRACT_DP method EXP_GET_EXPANDED_ENTITY at lasted line:


 

- In previous enhancements we add next lines:


TRY.
 
ASSIGN COMPONENT 'KEY_TAB' OF STRUCTURE IS_REQUEST_DETAILS TO <KEY_TAB>.

*   Add dynamic functionality on tiles
    l_where
= 'NAME = ''id'' AND VALUE = ''/UI2/Fiori2LaunchpadHome'''.
   
LOOP AT <KEY_TAB> ASSIGNING <dummy> WHERE (l_where).
     
EXIT.
   
ENDLOOP.
*   *  Only if launchpad get data modify tiles according to user.
    
IF sy-subrc = 0.
*         Get all groups and start check
        
ASSIGN ER_ENTITY->* TO  <lw_entity>.
        
ASSIGN COMPONENT 'PAGES' OF STRUCTURE <lw_entity> TO <LT_PAGES>.
        
LOOP AT <LT_PAGES> ASSIGNING <LW_PAGES>.
*          Check all pages (groups)
          
ASSIGN COMPONENT 'PAGECHIPINSTANCES' OF STRUCTURE <LW_PAGES> TO <LT_PAGECHIPINSTANCES>.
          
IF sy-subrc <> 0.
            
CONTINUE.
          
ENDIF.

*           For every row check configuration of tile
          
LOOP AT  <LT_PAGECHIPINSTANCES> ASSIGNING <LW_PAGECHIPINSTANCES>.

            
CLEAR: l_hidden, l_url, l_multi_link, l_where.

            
ASSIGN COMPONENT 'PAGE_ID' OF STRUCTURE <LW_PAGECHIPINSTANCES> TO <dummy>.
            
IF sy-subrc = 0.
               l_page_id
= <dummy>.
            
ENDIF.

            
ASSIGN COMPONENT 'USAGE_ID' OF STRUCTURE <LW_PAGECHIPINSTANCES> TO <dummy>.
            
IF sy-subrc = 0.
               l_usage_id
= <dummy>.
            
ENDIF.

            
IF 1)some conditions determine delete TILE.

*               In case off configuration tile mark as hidden, delete entrie from launchpad list
               
CONCATENATE 'PAGE_ID = ''' l_page_id ''' AND  USAGE_ID = ''' l_usage_id '''' INTO l_where.
               
DELETE <LT_PAGECHIPINSTANCES> WHERE (l_where).

 

 


             ELSEIF.
            
ASSIGN COMPONENT 'CHIP' OF STRUCTURE <LW_PAGECHIPINSTANCES> TO <L_CHIP>.
            
IF sy-subrc = 0.
              
ASSIGN COMPONENT 'CONFIG' OF STRUCTURE <L_CHIP> TO <l_CONFIG>.
              
IF sy-subrc = 0.
                    2)Other configurations
              
ENDIF.
            
ENDIF.
            
ENDIF.


          
ENDLOOP.
        
ENDLOOP.

    
ENDIF.
 
CATCH cx_root INTO oref.

ENDTRY.

 

- Two important things in points:


     - 1) Delete tile from configuration table. This tile not appear in launchpad. To identify the tile the variables are equals:

          l_page_id = group ID.

          l_usage_id =Tile instance ID.

2.jpg

 

     - 2) If you want to change the configuration of the tile , we can change this string ( not recommended), this string have this form:

 

*{"tileConfiguration":"{\"display_icon_url\":\"sap-icon://activity-individual\",\"display_info_text\":
*\"\",\"display_title_text\":\"Tile name\",\"display_subtitle_text\":\"\",\"
*navigation_use_semantic_object\":false,\"navigation_target_url\":\"http://www.google.es\",
*\"navigation_semantic_object\":\"\",\"navigation_semantic_action\":\"\",\"navigation_semantic_parameters\
*":\"\",\"display_search_keywords\":\"\"}"}


Viewing all articles
Browse latest Browse all 2548

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>