How To Easy Create A Search Help in ALV OOPS Editable Field - SAP Blogs
How To Easy Create A Search Help in ALV OOPS Editable Field - SAP Blogs
44 How to Easy… Create a Search Help in ALV OOPS editable field | SAP Blogs
Community Topics Groups Answers Blogs Events Programs Resources What's New Explore SAP
Guilherme Frisoni
April 2, 2013 | 4 minute read
When we use an editable ALV, some fields must have a custom Search Help. Let’s describe the simple way to add a custom Search Help to a specific field of
an ALV using OOPS.
CLEAR ls_fcat.
ls_fcat-fieldname = ‘BWTAR’.
ls_fcat-ref_field = ‘BWTAR’.
ls_fcat-ref_table = ‘MBEW’.
ls_fcat-edit = ‘X’.
ls_fcat-f4availabl = ‘X’.
After create ALV Object GO_ALV, we need to register BWTAR field for F4 and set ONF4 event handler.
CLEAR lt_f4.
lt_f4-fieldname = ‘BWTAR’.
lt_f4-register = ‘X’.
EXPORTING
it_f4 = lt_f4[].
” Set Handler
In our local event handler class, we need to define the ONF4 event and code it.
PUBLIC SECTION.
METHODS:
handle_on_f4
IMPORTING e_fieldname
es_row_no
https://blogs.sap.com/2013/04/02/how-to-easy-create-a-search-help-in-alv-oops-editable-field/ 1/5
25/08/23, 09.44 How to Easy… Create a Search Help in ALV OOPS editable field | SAP Blogs
er_event_data.
ENDCLASS.
*–Handle On F4
METHOD handle_on_f4.
PERFORM handle_on_f4
USING e_fieldname
es_row_no
er_event_data.
ENDMETHOD.
ENDCLASS.
FORM handle_on_f4
” Types
END OF ys_bwtar.
” Local Vars
” Field-symbols
CASE e_fieldname.
WHEN ‘BWTAR’.
INDEX es_row_no-row_id.
” Load F4 Data
SELECT bwtar
FROM mbew
bwkey = <l_out>-werks.
https://blogs.sap.com/2013/04/02/how-to-easy-create-a-search-help-in-alv-oops-editable-field/ 2/5
25/08/23, 09.44 How to Easy… Create a Search Help in ALV OOPS editable field | SAP Blogs
CLEAR ls_map.
ls_map-fldname = ‘F0001’.
ls_map-dyfldname = ‘BWTAR’.
EXPORTING
retfield = ‘BWTAR’
value_org = ‘S’
TABLES
value_tab = lt_bwtar
dynpfld_mapping = lt_map
return_tab = lt_return
EXCEPTIONS
parameter_error = 1
no_values_found = 2
OTHERS = 3.
<l_out>-bwtar = ls_return-fieldval.
ENDIF.
ENDCASE.
” ALV Refresh
EXPORTING
is_stable = ls_stable
i_soft_refresh = ‘X’
EXCEPTIONS
finished = 1
OTHERS = 2.
er_event_data->m_event_handled = ‘X’.
ENDFORM.
That’s it!
Alert Moderator
https://blogs.sap.com/2013/04/02/how-to-easy-create-a-search-help-in-alv-oops-editable-field/ 3/5
25/08/23, 09.44 How to Easy… Create a Search Help in ALV OOPS editable field | SAP Blogs
Assigned Tags
Follow
ABAP Development | abap | abap objects | alv | alv oopl | alv-grid | cl gui alv grid
Like
View more...
RSS Feed
Similar Blog Posts
How to Easy... Create a Search Help by code and fill more than one field in screen How to create a Class in ABAP 00 - 6 Steps to start
By Guilherme Frisoni Mar 15, 2013 By Joachim Rees Feb 24, 2022
Related Questions
Update value in a cell in ALV using OOPS Disable few fields in SM30 (TMG)
By Jitendra Soni Mar 19, 2018 By Former Member Jun 14, 2013
7 Comments
khushbu Agarwal
March 18, 2015 at 7:25 am
very nice and helpful blog, it would be great if mentioned step by step approach with the reason of doing it.
Like 0 | Share
Radouane Sbaa
September 25, 2017 at 8:11 pm
Like 0 | Share
Sandra Rossi
March 19, 2018 at 2:13 pm
The title of your post is a little bit misleading: you are not using a Search Help, you are implementing the F4 Help. A Search Help is an object from the ABAP Dictionary (DDIC).
Like 0 | Share
Mohamed Hamdy
May 12, 2018 at 4:03 pm
Like 0 | Share
Vivin Gomez
July 13, 2019 at 10:00 am
https://blogs.sap.com/2013/04/02/how-to-easy-create-a-search-help-in-alv-oops-editable-field/ 4/5
25/08/23, 09.44 How to Easy… Create a Search Help in ALV OOPS editable field | SAP Blogs
It is displaying F4 help and picking the values perfectly, but an internal error occurs “Search help: Internal error: DestroyTab 2” that makes my SAP to crash
Like 0 | Share
madjid khanevadegi
May 18, 2020 at 11:11 am
Hi
thanks
Like 0 | Share
Hi,
Like 0 | Share
Find us on
Newsletter Support
https://blogs.sap.com/2013/04/02/how-to-easy-create-a-search-help-in-alv-oops-editable-field/ 5/5