cancel
Showing results for 
Search instead for 
Did you mean: 

ALV search help handling

Former Member
0 Kudos

Is there anyone who has experience on providing self-defined search help for the input field in ALV .

Any help would be greatly appreciated.

Thanks in advance!

Accepted Solutions (0)

Answers (5)

Answers (5)

Former Member
0 Kudos

Thanks everyone, but I might not describe my question clearly.

In fact, I want to realize the dynamic search help in Webdynpro for ABAP.

If someone has experience on this?

Former Member
0 Kudos

Or this is another way.

Try the following Steps/

1. in fieldcatalog , what ever field you want F4 , give the f4availabl = 'X'.

gs_fieldcat-f4availabl = 'X'.

2. Register the F4 event and F4 field

gs_f4-fieldname = 'CONNID'.

gs_f4-register = 'X'.

gs_f4-getbefore = check_be.

gs_f4-chngeafter = chn_aft.

append gs_f4 to gt_f4.

call method my_grid->register_f4_for_fields

exporting

it_f4 = gt_f4.

this you can do it before calling the alv display.

3. need to have an event handler for F4.

if you check the alv events

there is an event on_f4

have a local class , and implement the method on_f4.

in side this method you can handle the F4 dynamically

4. set the handler.

this you need to call before or after the set_display method.

set handler my_event_receiver->on_f4 for all instances.

Hope this is also useful to you

Former Member
0 Kudos

if you want to have dynamic search help, Pl. see this sample code..may be it will help u.

REPORT zooalvf14 .

Global data definitions for ALV.......................................

DATA : alvgrid TYPE REF TO cl_gui_alv_grid, custom_container TYPE REF TO cl_gui_custom_container, fieldcatalog TYPE lvc_t_fcat.

table to contain fields that require f4............................... DATA : lt_f4 TYPE lvc_t_f4 WITH HEADER LINE.

ok_code declaration................................................... DATA : ok_code TYPE sy-ucomm.

Tables declaration.................................................... TABLES : zemployee_c7.

Types declaration..................................................... TYPES : BEGIN OF ty_emp, empid LIKE zemployee_c7-empid, empname LIKE zemployee_c7-empname, END OF ty_emp.

Internal table declaration............................................ DATA : i_emp TYPE TABLE OF ty_emp.

Workarea declaration.................................................. DATA : wa_emp TYPE ty_emp.

Selection screen parameters........................................... SELECT-OPTIONS : s_empid FOR zemployee_c7-empid.

----


  • CLASS lcl_event_handler DEFINITION ---------------------------------------------------------------------

  • ........ * ---------------------------------------------------------------------

CLASS lcl_event_handler DEFINITION. PUBLIC SECTION. METHODS : handle_on_f1 FOR EVENT onf1 OF cl_gui_alv_grid IMPORTING e_fieldname es_row_no er_event_data, handle_on_f4 for event onf4 of cl_gui_alv_grid importing e_fieldname es_row_no er_event_data . ENDCLASS. ----


  • CLASS lcl_event_handler IMPLEMENTATION ---------------------------------------------------------------------

  • ........ * ---------------------------------------------------------------------

CLASS lcl_event_handler IMPLEMENTATION. METHOD handle_on_f1.

custom f1 help for empid field....................................... IF e_fieldname = 'EMPID'. CALL SCREEN 3001. ENDIF.

to prevent processing of standard f1 help............................ er_event_data->m_event_handled = 'X'. ENDMETHOD. Method handle_on_f4. standard f4 help will be invoked...................................... endmethod.

ENDCLASS.

start of selection....................................................

START-OF-SELECTION. SELECT empid empname FROM zemployee_c7 INTO CORRESPONDING FIELDS OF TABLE i_emp WHERE empid IN s_empid. CALL SCREEN 3000. &----


*& Module STATUS_3000 OUTPUT &----
* text ----

MODULE status_3000 OUTPUT. SET PF-STATUS 'ZTOOL'. SET TITLEBAR 'ZTITLE'. IF alvgrid IS INITIAL. CREATE OBJECT custom_container EXPORTING container_name = 'ZCONTAINER'. CREATE OBJECT alvgrid EXPORTING i_parent = custom_container. PERFORM prepare_f4. CALL METHOD alvgrid->register_f4_for_fields EXPORTING it_f4 = lt_f4[] . creating instance for event handler.................................. DATA : event_handler TYPE REF TO lcl_event_handler. CREATE OBJECT event_handler. SET HANDLER event_handler->handle_on_f1 FOR alvgrid. SET HANDLER event_handler->handle_on_f4 FOR alvgrid.

