In this article we will show how to create OVP FPM in Web Dynpro application, we will use table VBAK and we will use Search UIBB to create the OVP Floorplan application. In this FPM application user can search data from table VBAK and the result will display in table list.

1.Creating Feeder Class

Generic UIBB require feeder class to customize behavior, the feeder class need to implement specific interface depending on the type of UIBB being configured. In this example we will implement the interface IF_FPM_GUIBB_SEARCH.

Create feeder class using transaction SE24. Enter Description of the class and choose Usual ABAP Class in the class type radio button. Go to tab Interface and enter interface name IF_FPM_GUIBB_SEARCH and IF_FPM_GUIBB.

create-search-guibb-fpm-web-dynpro-abap-1

2. Now navigate to the Methods tab and double click each method name to make sure all the methods are implemented, just let the method which we are not used empty.

create-search-guibb-fpm-web-dynpro-abap-2

3.Go to Attributes tab and enter GT_VBAK and GS_VBAK.

create-search-guibb-fpm-web-dynpro-abap-3

Go to public section class and declare internal table GT_VBAK via Direct Type Entry. you can click green arrow to go to Direct Type Entry.

CLASS zcl_demo_fpm DEFINITION
  PUBLIC
  FINAL
  CREATE PUBLIC .

  PUBLIC SECTION.

    INTERFACES if_fpm_guibb .
    INTERFACES if_fpm_guibb_search .

    DATA gs_vbak TYPE vbak .
    DATA gt_vbak TYPE STANDARD TABLE OF vbak.

GT_VBAK attribute internal table that is used to hold data from the search result.

4.Go to method IF_FPM_GUIBB_SEARCH~GET_DEFINITION. you need to enter ABAP Code as you see below, this method create the field catalog that will be used in the UIBB.

 DATA : gw_fields      TYPE dfies,
           gt_fields      TYPE ddfields,
           gs_fields_desc LIKE LINE OF et_field_description_result.

    "Create field catalog
    eo_field_catalog_attr ?= cl_abap_structdescr=>describe_by_data( gs_vbak ).

    "Assigning result field catalog
    eo_field_catalog_result ?= cl_abap_tabledescr=>describe_by_data( gt_vbak ).

    "Assigning field description
    gt_fields = eo_field_catalog_attr->get_ddic_field_list( ).

    LOOP AT gt_fields INTO gw_fields.
      IF gw_fields-fieldname NE 'MANDT'.
        CLEAR gs_fields_desc.

        gs_fields_desc-name = gw_fields-fieldname.
        gs_fields_desc-text = gw_fields-fieldtext.

        APPEND gs_fields_desc TO et_field_description_result.
      ENDIF.
    ENDLOOP.

5.Go to method IF_FPM_GUIBB_SEARCH~PROCESS_EVENT, this method processes the user input and queries the database table based on the search criteria that entered by user.

  DATA : li_where TYPE rsds_where_tab,
           lo_exec  TYPE REF TO cx_fpmgb.

    CHECK io_event->mv_event_id = if_fpm_guibb_search=>fpm_execute_search.

    "Convert search query to sql string

    TRY.
        CALL METHOD cl_fpm_guibb_search_conversion=>to_abap_select_where_tab
          EXPORTING
            it_fpm_search_criteria = it_fpm_search_criteria
            iv_table_name          = 'VBAK'
          IMPORTING
            et_abap_select_table   = li_where.
      CATCH cx_fpmgb INTO lo_exec .  "guibb exception if error occured
    ENDTRY.

    "Select table vbak based where
    SELECT * FROM vbak INTO TABLE gt_vbak
            WHERE (li_where).

6. Write code in the method IF_FPM_GUIBB_SEARCH~GET_DATA. this method return the search result back to the FPM framework.

 ET_RESULT_LIST = gt_vbak.

Ok, that’s the last step, now you already had the feeder class. for the next step we will to show how to create Generic UIBB configuration using feeder class that you’ve just created and we will use OVP floorplan for this ABAP Web Dynpro.

Leave a Reply