Skip to content
NextLytics
Megamenü_2023_Über-uns

Shaping Business Intelligence

Whether clever add-on products for SAP BI, development of meaningful dashboards or implementation of AI-based applications - we shape the future of Business Intelligence together with you. 

Megamenü_2023_Über-uns_1

About us

As a partner with deep process know-how, knowledge of the latest SAP technologies as well as high social competence and many years of project experience, we shape the future of Business Intelligence in your company too.

Megamenü_2023_Methodik

Our Methodology

The mixture of classic waterfall model and agile methodology guarantees our projects a high level of efficiency and satisfaction on both sides. Learn more about our project approach.

Products
Megamenü_2023_NextTables

NextTables

Edit data in SAP BW out of the box: NextTables makes editing tables easier, faster and more intuitive, whether you use SAP BW on HANA, SAP S/4HANA or SAP BW 4/HANA.

Megamenü_2023_Connector

NextLytics Connectors

The increasing automation of processes requires the connectivity of IT systems. NextLytics Connectors allow you to connect your SAP ecosystem with various open-source technologies.

IT-Services
Megamenü_2023_Data-Science

Data Science & Engineering

Ready for the future? As a strong partner, we will support you in the design, implementation and optimization of your AI application.

Megamenü_2023_Planning

SAP Planning

We design new planning applications using SAP BPC Embedded, IP or SAC Planning which create added value for your company.

Megamenü_2023_Dashboarding

Dashboarding

We help you with our expertise to create meaningful dashboards based on Tableau, Power BI, SAP Analytics Cloud or SAP Lumira. 

Megamenü_2023_Data-Warehouse-1

SAP Data Warehouse

Are you planning a migration to SAP HANA? We show you the challenges and which advantages a migration provides.

Business Analytics
Megamenü_2023_Procurement

Procurement Analytics

Transparent and valid figures are important, especially in companies with a decentralized structure. SAP Procurement Analytics allows you to evaluate SAP ERP data in SAP BI.

Megamenü_2023_Reporting

SAP HR Reporting & Analytics

With our standard model for reporting from SAP HCM with SAP BW, you accelerate business activities and make data from various systems available centrally and validly.

Megamenü_2023_Dataquality

Data Quality Management

In times of Big Data and IoT, maintaining high data quality is of the utmost importance. With our Data Quality Management (DQM) solution, you always keep the overview.

Career
Megamenü_2023_Karriere-2b

Working at NextLytics

If you would like to work with pleasure and don't want to miss out on your professional and personal development, we are the right choice for you!

Megamenü_2023_Karriere-1

Senior

Time for a change? Take your next professional step and work with us to shape innovation and growth in an exciting business environment!

Megamenü_2023_Karriere-5

Junior

Enough of grey theory - time to get to know the colourful reality! Start your working life with us and enjoy your work with interesting projects.

Megamenü_2023_Karriere-4-1

Students

You don't just want to study theory, but also want to experience it in practice? Check out theory and practice with us and experience where the differences are made.

Megamenü_2023_Karriere-3

Jobs

You can find all open vacancies here. Look around and submit your application - we look forward to it! If there is no matching position, please send us your unsolicited application.

Blog
NextLytics Newsletter Teaser
Sign up now for our monthly newsletter!
Sign up for newsletter
 

Search BAdI - Do Search Method Explained

◀ Back to Knowledge Base

In this exit you can implement your own search including formatting the results for display to the end user.

Our Search BAdI blog series in overview

  1. How to Implement a Search BAdI - general overview
  2. Search BAdI - Meta Method Explained
  3. Search BAdI - Do Search Method Explained
 

Filter

The filter contains the search type and the search name. For example, if the search is executed on an InfoObject, the search name is the name of the InfoObject.

Do search method explained 1

The table or DSO is not part of the filter. It means the BAdI is executed across all DSOs or tables which contain the same InfoObject. This way, you don’t have to implement a BAdI multiple times for different DSOs.

If you want to implement different searches for DSOs, which contain the same InfoObject, you can implement a new referenced InfoObject (so that the master data is reused). You can also use the Table Maintenance Meta BAdI to overwrite the settings done in the Search Meta BAdI.

Parameters

This exit is implemented in BADI /NLY/BADI_SEARCH / via interface /NLY/IF_BADI_SEARCH, method DO_SEARCH_EXIT and contains the following parameters.

Property

Type

Description

Possible Values

I_STYPE

CHAR 6

Search Type (originally used)

DDIC    Search based on table and field in Data Dictionary

IOBJ    InfoObject

CUSTOM    Custom

I_SEARCHNAME

CHAR 60

Search Name (originally used)

For example, name of the InfoObject, if Search Type IOBJ is used

I_SEARCH_TERM

STRING

Search Term

 

E_IS_IMPLEMENTED

BOOLEAN

Set as customer exit implemented, skips standard search logic

X true

E_T_SEARCH_RESULT

Table

Search Result

see next table

 

E_T_SEARCH_RESULT Explained

The table E_T_SEARCH_RESULT contains the search results and has the following parameters:

Property

Type

Description

Possible Values

CAT

CHAR 60

Category

Not used, obsolete

CAT_URL

STRING

Category URL

Not used, obsolete

CAT_IMG

STRING

Category Image

Not used, obsolete

TITLE_DESC

CHAR 250

Title Description

 

TITLE_URL

STRING

Title URL

Not used, obsolete

