Application Development 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: 

hot spot

Former Member
0 Kudos

how to asssign hotspot

1 ACCEPTED SOLUTION

Former Member
0 Kudos

See the code:

REPORT zdemoab.

TYPE-POOLS: slis.
TABLES: mara.

TYPES: BEGIN OF t_itab,
       matnr TYPE mara-matnr,
       mtart TYPE mara-mtart,
       END OF t_itab.

DATA: itab TYPE TABLE OF t_itab,
      wa_itab like line of itab.

DATA: i_fieldcat TYPE slis_t_fieldcat_alv,
      wa_fieldcat LIKE LINE OF i_fieldcat,
      i_layout TYPE slis_layout_alv,
      g_repid TYPE sy-repid.


SELECT matnr mtart INTO TABLE itab FROM mara UP TO 10 ROWS.


CLEAR: wa_fieldcat.
wa_fieldcat-col_pos = 0.
wa_fieldcat-fieldname = 'MATNR'.
wa_fieldcat-tabname = 'MARA'.
wa_fieldcat-hotspot = 'X'.
APPEND wa_fieldcat TO i_fieldcat.
CLEAR: wa_fieldcat.

wa_fieldcat-col_pos = 1.
wa_fieldcat-fieldname = 'MTART'.
wa_fieldcat-tabname = 'MARA'.
APPEND wa_fieldcat TO i_fieldcat.
CLEAR: wa_fieldcat.


i_layout-colwidth_optimize = 'X'.
i_layout-hotspot_fieldname = 'MATNR'.

g_repid = sy-repid.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
 EXPORTING
   i_callback_program                = g_repid
   I_CALLBACK_USER_COMMAND           = 'USER_COMMAND '
   is_layout                         = i_layout
   it_fieldcat                       = i_fieldcat[]
  TABLES
    t_outtab                          = itab
 EXCEPTIONS
   program_error                     = 1
   OTHERS                            = 2
          .
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

FORM user_command USING r_ucomm LIKE sy-ucomm
                        rs_selfield TYPE slis_selfield.

*   Check field clicked on within ALVgrid report
    IF rs_selfield-fieldname = 'MATNR'.
*     To pass the material no in ME22 transaction
      READ TABLE itab INTO wa_itab INDEX rs_selfield-tabindex.
*     Set parameter ID for transaction screen field
      SET PARAMETER ID 'BES' FIELD wa_itab-matnr.
*     Sxecute transaction ME23N, and skip initial data entry screen
      CALL TRANSACTION 'MM03'.
*
    ENDIF.
ENDFORM.

5 REPLIES 5

Former Member
0 Kudos

See the code:

REPORT zdemoab.

TYPE-POOLS: slis.
TABLES: mara.

TYPES: BEGIN OF t_itab,
       matnr TYPE mara-matnr,
       mtart TYPE mara-mtart,
       END OF t_itab.

DATA: itab TYPE TABLE OF t_itab,
      wa_itab like line of itab.

DATA: i_fieldcat TYPE slis_t_fieldcat_alv,
      wa_fieldcat LIKE LINE OF i_fieldcat,
      i_layout TYPE slis_layout_alv,
      g_repid TYPE sy-repid.


SELECT matnr mtart INTO TABLE itab FROM mara UP TO 10 ROWS.


CLEAR: wa_fieldcat.
wa_fieldcat-col_pos = 0.
wa_fieldcat-fieldname = 'MATNR'.
wa_fieldcat-tabname = 'MARA'.
wa_fieldcat-hotspot = 'X'.
APPEND wa_fieldcat TO i_fieldcat.
CLEAR: wa_fieldcat.

wa_fieldcat-col_pos = 1.
wa_fieldcat-fieldname = 'MTART'.
wa_fieldcat-tabname = 'MARA'.
APPEND wa_fieldcat TO i_fieldcat.
CLEAR: wa_fieldcat.


i_layout-colwidth_optimize = 'X'.
i_layout-hotspot_fieldname = 'MATNR'.

g_repid = sy-repid.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
 EXPORTING
   i_callback_program                = g_repid
   I_CALLBACK_USER_COMMAND           = 'USER_COMMAND '
   is_layout                         = i_layout
   it_fieldcat                       = i_fieldcat[]
  TABLES
    t_outtab                          = itab
 EXCEPTIONS
   program_error                     = 1
   OTHERS                            = 2
          .
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

FORM user_command USING r_ucomm LIKE sy-ucomm
                        rs_selfield TYPE slis_selfield.

*   Check field clicked on within ALVgrid report
    IF rs_selfield-fieldname = 'MATNR'.
*     To pass the material no in ME22 transaction
      READ TABLE itab INTO wa_itab INDEX rs_selfield-tabindex.
*     Set parameter ID for transaction screen field
      SET PARAMETER ID 'BES' FIELD wa_itab-matnr.
*     Sxecute transaction ME23N, and skip initial data entry screen
      CALL TRANSACTION 'MM03'.
*
    ENDIF.
ENDFORM.

Former Member
0 Kudos

Hi,

Just write,

data: p1(5) value 'hai'.

format hotspot.

WRITE:/ p1.

Regards,

Varun

Former Member
0 Kudos

e.g

GF_PO = 'Purchase Order'.

Write : GF_PO hotspot.

START-OF-SELECTION.

AT LINE-SELECTION.

CLEAR: A1,A2.

GET CURSOR FIELD A1 VALUE A2.

IF A1 = 'GF_PO'.

whtever action say sorting the list

Former Member
0 Kudos

Hi

After selecting data into the internal table. Loop that internal table and use write statement to display the data, there give like this:

Loop at it_lfa1.

write:/ it_lfa1-lifnr <b>hotspot on</b>, it_lfa1-name1.

endloop.

Regards

Haritha