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: 

Hotspot for a particular cell in alv display

0 Kudos

Hi Sdn's

I am new to abap programming,Here im facing some problem with Hotspot for a particular cell(column level) in alv display.please help me out .

thanks,

pavan

7 REPLIES 7

yogendra_bhaskar
Contributor
0 Kudos

Hi Pavan ,

analysis this test program and you will get what you want :

TYPE-POOLS:slis.

CLASS cl_gui_alv_grid DEFINITION LOAD.

TYPES:BEGIN OF ty1,
       matnr TYPE mara-matnr,
       mtart TYPE mara-mtart,
       END OF ty1.

TYPES:BEGIN OF ty,
       matnr TYPE mara-matnr,
       mtart TYPE mtart,
       tcolr TYPE lvc_t_styl,
       END OF ty.

DATA: i_mara TYPE TABLE OF ty1,
       i_out TYPE TABLE OF ty,
       wa_mara TYPE ty1,
       wa_out TYPE ty,
       repid TYPE sy-repid,
       it_cat TYPE lvc_t_fcat,
       wa_color TYPE lvc_s_styl,
       wa_cat TYPE lvc_s_fcat.
DATA: wa_layout TYPE lvc_s_layo.

START-OF-SELECTION.
   repid = sy-repid.
   SELECT matnr mtart FROM mara UP TO 10 ROWS INTO TABLE i_mara.
   IF sy-subrc = 0.
     LOOP AT i_mara INTO wa_mara.
       IF sy-tabix = 5.
         wa_color-fieldname = 'MATNR'.
         wa_color-style = cl_gui_alv_grid=>MC_STYLE_HOTSPOT. "<--
         APPEND wa_color TO wa_out-tcolr.
         CLEAR wa_color.
       ENDIF.
       wa_out-matnr = wa_mara-matnr.
       wa_out-mtart = wa_mara-mtart.
       APPEND wa_out TO i_out.
       CLEAR wa_out.
     ENDLOOP.
   ENDIF.

   wa_layout-stylefname = 'TCOLR'.
   wa_cat-fieldname = 'MATNR'.
   APPEND wa_cat TO it_cat.
   CLEAR wa_cat.
   wa_cat-fieldname = 'MTART'.
   APPEND wa_cat TO it_cat.

   CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
        EXPORTING
             i_callback_program      = repid
             is_layout_lvc           = wa_layout
             i_callback_user_command = 'USER_CMD'
             it_fieldcat_lvc         = it_cat
        TABLES
             t_outtab                = i_out.

FORM user_cmd USING r_ucomm TYPE sy-ucomm
                     rs_selfield TYPE slis_selfield.
   IF rs_selfield-value = '8124D92001'
           AND rs_selfield-fieldname = 'MATNR'.

   ENDIF.

   ENDFORM.

Former Member
0 Kudos

Hi Pavan,

1)In the fieldcatalog, assign 'X' to hotspot:

l_fieldcatalog-hotspot     = 'X'.

2) While calling the function module:

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

    EXPORTING

      i_callback_program      = l_repid

      i_callback_user_command = 'FIELD_HOTSPOT'

      i_callback_top_of_page  = 'TOP_OF_PAGE'.

---------------------

3) create a new subroutine:

FORM field_hotspot USING p_ucomm    LIKE sy-ucomm

                         p_selfield TYPE slis_selfield.

4) Any action to be performed can be written inside this Subroutine.

For example, if u want to navigate to a particular screen.

-Sowmya

Former Member
0 Kudos

Hi Pavan,

1)In the fieldcatalog, assign 'X' to hotspot:

l_fieldcatalog-hotspot     = 'X'.

2) While calling the function module:

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

    EXPORTING

      i_callback_program      = l_repid

      i_callback_user_command = 'FIELD_HOTSPOT'

      i_callback_top_of_page  = 'TOP_OF_PAGE'.

---------------------

3) create a new subroutine:

