Application Development and Automation 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: 
Read only

Attaining Hot spot in ALV Tree Using OOPS concept

Former Member
0 Likes
1,369

Hi All,

In our requirement we are displaying the data in ALV Tree Using OOPS.

We need to achieve hot spot on one of the header field.

I am using Class 'CL_GUI_ALV_TREE'

Ex:

CreditAccnt/ Company codes DSO DDSO

26 15 15

8000 5 5

8545 10 10

In the above example for every credit accnt in header we r displaying the values ( DSO ,DDSO) for all company codes.

Now we require hot spot on Credit Accnt 26. Such that when user clicks on the credit accnt it should navigate to another transaction.

NOTE: we havent build any field catalogue for field CreditAccnt/ Company codes .

1 ACCEPTED SOLUTION
Read only

Former Member
6 REPLIES 6
Read only

Former Member
0 Likes
1,000

Hi,

You can refer to the tutorial -

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

Or try using the code below-

*----


  • CLASS lcl_event_receiver DEFINITION

*----


CLASS lcl_event_receiver DEFINITION.

PUBLIC SECTION.

CLASS-METHODS:

  • Hot Spot Click

handle_hotspot

FOR EVENT hotspot_click OF cl_gui_alv_grid

IMPORTING e_row_id

e_column_id

es_row_no,

ENDCLASS.

  • Implementation

*&----


*& Method handle_hotspot

*&----


  • This method is called when the user clicks on a hotspot to drill down.

  • The following types are exported from the ALV

  • LVC_S_ROW

  • LVC_S_COL

  • LVC_S_ROID

*&----


METHOD handle_hotspot.

  • The hotspot processing coded in the form below.

PERFORM f9802_handle_hotspot USING e_row_id

e_column_id

es_row_no.

ENDMETHOD.

&----


*& Form f9802_handle_hotspot

&----


  • This form is called when the user clicks on a hotspot on the ALV grid

  • The parameters are of type

-


  • -->P_E_ROW text

  • -->P_E_COL text

  • -->P_E_ROID text

-


FORM f9802_handle_hotspot USING p_row

p_col

p_roid.

DATA: lw_output LIKE LINE OF i_output.

READ TABLE i_output INDEX p_row INTO lw_output.

SET PARAMETER ID 'MAT' FIELD lw_output-matnr.

CALL TRANSACTION 'MM02' AND SKIP FIRST SCREEN.

ENDFORM. " f9802_handle_hotspot

FORM f9300_modify_field_cat TABLES p_fieldcat STRUCTURE lvc_s_fcat.

Field-symbols: <lfs_fieldcat> TYPE lvc_s_fcat.

LOOP AT p_fieldcat ASSIGNING <lfs_fieldcat>.

CASE <lfs_fieldcat>-fieldname.

WHEN 'MATNR'.

<lfs_fieldcat>-hotspot = c_x.

<lfs_fieldcat>-key = c_x.

WHEN OTHERS.

ENDCASE.

ENDLOOP.

ENDFORM.

In PBO,

module STATUS_9001 output.

  • Set handlers for events

SET HANDLER o_eventreceiver->handle_hotspot FOR o_Alvgrid.

ENDMODULE.

Hope this helps

Read only

0 Likes
1,000

Thanks for your reply...

But ,My case is ALV Tree. In Class 'cl_gui_alv_tree' There is no event for Hotspot.

Read only

Former Member
0 Likes
1,000

plz chk this link for hotspot in cl_gui_alv_tree:

Read only

Former Member
0 Likes
1,000

Hi ,

you must be using g_alv->set_table_for_first_display , then pass fieldcatalog .



data :  g_alv              TYPE REF TO cl_gui_alv_tree.

  DATA: ls_fieldcatalog TYPE lvc_s_fcat,
            gt_fieldcatalog TYPE lvc_t_fcat..

  CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
    EXPORTING
*      i_structure_name = 'ZORDER'        " if u have stucture then give the name
    CHANGING
      ct_fieldcat      = gt_fieldcatalog.

  LOOP AT gt_fieldcatalog INTO ls_fieldcatalog.
    CASE ls_fieldcatalog-fieldname.

      WHEN 'EBELN'.    " in ur case  ' CreditAccnt ' .      change field name as per ur requirement
        ls_fieldcatalog-hotspot = 'X'.
    ENDCASE.

    MODIFY gt_fieldcatalog FROM ls_fieldcatalog.
  ENDLOOP.

  CALL METHOD g_alv->set_table_for_first_display
    EXPORTING
      is_hierarchy_header = l_hierarchy_header
    CHANGING
      it_fieldcatalog     = gt_fieldcatalog       " fill fieldcatalog.
      it_outtab           = gt_ekpo. "table must be empty !


hope this works.

Regards,

Aby

Read only

Former Member
Read only

Former Member
0 Likes
1,000

thanx