implement search guibb using fpm

12
Implement SEARCH GUIBB Using FPM 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. 1

Upload: jolliest

Post on 20-Jan-2016

43 views

Category:

Documents


1 download

DESCRIPTION

Search GUIBBTM

TRANSCRIPT

Page 1: Implement Search Guibb Using Fpm

Implement SEARCH GUIBB Using FPM

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.  

 

1

Page 2: Implement Search Guibb Using Fpm

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  

2

Page 3: Implement Search Guibb Using Fpm

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.

3

Page 4: Implement Search Guibb Using Fpm

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 on IF_FPM_GUIBB_SEARCH~GET_DATA Method and write down the following code.

method IF_FPM_GUIBB_SEARCH~GET_DATA.

et_result_list = gt_result.

Endmethod.  

Go to SE80 and create new WebDynpro component called EX:ZTEST_SEARCH

4

Page 5: Implement Search Guibb Using Fpm

Go to Implemented interfaces re implement the interface IF_FPM_UI_BUILDING_BLOCK

Right click on WebDynpro component and create a WebDynpro application  

5

Page 6: Implement Search Guibb Using Fpm

Go to WebDynpro Application Properties and change the Component name to FPM_OIF_COMPONENT and Interface view to FPM_WINDOW and Activate.  

Right Click on WebDynpro application and click on create configuration  

6

Page 7: Implement Search Guibb Using Fpm

This open the Browser window like below and enter the configuration id as TEST_SEARCH and click on New button and save under local object.  

Select the First row and click on Assign configuration name. It will open the pop up like below. Enter the configuration name as ZTEST_SEARCH1 and save under local object  

7

Page 8: Implement Search Guibb Using Fpm

 

Go to Object instance schema and click on UIBB button. It will create new UIBB element.

Enter the component as FPM_SEARCH_UIBB Window name as SEARCH_WINDOW and Configuration name as ZTEST_SEARCH2.Select the UIBB row and click on Configure UIBB button.  

8

Page 9: Implement Search Guibb Using Fpm

It will open the below pop up screen. Enter the feeder class as ZCL_SEARCH_TEST

 

Click on Search criteria button. It will open the below pop up and select the KUNNR and click ok.

Click on Columns of Result list, it will open the below pop up and click on select all and ok button.

9

Page 10: Implement Search Guibb Using Fpm

Save the entire configuration and test the application.  

 

Enter search criteria like customer contains *Z* and click on search.  

 

See the search results from the Browser.

10

Page 11: Implement Search Guibb Using Fpm

11