FORM field_hotspot USING p_ucomm    LIKE sy-ucomm

                         p_selfield TYPE slis_selfield.

4) Any action to be performed can be written inside this Subroutine.

For example, if u want to navigate to a particular screen.

-Sowmya

Sijin_Chandran
Active Contributor
0 Kudos

Hi Pavan ,

You just set the HOTSPOT = 'X' for that particular column while appending the field catalogue value related to that column.

eg.

WA_FCAT-FIELDNAME    = 'INVOICE'

WA_FCAT-TABNAME      = 'IT_FINAL'

WA_FCAT-SELTEXT_S    = 'Invoice Number'

WA_FCAT-SELTEXT_M   = 'Invoice Number'

WA_FCAT-SELTEXT_L    = 'Invoice Number'

WA_FCAT-COL_POS      = '2'

WA_FCAT-OUTPUTLEN  = '15'

WA_FCAT-DO_SUM       = ' '

WA_FCAT-EMPHASIZE  = ' '

WA_FCAT-HOTSPOT     = 'X'  " SEE LIke this

APPEND WA_FCAT TO GT_FIELDCAT.

Now for column Invoice Number Hotspot will be activated.


Former Member
0 Kudos

Hi Pavan,

You create a hotspot by doing something like this,

If you want to create hotspot on PO(EBELN),

In fieldcat by marking X in this fieldcat field.. and then

gs_fieldcat-fieldname = 'EBELN'.

gs_fieldcat-ref_tabname = 'GT_DATA'.

gs_fieldcat-hotspot =  'X'. " Shows the field as a hotspot.

gs_fieldcat-seltext_m = 'Puchase Order'.

APPEND gs_fieldcat TO gt_fieldcat.

And in the function call itself

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

i_callback_program = sy-repid

i_callback_user_command = 'MY_USER_COMMAND'

and rest of parameters,

and now in user command form, trap the

FORM MY_USER_COMMAND USING ucomm LIKE sy-ucomm

selfield TYPE slis_selfield.

IF ucomm = 'Function code of action, say click, or enter'

CASE selfield-fieldname.

WHEN 'EBELN'. "Purchase Order

READ TABLE gt_data ( in alv that you passed) INDEX selfield-tabindex.

IF gt_data-ebeln NE space.

set the parameter id of the transaction u wish to call and then

call transaction TCODE Name.

ENDIF.

Thanks & Regards,

Rajesh Adapa.

raymond_giuseppi
Active Contributor
0 Kudos

Either

  • From your text, look at HOTSPOT field in field catalog.
  • From your header; look for documentation on style (add a field type lvc_t_styl to your internal table, and when filling the internal table add a record in this field for the required field with style cl_gui_alv_grid=>MC_STYLE_HOTSPOT)

Both solutions are already described in some discussions at this forum, use the search tool. (Read the Rules of Engagement before posting.)

If your problem is not already answered, elaborate a little more on your problem, (Read Asking Good Questions in the SCN Discussion Spaces will help you get Good Answers.)

Regards,

Raymond

Former Member
0 Kudos

  First create the Fieldcatalog for your display.

   TYPE-POOLS: slis.

  data: gwa_fieldcat  TYPE slis_fieldcat_alv,

          gt_fieldcat    TYPE slis_t_fieldcat_alv.

  gwa_fieldcat-col_pos = '1'.
  gwa_fieldcat-seltext_l =  '
Purchase Requisition Number'.

  gwa_fieldcat--HOTSPOT     = 'X'.

  gwa_fieldcat-fieldname = 'BANFN'.
  gwa_fieldcat-tabname = 'IT_EABL'.

  APPEND gwa_fieldcat TO gt_fieldcat.
  CLEAR gwa_fieldcat.

And then pass this gt_fieldcat to the function module that you are using to display the alv i.e.

  REUSE_ALV_GRID_DISPLAY

  it_fieldcat = gt_fieldcat.

Regards,

Suman