Skip to Content

hi every one in this blog i am going to show you how tabbed guibb works.

SCENARIO :  here tabbed guibb contains four tabs,each tab embeds one interface view of the component.however on the first tab contains the check boxes.

each check box is related to the visibility of the remaining tabs i.e if we click on the first check box TAB2 is visible or if we click on the second check box TAB3 is visible.

PLEASE SEE THE BELOW SCREEN SHOTS:


I USED FPM_OIF_COMPONENT.


WHEN THE COMPONENT LOADED.


/wp-content/uploads/2014/10/18_1_555952.jpg

NOW I ENABLE FIRST CHECK BOX

/wp-content/uploads/2014/10/18_2_555954.jpg

NOW I ENABLES ALL CHECK BOXES ONE BY ONE

/wp-content/uploads/2014/10/18_3_555956.jpg

NOW I DISABLE FOURTH CHECK BOX.

/wp-content/uploads/2014/10/18_4_555957.jpg

SO THIS IS MY REQUIREMENT LET US START.

WEBDYNPRO COMPONENT:  Z_DEMO_OBJECT1


IMPLEMENTED INTERFACES: 


1)IF_FPM_UI_BUILDING_BLOCK: when we add this interface automatically FPM methods (  FLUSH  – to send the data to  Central Data Model,NEEDS_FOR_CONFIRMATION  – to provide the data loss popup if data not saved ,PROCESS_EVENT – to process the fpm events,PROCESS_BEFORE_OUTPUT – to read the data to be displayed ,AFTER_FAILED_EVENT – to handle the failed events  ) are loaded in to the

COMPONENT CONTROLLER.



2) IF_FPM_TABBED_CONF_EXIT :  when we add this interface only OVERRIDE_CONFIG_TABBED method is added which is triggered after every fpm event raised.

                                                           


/wp-content/uploads/2014/10/1_555960.jpg

/wp-content/uploads/2014/10/1_1_555962.jpg

COMPONENT CONTROLLER :

/wp-content/uploads/2014/10/2_555980.jpg

/wp-content/uploads/2014/10/3_555966.jpg

/wp-content/uploads/2014/10/4_555967.jpg

CODE IN ACTIVE_FIRST_TAB:


types:
BEGIN OF ty_s_tab,
variant
TYPE string,
id TYPE string,
name
TYPE string,
END OF ty_s_tab .
types:
ty_t_tab
TYPE STANDARD TABLE OF ty_s_tab .

DATA:LV_VARIANT_ID TYPE STRING,
LT_TAB
TYPE TY_T_TAB,
LS_TAB
LIKE LINE OF LT_TAB.

CALL METHOD WD_THIS->GO_TABBED->GET_CURRENT_VARIANT
RECEIVING
RV_VARIANT_ID
= LV_VARIANT_ID.

TRY.
CALL METHOD WD_THIS->GO_TABBED->GET_TABS
EXPORTING
IV_VARIANT_ID
= LV_VARIANT_ID
IMPORTING
ET_TAB       
= LT_TAB.
CATCH CX_FPM_FLOORPLAN .
ENDTRY.

LOOP AT LT_TAB INTO LS_TAB.
IF SYTABIX GT 1.
CALL METHOD WD_THIS->GO_TABBED->SET_TAB_VISIBLE
EXPORTING
IV_TAB_ID 
= LS_TABID
IV_VISIBLE
= ‘ ‘.
CLEAR LS_TAB.
ENDIF.
ENDLOOP.

CODE IN INITIALIZE_BOX:

  DATA lo_nd_check TYPE REF TO if_wd_context_node.
DATA lo_el_check type ref to if_wd_context_element.
DATA lt_check TYPE wd_this->Elements_check.
DATA ls_check TYPE wd_this->Element_check.
*  navigate from <CONTEXT> to <CHECK> via lead selection
lo_nd_check
= wd_context->get_child_node( name = wd_this->wdctx_check ).

*  @TODO handle non existant child
IF NOT lo_nd_check IS INITIAL.

do 3 times.
lo_el_check
= lo_nd_check->create_element( ).
lo_nd_check
->bind_element( new_item = lo_el_check set_initial_elements = abap_false ).

enddo.

ENDIF.

CODE IN OVERRIDE_CONFIG_TABBED


  DATA lv_VISIBLE TYPE BOOLE_D.
DATA lv_id TYPE string.
DATA lv_name  TYPE string.
CASE io_tabbed->mo_event->mv_event_id.
WHEN ‘FPM_START’.
WD_THIS
->GO_TABBED = IO_TABBED.
wd_this
->active_first_tab(
*    lo_tabbed =                        ” ref to if_fpm_tabbed
).

WHEN ‘ADD_TAB’.
io_tabbed
->mo_event->MO_EVENT_DATA->get_value( EXPORTING iv_key = ‘ID’ IMPORTING ev_value = lv_id ).
io_tabbed
->mo_event->MO_EVENT_DATA->get_value( EXPORTING iv_key = ‘NAME’ IMPORTING ev_value = lv_name ).

