Skip to Content
author's profile photo Former Member
Former Member

HOTSPOT

Hi. How can I use Hotspot in ALV with objects???. Thanks.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Jun 17, 2008 at 08:34 PM

    Hi....

    w_filedcatfiled = 'VBELN'.

    w_fieldcat-hotspot = 'x'.

    here w_fieldcat is work area of the fieldact internal table...

    with above code you can get hotspot for sales order field

    and then only you can get secondary list wrt that field in alv reoprts.....

    to get hot spot in classical report just edit rthe line of that field in write statement with 'hotspot'....

    then you can easily identify the interactive column...

    http://www.sapdev.co.uk/reporting/alv/alvgrid_editable.htm

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 17, 2008 at 09:02 PM

    Pl. see this code.

    &----


    *& Report displaying an ALV GRID CONTROL which responds *

    *& to HOTSPOT click event *

    &----


    REPORT ZZ_ALV_GRID_RESPONDING_HOTSPOT_CLICK .

    TABLES : BKPF .

    DATA : I_BKPF TYPE STANDARD TABLE OF BKPF WITH HEADER LINE .

    DATA : MOK_CODE LIKE SY-UCOMM .

    DATA : OK_CODE LIKE SY-UCOMM .

    DATA : MM_CONTAINER TYPE REF TO CL_GUI_CUSTOM_CONTAINER .

    DATA : MM_ALVGRID TYPE REF TO CL_GUI_ALV_GRID .

    DATA : CT_FIELDCAT TYPE STANDARD TABLE OF LVC_S_FCAT .

    DATA : WA_FIELDCAT LIKE LVC_S_FCAT .

    ----


    • CLASS RESPOND_EVENTS DEFINITION

    ----


    ----


    CLASS RESPOND_EVENTS DEFINITION .

    PUBLIC SECTION .

    METHODS : RESPOND_HOTSPOT_CLICK FOR EVENT

    HOTSPOT_CLICK OF

    CL_GUI_ALV_GRID IMPORTING E_ROW_ID

    E_COLUMN_ID

    ES_ROW_NO.

    ENDCLASS . "RESPOND_EVENTS DEFINITION

    ----


    • CLASS RESPOND_EVENTS IMPLEMENTATION

    ----


    ----


    CLASS RESPOND_EVENTS IMPLEMENTATION .

    METHOD RESPOND_HOTSPOT_CLICK .

    CLEAR BKPF .

    READ TABLE I_BKPF INDEX E_ROW_ID INTO BKPF .

    IF SY-SUBRC EQ 0 .

    SET PARAMETER ID 'BLN' FIELD BKPF-BELNR .

    SET PARAMETER ID 'BUK' FIELD BKPF-BUKRS .

    SET PARAMETER ID 'GJR' FIELD BKPF-GJAHR .

    CALL TRANSACTION 'FB03' AND SKIP FIRST SCREEN .

    ENDIF .

    ENDMETHOD . "RESPOND_HOTSPOT_CLICK

    ENDCLASS . "RESPOND_EVENTS IMPLEMENTATION

    DATA : I_RESPOND_EVENTS TYPE REF TO RESPOND_EVENTS .

    *=====================================================

    • SELECTION SCREEN - ( DEFAULT )

    *=====================================================

    SELECT-OPTIONS : S_BELNR FOR I_BKPF-BELNR OBLIGATORY.

    *=====================================================

    • START OF SELECTION

    *=====================================================

    START-OF-SELECTION .

    SELECT * FROM BKPF

    INTO CORRESPONDING FIELDS OF TABLE I_BKPF

    WHERE BELNR IN S_BELNR .

    *======================================================

    • END-OF-SELECTION .

    *======================================================

    END-OF-SELECTION .

    CALL SCREEN 100 .

    • ------------------------------------------------------

    • The screen 100 has a custom control named 'MCONTAINER'

    • and a command button with function code 'QUIT' .

    • Of course has an element called OK_CODE like sy-ucomm .

    • The flow logic of the screen has in the output section

    • the module PREPARE_OUTPUT ,

    • and in the input section the module USER_COMMAND_0100 .

    • ------------------------------------------------------

    &----


    *& Module USER_COMMAND_0100 INPUT

    &----


    ----


    MODULE USER_COMMAND_0100 INPUT.

    CLEAR : MOK_CODE .

    MOK_CODE = OK_CODE .

    CLEAR : OK_CODE .

    CASE MOK_CODE .

    WHEN 'QUIT' .

    LEAVE TO SCREEN 0 .

    ENDCASE .

    ENDMODULE. " USER_COMMAND_0100 INPUT

    &----


    *& Module OUTPUT OUTPUT

    &----


    • text

    ----


    MODULE PREPARE_OUTPUT OUTPUT .

    IF MM_CONTAINER IS INITIAL .

    CREATE OBJECT MM_CONTAINER

    EXPORTING CONTAINER_NAME = 'MCONTAINER' .

    CREATE OBJECT MM_ALVGRID

    EXPORTING I_PARENT = MM_CONTAINER .

    PERFORM CATALOG_CREATION .

    PERFORM SHOW_DATA .

    CREATE OBJECT I_RESPOND_EVENTS .

    SET HANDLER I_RESPOND_EVENTS->RESPOND_HOTSPOT_CLICK

    FOR MM_ALVGRID .

    ENDIF .

    ENDMODULE. " OUTPUT OUTPUT

    &----


    *& Form CATALOG_CREATION

    &----


    *

    FORM CATALOG_CREATION .

    call function 'LVC_FIELDCATALOG_MERGE'

    EXPORTING

    i_structure_name = 'BKPF'

    CHANGING

    ct_fieldcat = Ct_fieldcat.

    LOOP AT Ct_fieldcat INTO WA_fieldcat.

    IF ( WA_FIELDCAT-FIELDNAME NE 'BUKRS' )

    AND ( WA_FIELDCAT-FIELDNAME NE 'BELNR' )

    AND ( WA_FIELDCAT-FIELDNAME NE 'GJAHR' ) .

    WA_FIELDCAT-HOTSPOT = 'X' .

    MODIFY Ct_fieldcat FROM WA_fieldcat.

    ENDIF .

    ENDLOOP.

    DELETE Ct_fieldcat WHERE HOTSPOT = 'X' .

    LOOP AT Ct_fieldcat INTO WA_fieldcat.

    IF WA_FIELDCAT-FIELDNAME EQ 'BELNR' .

    WA_FIELDCAT-HOTSPOT = 'X' .

    MODIFY Ct_fieldcat FROM WA_fieldcat.

    ENDIF .

    ENDLOOP.

    ENDFORM. " CATALOG_CREATION

    &----


    *& Form SHOW_DATA

    &----


    FORM SHOW_DATA .

    CALL METHOD MM_ALVGRID->SET_TABLE_FOR_FIRST_DISPLAY

    CHANGING

    IT_OUTTAB = I_BKPF[]

    IT_FIELDCATALOG = Ct_fieldcat[].

    ENDFORM. " SHOW_DATA

    Regards,

    Joy.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.