cancel
Showing results for 
Search instead for 
Did you mean: 

How to change button position dynamically in fpm

Former Member
0 Kudos

Hi Guys,

  

            this is siva i am developed a toolbar button(button choice) dynamically but i want to change my button position in  fpm toolbar  can you please send me the fast reply  regarding this .

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

you have to implement the method OVERRIDE_EVENT_OVP from the Comp-InterfaceIF_FPM_OVP_CONF_EXIT.

Here you get the FPM OVP-Object:

With this object you can change all UI-Elements of the OVP.

Coding-Exampel:

SET_BUTTON_POSITION

METHOD SET_BUTTON_POSITION . 

  1.    DATA: 
  2.        LT_TOOLBAR_OVP_BUTTON TYPE IF_FPM_OVP=>TY_T_TOOLBAR_BUTTON, 
  3.        LS_TOOLBAR_OVP_BUTTON TYPE IF_FPM_OVP=>TY_S_TOOLBAR_BUTTON, 
  4.        LS_CONTENT_AREA       TYPE IF_FPM_OVP=>TY_S_CONTENT_AREA, 
  5.        LT_TOOLBAR_OVP        TYPE IF_FPM_OVP=>TY_T_TOOLBAR_ELEMENT, 
  6.        LS_TOOLBAR_OVP        TYPE IF_FPM_OVP=>TY_S_TOOLBAR_ELEMENT,
  7.        LV_BUTTON_POSITION   TYPE  I,
  8.        LV_BUTTON_ENABLE      TYPE BOOLEAN.

  9.    IF <condition> = abap_true. 
  10.      LV_BUTTON_ENABLE = ABAP_FALSE
  11.    ELSE. 
  12.      LV_BUTTON_ENABLE = ABAP_TRUE
  13.    ENDIF. 
  14.    IF IO_OVP IS BOUND. 
  15.      TRY . 
  16. *           Get next content area 
  17.          LS_CONTENT_AREA = IO_OVP->GET_CURRENT_CONTENT_AREA( ). 
  18.          IO_OVP->GET_TOOLBAR_ELEMENTS( 
  19.            EXPORTING 
  20.              IV_CONTENT_AREA           = LS_CONTENT_AREA-ID 
  21.            IMPORTING 
  22.              ET_TOOLBAR_ELEMENT        = LT_TOOLBAR_OVP ). 
  23.        CATCH CX_FPM_FLOORPLAN.    " Floorplan exceptions 
  24.      ENDTRY. 
  25.      IF NOT LT_TOOLBAR_OVP[] IS INITIAL. 
  26.        LOOP AT LT_TOOLBAR_OVP INTO LS_TOOLBAR_OVP. 
  27.          TRY. 
  28.              IF LS_TOOLBAR_OVP-TYPE = IF_FPM_CONSTANTS=>GC_TOOLBAR_ELEMENT_TYPE-BUTTON. 
  29.                IO_OVP->GET_TOOLBAR_BUTTON( 
  30.                  EXPORTING 
  31.                    IV_CONTENT_AREA           = LS_CONTENT_AREA-ID 
  32.                    IV_TOOLBAR_ELEMENT_ID     = LS_TOOLBAR_OVP-ELEMENT_ID 
  33.                  IMPORTING 
  34.                    ES_TOOLBAR_BUTTON         = LS_TOOLBAR_OVP_BUTTON ). 
  35.              ENDIF. 
  36.            CATCH CX_FPM_FLOORPLAN.    " Floorplan exceptions 
  37.          ENDTRY. 
  38.          LS_TOOLBAR_OVP_BUTTON-INDEX = LV_BUTTON_POSITION
  39.          IF  LS_TOOLBAR_OVP-ELEMENT_ID = '<Element_ID>'
  40.            TRY . 
  41.                IO_OVP->CHANGE_TOOLBAR_BUTTON( 
  42.                                 EXPORTING 
  43.                                   IS_TOOLBAR_BUTTON           = LS_TOOLBAR_OVP_BUTTON 
  44.                               ). 
  45.              CATCH CX_FPM_FLOORPLAN.    " . 
  46.            ENDTRY. 
  47.          ENDIF. 
  48.        ENDLOOP. 
  49.      ENDIF. 
  50.    ENDIF. 
  51. ENDMETHOD. 

In the same way you can set the buttons position or other properties.

  1. ls_toolbar_ovp_button-INDEX = LV_BUTTON_POSITION.

Regards
Shkelqim

Former Member
0 Kudos

Hi Shkelqim Turkaj  thnx for giving reply,



but my requirement in fpm_oif_component ,  i am created a button dynamically using interface 'if_fpm_cnr_oif'

its working also i wan to change button possition in fpm ,buton name is logout(button choice) it want to  change tright side position on toolbar can you please give  me the other way shkelqim.its ugent bro please.

Former Member
0 Kudos

Hi,


you can change the attributes with the interface method DEFINE_BUTTON.