TITLE_KEY

CHAR 60

Title Key

 

SUB_TITLE

CHAR 250

Subtitle

 

CONTENT

STRING

Context

 

ACTION_TITLE

CHAR 40

Button description

Not used, obsolete

ACTION_URL

STRING

Action URL

Not used, obsolete

ACTION_IMG

STRING

Action Image

Not used, obsolete

ACTION_ICON

STRING

Action Icon

Not used, obsolete

ACTION_FUNC

STRING

Action Function

Not used, obsolete

SCORE

DEC 5,2

Search Score

 

 

Code Snippet

In the example below, we utilize a custom implementation for fuzzy search of employees. This tutorial shows the implementation step by step.

METHOD /nly/if_search~do_search_exit.

TYPES:
BEGIN OF ts_changes,
score TYPE decfloat34,
pernr TYPE /b787/oipernr,
nachn TYPE c LENGTH 40,
vorna TYPE c LENGTH 40,
pstlz TYPE c LENGTH 10,
stras TYPE c LENGTH 60,
ort01 TYPE c LENGTH 40,
emplstatus_txtmd TYPE c LENGTH 40,
bukrs TYPE c LENGTH 10,
bukrs_txtmd TYPE c LENGTH 40,
kostl TYPE c LENGTH 10,
kostl_txtmd TYPE c LENGTH 40,
orgeh TYPE c LENGTH 10,
orgid_txtmd TYPE c LENGTH 40,
plans TYPE c LENGTH 10,
plans_txtmd TYPE c LENGTH 40,
END OF ts_changes,
tt_changes TYPE TABLE OF ts_changes.

DATA: ls_search_result TYPE /nly/ts_search_result,
lv_sql TYPE string,
lo_t_table TYPE REF TO data,
l_search_term TYPE string.

* Search term
DATA(lv_search_term) = i_search_term.

FIELD-SYMBOLS:
<fs_s_table> TYPE ts_changes,
<fs_t_table> TYPE tt_changes.

REPLACE ALL OCCURRENCES OF '%20' IN lv_search_term WITH ` `.
REPLACE ALL OCCURRENCES OF '%22' IN lv_search_term WITH `"`.

IF lv_search_term IS INITIAL.
l_search_term = '*'.
ELSE.
l_search_term = |{ lv_search_term }|.
ENDIF.

CREATE DATA lo_t_table TYPE tt_changes.
ASSIGN lo_t_table->* TO <fs_t_table>.

lv_sql = |SELECT TOP 300 DISTINCT SCORE() AS SCORE, pernr, nachn, vorna, pstlz, stras, ort01, emplstatus_txtmd, bukrs, bukrs_txtmd, kostl, kostl_txtmd, orgeh, orgid_txtmd, plans, plans_txtmd |
&& |FROM "ZCDSPERSSEARCH" | " Personal View
&& |WHERE CONTAINS(("NACHN", "VORNA", "PERNR", "STRAS", "ORT01", "BUKRS", "KOSTL", "ORGEH", "PLANS", "PLANS_TXTMD", "ORGID_TXTMD", "BUKRS_TXTMD", "KOSTL_TXTMD" ), '{ l_search_term }', FUZZY(0.7, 'similarCalculationMode=compare')|
&& | , weight (1, 0.8, 0.8, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.3, 0.3, 0.3, 0.3 )) |
&& |ORDER BY score() desc|.

TRY.
" Prepare SQL connection and statement
DATA(lo_result) =
cl_sql_connection=>get_connection(
)->create_statement(
)->execute_query( lv_sql ).

lo_result->set_param_table( REF #( <fs_t_table> ) ).

" Get result
lo_result->next_package( ).
lo_result->close( ).
CATCH cx_sql_exception INTO DATA(err).

" Error handling
DATA l_error(200) TYPE c.
l_error = |{ err->get_text( ) }|.

RAISE EXCEPTION TYPE /nly/cx_search_rest
EXPORTING
textid = /nly/cx_table_rest=>custom_message
msgv1 = l_error(50)
msgv2 = l_error+50(50)
msgv3 = l_error+100(50)
msgv4 = l_error+150(50).
ENDTRY.

LOOP AT <fs_t_table> ASSIGNING <fs_s_table>.
CLEAR ls_search_result.
ls_search_result-title_key = |{ <fs_s_table>-pernr }|.
ls_search_result-title_desc = |{ <fs_s_table>-nachn } { <fs_s_table>-vorna } ({ <fs_s_table>-pernr ALPHA = out width = 1 }) |.
ls_search_result-sub_title = | { <fs_s_table>-plans_txtmd } in { <fs_s_table>-orgid_txtmd } |.
ls_search_result-content = |Adresse: { <fs_s_table>-stras } | && | { <fs_s_table>-ort01 } |
&& | <br>BuKrs: { <fs_s_table>-bukrs } { <fs_s_table>-bukrs_txtmd }|
&& | <br>Kost: { <fs_s_table>-kostl } { <fs_s_table>-kostl_txtmd }|
&& | <br>Score: { <fs_s_table>-score }|.
ls_search_result-score = <fs_s_table>-score * 100.
APPEND ls_search_result TO e_t_search_result.
ENDLOOP.

* set as customer exit implemented
e_is_implemented = abap_true.
ENDMETHOD.

Which License is needed for this feature Professional | Enterprise


Do you have a question regarding NextTables? Already a customer? Please click here for Support.