Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

F4 Help in ALV grid

Former Member
0 Kudos
917

Hi

Experts

how can we attach a SAP search help to a field in ALV GRID. (In output)

Regrads.

farukh

4 REPLIES 4

Former Member
0 Kudos
127

please refer to this link..

it is given clearly

https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/abap/an%20easy%20r...

also chk this demo programs for F4

BCALV_F4

BCALV_GRID_F4_HELP_APPLICATION

BCALV_GRID_F4_HELPM01

BCALV_TEST_GRID_F4_HELP

0 Kudos
127

Hi

thanks for the reply ..

but here i want to replace the standard help by other help .

regards

0 Kudos
127

Hi farukh,

1. If we define the field name

using LIKE table-fieldname,

2. then automatically the serach help will come

(provided the table-fieldname has help attached to it)

3. eg.

4. U can create a structure in se11,

and attach a search help to the required field.

5. Then use this definition

myfield like ZSTRUCT-fieldname

then help will come automatically.

regards,

amit m.

Former Member
0 Kudos
127

Hi,

Try this PSEUDO Code.


* Class Definition
CLASS lcl_event_receiver DEFINITION.

  PUBLIC SECTION.

*    For help on Serial Numbers
    METHODS handle_help_charval
       FOR EVENT onf4 OF cl_gui_alv_grid
        IMPORTING e_fieldname es_row_no er_event_data et_bad_cells
             e_display.
END CLASS.
** Class implementation.
*
CLASS lcl_event_receiver IMPLEMENTATION.
* Input help values for Serial Numbers

  METHOD handle_help_charval.
    PERFORM char_help_values
      USING e_fieldname es_row_no." er_event_data.
  ENDMETHOD.
ENDCLASS.
FORM char_help_values USING     pw_fieldname TYPE lvc_fname
                               pw_row_no TYPE lvc_s_roid.
  CASE pw_fieldname.

    WHEN c_sernr.

      PERFORM display_char_help CHANGING <l_output>.

      PERFORM refresh_grid USING w_grid.

  ENDCASE.
ENDFORM. 
FORM display_char_help CHANGING pwa_output TYPE type_output.
  DATA:tl_return TYPE TABLE OF ddshretval.
  FIELD-SYMBOLS:<l_return> TYPE ddshretval.
  SET PARAMETER ID 'MAT' FIELD pwa_output-matnr.

  CALL FUNCTION 'F4IF_FIELD_VALUE_REQUEST'
    EXPORTING
      tabname                   = 'MSEG'
      fieldname                 = 'SERNR'
     searchhelp                =  'EQSN'
*   SHLPPARAM                 = ' '
*   DYNPPROG                  = ' '
*   DYNPNR                    = ' '
*   DYNPROFIELD               = ' '
*   STEPL                     = 0
*   VALUE                     = ' '
*   MULTIPLE_CHOICE           = ' '
*   DISPLAY                   = ' '
*   SUPPRESS_RECORDLIST       = ' '
*   CALLBACK_PROGRAM          = ' '
*   CALLBACK_FORM             = ' '
   TABLES
     return_tab                = tl_return.
* EXCEPTIONS
*   FIELD_NOT_FOUND           = 1
*   NO_HELP_FOR_FIELD         = 2
*   INCONSISTENT_HELP         = 3
*   NO_VALUES_FOUND           = 4
*   OTHERS                    = 5
  .
  IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ELSE.
***
*Check for Duplicates.
    READ TABLE tl_return ASSIGNING <l_return> INDEX 1.
if sy-subrc = 0 .
 READ TABLE t_output TRANSPORTING NO FIELDS
          WITH KEY mblnr = pwa_output-mblnr
                         zeile = pwa_output-zeile
                         sernr = <l_return>-fieldval.
          IF sy-subrc = 0.
            MESSAGE i032 WITH text-m03.
            CLEAR pwa_output-sernr.
          ELSE.
            pwa_output-status = icon_green_light.
            pwa_output-sernr = <l_return>-fieldval.
        endif.
    ENDIF.
  ENDIF.

                   " char_help_values

Regards,

Raghav