CALL METHOD IO_TABBED->SET_TAB_VISIBLE
EXPORTING
IV_TAB_ID 
= LV_ID
IV_VISIBLE
= ‘X’.
WHEN ‘DELETE_TAB’.
io_tabbed
->mo_event->MO_EVENT_DATA->get_value( EXPORTING iv_key = ‘ID’ IMPORTING ev_value = lv_id ).
io_tabbed
->mo_event->MO_EVENT_DATA->get_value( EXPORTING iv_key = ‘NAME’ IMPORTING ev_value = lv_name ).

CALL METHOD IO_TABBED->SET_TAB_VISIBLE
EXPORTING
IV_TAB_ID 
= LV_ID
IV_VISIBLE
= ‘ ‘.

endcase.

CODE IN WDDOINIT :


wd_this->initialize_box( ).

VIEW CONTROLLER:


/wp-content/uploads/2014/10/1_1_555962.jpg

/wp-content/uploads/2014/10/5_1_555981.jpg

/wp-content/uploads/2014/10/5_2_555982.jpg

/wp-content/uploads/2014/10/5_4_555984.jpg

/wp-content/uploads/2014/10/6_555985.jpg

/wp-content/uploads/2014/10/7_555977.jpg

CODE IN ONACTIONON_CHECK_BOX :

types:
BEGIN OF ty_s_tab,
variant
TYPE string,
id TYPE string,
name
TYPE string,
END OF ty_s_tab .
types:
ty_t_tab
TYPE STANDARD TABLE OF ty_s_tab .

DATA:LV_VARIANT_ID TYPE STRING,
LT_TAB
TYPE TY_T_TAB,
LS_TAB
LIKE LINE OF LT_TAB,
LV_INDEX
TYPE I.

CASE ID.
WHEN ‘TABLE_CHECK_BOX_EDITOR’.
DATA: lo_fpm TYPE REF TO if_fpm,
lo_event
TYPE REF TO cl_fpm_event.

CALL METHOD CONTEXT_ELEMENT->GET_INDEX
RECEIVING
MY_INDEX
= LV_INDEX.

DATA lo_nd_check TYPE REF TO if_wd_context_node.

DATA lo_el_check TYPE REF TO if_wd_context_element.
DATA ls_check TYPE wd_this->Element_check.
DATA lv_check_box TYPE wd_this->Element_checkcheck_box.

* navigate from <CONTEXT> to <CHECK> via lead selection
lo_nd_check
= wd_context->get_child_node( name = wd_this->wdctx_check ).

* @TODO handle non existant child
* IF lo_nd_check IS INITIAL.
* ENDIF.

* get element via lead selection
lo_el_check
= lo_nd_check->get_element( index = LV_INDEX ).
* alternative access  via index
* lo_el_check = lo_nd_check->get_element( index = 1 ).
* @TODO handle not set lead selection
IF lo_el_check IS INITIAL.
ENDIF.

* get single attribute
lo_el_check
->get_attribute(
EXPORTING
name
`CHECK_BOX`
IMPORTING
value = lv_check_box ).

CALL METHOD WD_COMP_CONTROLLER->GO_TABBED->GET_CURRENT_VARIANT
RECEIVING
RV_VARIANT_ID
= LV_VARIANT_ID.

TRY.
CALL METHOD WD_COMP_CONTROLLER->GO_TABBED->GET_TABS
EXPORTING
IV_VARIANT_ID
= LV_VARIANT_ID
IMPORTING
ET_TAB       
= LT_TAB.
CATCH CX_FPM_FLOORPLAN .
ENDTRY.

READ TABLE LT_TAB INTO LS_TAB INDEX LV_INDEX + 1.
IF lv_check_box = ‘X’.
lo_fpm
= cl_fpm=>get_instance( ).
lo_event
= cl_fpm_event=>create_by_id( ‘ADD_TAB’ ).
lo_event
->MO_EVENT_DATA->set_value( iv_key  = ‘ID’ IV_VALUE = LS_TABID ).
lo_event
->MO_EVENT_DATA->set_value( iv_key  = ‘NAME’ iv_value = LS_TABNAME ).
lo_fpm
->raise_event( io_event = lo_event ).
ELSEIF lv_check_box = ‘ ‘.
lo_fpm
= cl_fpm=>get_instance( ).
lo_event
= cl_fpm_event=>create_by_id( ‘DELETE_TAB’ ).
lo_event
->MO_EVENT_DATA->set_value( iv_key  = ‘ID’ IV_VALUE = LS_TABID ).
lo_event
->MO_EVENT_DATA->set_value( iv_key  = ‘NAME’ iv_value = LS_TABNAME ).
lo_fpm
->raise_event( io_event = lo_event ).
ENDIF.
ENDCASE.


/wp-content/uploads/2014/10/8_555986.jpg



/wp-content/uploads/2014/10/9_555987.jpg

/wp-content/uploads/2014/10/10_555988.jpg

/wp-content/uploads/2014/10/11_556001.jpg

VIEWS  TAB2_VIEW  ——-> TAB2

              TAB3_VIEW ———>TAB3

              TAB4_VIEW ———>TAB4

FOR APPLICATION CONFIGURATION .

/wp-content/uploads/2014/10/15_556020.jpg


/wp-content/uploads/2014/10/16_556023.jpg/wp-content/uploads/2014/10/17_1_556024.jpg/wp-content/uploads/2014/10/17_2_556022.jpg/wp-content/uploads/2014/10/17_3_556025.jpg



To report this post you need to login first.

Be the first to leave a comment

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

Leave a Reply