Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Leave scren while Hotspot click

Hi all,

Here is my sample program Hotspot click.

After calling the second screen by Hotspot click, the screen 100 is not leaving back when you pressed BACK Button in screen 100.

When i am Pressing the Back Button in screen 100, it is checking for Hotspot click event.

As i was new to Objects ,Anybody help me in resolving this

REPORT zspot_test .

TABLES mara.

TYPES : BEGIN OF tt_mara,

matnr TYPE matnr ,

mtart TYPE mtart,

matkl TYPE matkl,

END OF tt_mara.

DATA gt_mara TYPE STANDARD TABLE OF mara.

SELECT-OPTIONS so_matnr FOR mara-matnr.

SET SCREEN 100.

START-OF-SELECTION.

SELECT matnr mtart matkl FROM mara

INTO CORRESPONDING FIELDS OF TABLE

gt_mara

WHERE matnr IN so_matnr.

END-OF-SELECTION.

CALL SCREEN 100.

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

  • INCLUDE zin123.

----


***INCLUDE ZIN123 .

----


*Class Definitions

CLASS : event_handler DEFINITION.

PUBLIC SECTION.

METHODS : handle_hotspotclick FOR EVENT hotspot_click OF

cl_gui_alv_grid IMPORTING

e_row_id

e_column_id

es_row_no.

ENDCLASS.

----


  • CLASS : EVENT_HANDLER

----


  • ........ *

----


CLASS : event_handler IMPLEMENTATION.

METHOD : handle_hotspotclick.

PERFORM handleclick

USING

e_row_id

e_column_id.

  • es_row_no.

ENDMETHOD.

ENDCLASS.

&----


*& Form handleclick

&----


  • text

----


  • -->P_E_ROW_ID text

  • -->P_E_COLUMN_ID text

  • -->P_ES_ROW_NO text

----


FORM handleclick USING e_row_id TYPE lvc_s_row

e_column_id TYPE lvc_s_col.

  • es_row_no.

CALL SCREEN 200.

ENDFORM. " handleclick

&----


*& Module STATUS_0100 OUTPUT

&----


  • text

----


MODULE status_0100 OUTPUT.

SET PF-STATUS 'TEST1'.

  • SET TITLEBAR 'xxx'.

DATA gs_fieldcat TYPE lvc_s_fcat.

DATA: evt_handler TYPE REF TO event_handler.

DATA :gt_cont TYPE REF TO cl_gui_custom_container,

gt_grid TYPE REF TO cl_gui_alv_grid,

gt_container TYPE scrfname VALUE 'SPOT_CREATE',

gt_fieldcat TYPE lvc_t_fcat.

CREATE OBJECT gt_cont

EXPORTING

container_name = 'GRID1'.

CREATE OBJECT gt_grid

EXPORTING

i_parent = gt_cont.

CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'

EXPORTING

i_structure_name = 'MARA'

CHANGING

ct_fieldcat = gt_fieldcat.

LOOP AT gt_fieldcat INTO gs_fieldcat.

IF gs_fieldcat-fieldname = 'MATNR'.

gs_fieldcat-hotspot = 'X'.

modify gt_fieldcat from gs_fieldcat.

ENDIF.

ENDLOOP.

create object evt_handler.

set handler evt_handler->handle_hotspotclick FOR gt_grid.

CALL METHOD gt_grid->set_table_for_first_display

EXPORTING

  • is_variant = gs_variant

i_save = 'A'

i_default = 'X'

  • is_layout = gs_layout

CHANGING

it_outtab = gt_mara

it_fieldcatalog = gt_fieldcat.

endmodule.

  • INCLUDE zin24.

&----


*& Module USER_COMMAND_0100 INPUT

&----


  • text

----


MODULE user_command_0100 INPUT.

data gv_repid like sy-repid.

gv_repid = sy-repid.

CASE sy-ucomm.

WHEN 'BACK'.

LEAVE TO SCREEN 0.

ENDCASE.

ENDMODULE. " USER_COMMAND_0100 INPUT

module USER_COMMAND_0200 input.

case sy-ucomm.

when 'BACK'.

leave to screen 100.

endcase.

endmodule.

Former Member
Not what you were looking for? View more on this topic or Ask a question