Step 1 - Get MR_CNR_OIF reference:

COMPONENTCONTROLLER->WDDINIT


DATA: lo_fpm TYPE REF TO if_fpm.

   wd_this->mr_fpm  = cl_fpm_factory=>get_instance( ).

   wd_this->mr_cnr_oif ?= wd_this->mr_fpm
    ->get_service( if_fpm_constants=>gc_service_key-cnr_oif ).

Step 2 - Call method define_button:


CALL METHOD wd_this->mr_cnr_oif->define_button

         EXPORTING

           iv_variant_id = ....

           iv_function   = 'LOGOUT'

           iv_sequence_id = LV_POSITION' "Only relevant for non-standard buttons

           iv_element_id = '*LOGOUT*'

           iv_enabled    = abap_true

           iv_visibility = '01'. "invisible.

You find a lot of examples in the WD Component FPM_TEST_DYNAMIC_CNR_OIF (see picture).

Former Member
0 Kudos

thank you so much  for reply  shkelqim,

my button is define button choice  method .

DATA:LO_FPM TYPE REF TO IF_FPM.

   LO_FPM = CL_FPM_FACTORY=>GET_INSTANCE( ).

   WD_THIS->CNR_OIF ?=

                 LO_FPM->GET_SERVICE( IF_FPM_CONSTANTS=>GC_SERVICE_KEY-CNR_OIF ).

**dynamic creation of Sales person buttonn choice

   DATA: LT_MENU_ACTION_ITEMS TYPE IF_FPM_CNR_OIF=>T_MENU_ACTION_ITEMS,

         LS_MENU_ACTION_ITEMS LIKE LINE OF LT_MENU_ACTION_ITEMS.

   LS_MENU_ACTION_ITEMS-TEXT = 'Log Out'.

*  LS_MENU_ACTION_ITEMS-action_type = 'FPM_BACK_TO_MAIN'.

   LS_MENU_ACTION_ITEMS-ON_ACTION = 'FPM_BACK_TO_MAIN'.

   LS_MENU_ACTION_ITEMS-ENABLED = ABAP_TRUE.

   APPEND  LS_MENU_ACTION_ITEMS TO LT_MENU_ACTION_ITEMS.

   LS_MENU_ACTION_ITEMS-TEXT = 'Change Password'.

   LS_MENU_ACTION_ITEMS-ON_ACTION = 'Forget_Paw_action'.

   LS_MENU_ACTION_ITEMS-ENABLED = ABAP_TRUE.

   APPEND  LS_MENU_ACTION_ITEMS TO LT_MENU_ACTION_ITEMS.

*Get Salesperson Name

   DATA LO_ND_USERDET TYPE REF TO IF_WD_CONTEXT_NODE.

   DATA LO_EL_USERDET TYPE REF TO IF_WD_CONTEXT_ELEMENT.

   DATA LS_USERDET TYPE WD_THIS->ELEMENT_USERDET.

   DATA LV_SPNAME TYPE WD_THIS->ELEMENT_USERDET-SPNAME.

* navigate from <CONTEXT> to <USERDET> via lead selection

   LO_ND_USERDET = WD_CONTEXT->GET_CHILD_NODE( NAME = WD_THIS->WDCTX_USERDET ).

* @TODO handle non existant child

* IF lo_nd_userdet IS INITIAL.

* ENDIF.

* get element via lead selection

   LO_EL_USERDET = LO_ND_USERDET->GET_ELEMENT( ).

* @TODO handle not set lead selection

   IF LO_EL_USERDET IS INITIAL.

   ENDIF.

* get single attribute

   LO_EL_USERDET->GET_ATTRIBUTE(

     EXPORTING

       NAME `SPNAME`

     IMPORTING

       VALUE = LV_SPNAME ).





   CALL METHOD WD_THIS->CNR_OIF->DEFINE_BUTTON_CHOICE

     EXPORTING

       IV_VARIANT_ID        = 'VARIANT_1'

       IV_FUNCTION          = 'OTHER_FUNCTIONS'

      *IV_ELEMENT_ID        = 'test'

       *IV_SEQUENCE_ID       =

       IV_ENABLED           = ABAP_TRUE

       IV_TEXT              = LV_SPNAME

       IV_TOOLTIP           = 'LOG OUT'

       IV_VISIBILITY        = CL_WD_BUTTON=>E_VISIBLE-VISIBLE

       IT_MENU_ACTION_ITEMS = LT_MENU_ACTION_ITEMS.

*    IV_SCREEN                 =

*    IV_REPEAT_SELECTED_ACTION =

   .

how can i change this define button  choice position.

please give me fast reply  it urgent bro

Former Member
0 Kudos

Hi Bro,

here  toolbar is standard  buttons is dynamically created that button in left side  i want move that button choice into right side. that is my requirement  in that button  two actions is thee one i logout and another one is  change password all functionality is working but  wan to chage button position

please give me reply guys. its urgent.

Answers (0)