preparing field catalog.............................................. PERFORM prepare_fieldcatalog CHANGING fieldcatalog. CALL METHOD alvgrid->set_table_for_first_display * EXPORTING * I_BYPASSING_BUFFER = * I_BUFFER_ACTIVE = * I_CONSISTENCY_CHECK = * I_STRUCTURE_NAME = * IS_VARIANT = * I_SAVE = * I_DEFAULT = 'X' * IS_LAYOUT = * IS_PRINT = * IT_SPECIAL_GROUPS = * IT_TOOLBAR_EXCLUDING = * IT_HYPERLINK = * IT_ALV_GRAPHICS = * IT_EXCEPT_QINFO = CHANGING it_outtab = i_emp it_fieldcatalog = fieldcatalog * IT_SORT = * IT_FILTER = * EXCEPTIONS * INVALID_PARAMETER_COMBINATION = 1 * PROGRAM_ERROR = 2 * TOO_MANY_LINES = 3 * others = 4 . IF sy-subrc 0. * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO * WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4. ENDIF. ENDIF. ENDMODULE. " STATUS_3000 OUTPUT

preparing field catalog............................................... FORM prepare_fieldcatalog CHANGING i_fieldcatalog TYPE lvc_t_fcat. DATA : ls_fcat TYPE lvc_s_fcat. ls_fcat-fieldname = 'EMPID'. ls_fcat-ref_table = 'ZEMPLOYEE_C7'. ls_fcat-coltext = 'EMPLOYEE ID'. APPEND ls_fcat TO i_fieldcatalog. CLEAR ls_fcat. ls_fcat-fieldname = 'EMPNAME'. ls_fcat-ref_table = 'ZEMPLOYEE_C7'. ls_fcat-coltext = 'EMPLOYEE NAME'. APPEND ls_fcat TO i_fieldcatalog. ENDFORM.

&----


*& Module USER_COMMAND_3000 INPUT &----
* text ----

MODULE user_command_3000 INPUT.

CASE ok_code.

WHEN 'BACK'.

LEAVE TO SCREEN 0.

WHEN 'EXIT'.

LEAVE PROGRAM.

ENDCASE.

ENDMODULE.

" USER_COMMAND_3000 INPUT &----


*&

Module USER_COMMAND_3001 INPUT &----


* text ----
MODULE user_command_3001 INPUT.

CASE ok_code.

WHEN 'SAVE'.

LEAVE TO SCREEN 0.

WHEN 'BACK'.

LEAVE TO SCREEN 0.

ENDCASE.

ENDMODULE.

" USER_COMMAND_3001 INPUT &----


*& Module STATUS_3001 OUTPUT &----
* text ----
MODULE status_3001 OUTPUT. SET PF-STATUS 'GUI'. SET TITLEBAR 'TITLE'. ENDMODULE. " STATUS_3001 OUTPUT preparing fields to be registered for f4 help......................... FORM prepare_f4. lt_f4-fieldname = 'EMPNAME'. lt_f4-register = 'X'. lt_f4-getbefore = 'X'. lt_f4-chngeafter = 'X'. APPEND lt_f4. ENDFORM.

hope this will help you.

Former Member
0 Kudos

and if you wanna have automatic input check you can refer to the following link which might be useful to you.

http://help.sap.com/saphelp_nw70ehp1/helpdata/en/c8/6c80dbedfe42d1a93f8e6df1d7244a/frameset.html

Former Member
0 Kudos

hi

Use DDIC table ZXXX with text table ZXXX_T and create DDIC search help form table ZXXX. In WD application, in context on COMPONENTCONTROLLER set on attribute: 'Input help mode' as 'Dictionary Search Help' and in 'Dictionary Search Help' pass name of new created DDIC search help. Then create a input field from that atrribute and search help will work fine (there will be a value and description for value from text table). So create ALV witch contains that attribute too. Next set column for this attribute in ALV as editable. Then assign your DDic Search Help to the Z-table in the Data Dictionary. That way you don't have to override the search help assignment at the context level and the ALV is more likely to pull this in as well.

Or you can create DDic Search help for all fields from your ALV. Next change 'TYPE' for all ALV fields in COMPONENTCONTROLLER from ZXXX-Zfield to Zfield, and change 'Input help mode' from 'Automatic' to 'Dictionary Search Help'. Now you can see Value and Description for value in Search Help in your ALV.

Hope this information is useful to you.

Regards

Vinodh