Implement SEARCH GUIBB Using FPM

By Rakesh Dhudipala

Scenario:

This document explains the step by step procedure to create the search results based on the search query using WebDynpro component FPM_SEARCH_UIBB. Using this user can search the results as well as user can save the search for his/her future reference.  

Prerequisite:

Knowledge on Object Oriented ABAP and ABAP WebDynpro.  

Step by step Procedure:  

Go to SE24 and create a class called ZCL_SEARCH_TEST  

 

Go to Interfaces tab and Implement IF_FPM_GUIBB_SEARCH Interface.  

 

Go to public section of the class and declare the type TY_CUST and declare the result gt_result internal table  

TYPES:BEGIN OF TY_CUST,

             KUNNR TYPE KUNNR,

             LAND1 TYPE LAND1,

             NAME1 TYPE NAME1,

             NAME2 TYPE NAME2,

             END OF TY_CUST.

DATA:GS_CUST  TYPE TY_CUST,

           GT_RESULT TYPE TABLE OF TY_CUST  

Go to Attributes tab and declare MO_CATALOG of type CL_ABAP_STRUCTDESCR  

Go to Methods tab and write the below code  

Click on IF_FPM_GUIBB_SEARCH~GET_DEFINITION Method and write down the following code

METHOD IF_FPM_GUIBB_SEARCH~GET_DEFINITION.

  DATA:GT_DATA TYPE TABLE OF TY_CUST.

  DATA:LS_DESC LIKE LINE OF ET_FIELD_DESCRIPTION_ATTR.  

  EO_FIELD_CATALOG_ATTR ?= CL_ABAP_STRUCTDESCR=>DESCRIBE_BY_DATA( GS_CUST ).

  mo_catalog = EO_FIELD_CATALOG_ATTR.

  EO_FIELD_CATALOG_RESULT ?= cl_ABAP_TABLEDESCR=>DESCRIBE_BY_DATA( GT_DATA ).

ENDMETHOD.  

Click on IF_FPM_GUIBB_SEARCH~PROCESS_EVENT Method and write down the following code  

method IF_FPM_GUIBB_SEARCH~PROCESS_EVENT.

  DATA:lt_where TYPE rsds_where_tab.

  DATA:lt_kna1 TYPE TABLE OF kna1,

       ls_kna1 TYPE kna1.

  DATA:ls_result TYPE ty_cust.

  IF io_event->mv_event_id = if_fpm_guibb_search=>fpm_execute_search.

    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          = 'KNA1'

          IO_FIELD_CATALOG       = mo_catalog

        IMPORTING

          ET_ABAP_SELECT_TABLE   = lt_where           .

    CATCH cx_fpmgb.  

    ENDTRY.  

  ENDIF.  

Select * from kna1 into table lt_kna1 up to iv_max_num_results ROWS WHERE (lt_where).  

IF sy-subrc = 0.

  LOOP AT lt_kna1 INTO  ls_kna1.

  MOVE-CORRESPONDING ls_kna1 to ls_result.  

  APPEND ls_result to gt_result.

  ENDLOOP.

ENDIF.

endmethod.

Click here to continue...

Please send us your feedback/suggestions at webmaster@SAPTechnical.COM 

HomeContribute About Us Privacy Terms Of Use • Disclaimer • SafeCompanies: Advertise on SAPTechnical.COM | Post JobContact Us  

Graphic Design by Round the Bend Wizards

footer image footer image