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

Hyper link in ALV by classes and methods

Former Member
0 Likes
2,423

Hiii,

I developd report using alv report using classes cl_gui_alv_grid,cl_gui_custom_container...

Output display contains field called as org_crmid..

if i click on org_crmid i have to move to another transaction named BP( its saperate screen)

kindly help me in solving this through classes..

thanks in advance..

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,851

hi,

follow these steps.............

1) while creating field catalog set the propertiey hotspot = 'X' to the field on which we click.

2) in local class define method for handling hotspot_click event.

  • Hotspot clicking

hotspot_click

FOR EVENT hotspot_click OF cl_gui_alv_grid

IMPORTING e_row_id

e_column_id

es_row_no,

3) in the implementation section provide the logic

METHOD hotspot_click.

PERFORM event_hotspot_click

USING e_row_id

e_column_id.

ENDMETHOD.

*form routine contains logic

FORM event_hotspot_click

USING

p_row TYPE lvc_s_row

p_column TYPE lvc_s_col.

DATA:

lv_docnum TYPE kunnr.

READ TABLE i_alv_data INTO v_alv_data INDEX p_row-index.

IF p_column = 'CUST_ID'.

  • call a transaction when the cust_id is clicked

SET PARAMETER ID 'AUN' FIELD v_alv_data-cust_id.

CALL TRANSACTION 'VA03' AND SKIP FIRST SCREEN.

ENDIF.

ENDFORM.

for more information follow this link...............

http://www.watto.org/program/abap/download/Z_ALV_TEMPLATE.abap

http://saplab.blogspot.com/2007/10/sample-abap-program-of-alv-grid-control.html

http://help.sap.com/saphelp_nw04/helpdata/en/ee/c8e080d52611d2b468006094192fe3/content.htm

regards,

Ashok

6 REPLIES 6
Read only

Sm1tje
Active Contributor
0 Likes
1,851

have a look at this article:

[easy reference for ALV grid control|https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/e8a1d690-0201-0010-b7ad-d9719a415907]

In stead of using a hyperlink, use a hotspot or a button click. You will find all of this in the document.

Read only

Former Member
0 Likes
1,851

in field catalog..

set for ur field,

wa_fcat-hotspot = 'X'.


CLASS lcl_event_handler DEFINITION .
PUBLIC SECTION .
METHODS:
*--Hotspot click control
handle_hotspot_click
FOR EVENT hotspot_click OF cl_gui_alv_grid
IMPORTING e_row_id e_column_id es_row_no .
ENDCLASS.

CLASS lcl_event_handler IMPLEMENTATION .
*--Handle Hotspot Click
METHOD handle_hotspot_click .
  READ TABLE itab INDEX eis_row_no e_row_id .
  set paramater...
  call transaction 'X'....
ENDMETHOD .


DATA gr_event_handler TYPE REF TO lcl_event_handler .
CREATE OBJECT gr_event_handler .
*--Registering handler methods to handle ALV Grid events

SET HANDLER gr_event_handler->handle_hotspot_click FOR gr_alvgrid .

Edited by: Marcelo Ramos on Jan 6, 2009 11:28 AM

Read only

Former Member
0 Likes
1,851

hi,

CLASS lcl_event_receiver DEFINITION .
  PUBLIC SECTION .
    METHODS:
*--Hotspot click control
    handle_hotspot_click
      FOR EVENT hotspot_click OF cl_gui_alv_grid
      IMPORTING e_row_id e_column_id es_row_no.

ENDCLASS .                    "lcl_event_handler DEFINITION
*----------------------------------------------------------------------*
*       CLASS lcl_event_handler  IMPLEMENTATIO
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS lcl_event_receiver IMPLEMENTATION.

  METHOD handle_hotspot_click .
    PERFORM handle_hotspot_click USING e_row_id e_column_id es_row_no .
  ENDMETHOD .                    "handle_hotspot_click

ENDCLASS .                    "lcl_event_handler DEFINITION

DATA       g_event_receiver TYPE REF TO lcl_event_receiver, "Event Receiver

      CREATE OBJECT g_event_receiver.
      SET HANDLER g_event_receiver->handle_hotspot_click FOR g_alv_grid.



  g_fieldcat-hotspot      = 'X'.

Edited by: avinash kodarapu on Jan 6, 2009 6:38 PM

Read only

uwe_schieferstein
Active Contributor
0 Likes
1,851

Hello Deepthi

If this is the only possible event within a row then I would recommend to activate the event DOUBLE_CLICK.

For a sample report have a look at ZUS_SDN_THREE_ALV_GRIDS in thread


*---------------------------------------------------------------------*
*       CLASS lcl_eventhandler IMPLEMENTATION
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
CLASS lcl_eventhandler IMPLEMENTATION.
 
  METHOD handle_double_click.
*   define local data
    DATA:
      ls_knb1      TYPE knb1,
      ls_vbak      TYPE vbak,
      ls_vbap      TYPE vbap.
 
 
    CASE sender.
      WHEN go_grid1.
...
 
 
      WHEN go_grid2.
...
 
 
 
      WHEN go_grid3.
        READ TABLE gt_vbap INTO ls_vbap INDEX e_row-index.
        CHECK ( ls_vbap-matnr IS NOT INITIAL ).
 
        SET PARAMETER ID 'MAT' FIELD ls_vbap-matnr.
        CALL TRANSACTION 'MM02' AND SKIP FIRST SCREEN.
 
      WHEN OTHERS.
        RETURN.
    ENDCASE.
 
  ENDMETHOD.                    "handle_double_click

Regards

Uwe

Read only

Former Member
0 Likes
1,852

hi,

follow these steps.............

1) while creating field catalog set the propertiey hotspot = 'X' to the field on which we click.

2) in local class define method for handling hotspot_click event.

  • Hotspot clicking

hotspot_click

FOR EVENT hotspot_click OF cl_gui_alv_grid

IMPORTING e_row_id

e_column_id

es_row_no,

3) in the implementation section provide the logic

METHOD hotspot_click.

PERFORM event_hotspot_click

USING e_row_id

e_column_id.

ENDMETHOD.

*form routine contains logic

FORM event_hotspot_click

USING

p_row TYPE lvc_s_row

p_column TYPE lvc_s_col.

DATA:

lv_docnum TYPE kunnr.

READ TABLE i_alv_data INTO v_alv_data INDEX p_row-index.

IF p_column = 'CUST_ID'.

  • call a transaction when the cust_id is clicked

SET PARAMETER ID 'AUN' FIELD v_alv_data-cust_id.

CALL TRANSACTION 'VA03' AND SKIP FIRST SCREEN.

ENDIF.

ENDFORM.

for more information follow this link...............

http://www.watto.org/program/abap/download/Z_ALV_TEMPLATE.abap

http://saplab.blogspot.com/2007/10/sample-abap-program-of-alv-grid-control.html

http://help.sap.com/saphelp_nw04/helpdata/en/ee/c8e080d52611d2b468006094192fe3/content.htm

regards,

Ashok

Read only

Former Member
0 Likes
1,851

thank u all vry much