‎2008 Jun 17 9:31 PM
‎2008 Jun 17 9: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...
‎2008 Jun 17 9: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...
‎2008 Jun 17 10: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.