Code for Hot spot in ALV report to call transaction

Hotspots are special areas of an output list. If the user clicks once onto a hotspot field, an event is triggered.

For inserting the Hotspots in the ALV, we need to follow following steps in ALV:

 

Hotspot in ALV

Hotspot in ALV

1. In the fieldcatalog you will have to write the hotspot as shown below:

wa_fieldcat-hotspot = ’X’.

APPEND wa_fieldcat TO it_fieldcat.

 

CALL FUNCTION ‘REUSE_ALV_GRID_DISPLAY’

EXPORTING

i_callback_program = sy-repid

i_callback_user_command = ‘USER_COMMAND’“—-> this is important

  • i_callback_pf_status_set = ‘PFSTATUS’

it_fieldcat = it_fieldcat

is_layout = it_layout

  • it_event_exit = it_eventexit
  • i_screen_start_column = 10
  • i_screen_start_line = 20
  • i_screen_end_column = 70
    • i_screen_end_line = 45

i_grid_title = ‘Customer-Order Details’

TABLES

t_outtab = it_data.

 

2. Then we have to catch this User Command as follows :

FORM user_command USING r_ucomm TYPE sy-ucomm

rs_selfield TYPE slis_selfield.

 

DATA: alv_vbeln TYPE vbeln,

mess_text(30) TYPE c,

txt_vbeln(10) TYPE c.

 

*User clicks a Order No. in ALV it passed to the following transaction.

 

CASE r_ucomm.

WHEN ‘&IC1′.

READ TABLE it_data INDEX rs_selfield-tabindex INTO wa_data.

alv_vbeln = wa_data-vbeln..

IF sy-subrc = 0.

CLEAR: mess_text, txt_vbeln.

 

SUBMIT zprogram

WITH pr_vbeln = alv_vbeln AND RETURN. “put your call transaction logic here

 

ENDIF.

ENDCASE.

ENDFORM. “user_command

 

 

 

 

 

 

 

 

 

You might also be interested in these posts:

  1. Add custom button onto ALV Grid in SAP
  2. ABAP Program to Search For SMARTFORMS in your Language
  3. Displaying Icons in ALV Grid using ABAP
  4. ABAP program to get User Exits and BADI List for a T-Code
  5. ABAP Unapproved Purchase Orders Report

No Responses to “Code for Hot spot in ALV report to call transaction”

Post a Comment