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: 

Alv

Former Member
0 Kudos

Hi experts,

can anybody tell me !!

How to display an internal table on selecting a hotspot?

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

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.

Thanks.

2 REPLIES 2

Former Member
0 Kudos

Hi,

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.

Thanks.

Former Member
0 Kudos

Hi,

Check this.

loop at itab.

FORMAT HOTSPOT ON. " Inserted code

write:/10 itab-kunnr. " Removed comma and Added a dot

FORMAT HOTSPOT OFF. " Inserted code

WRITE: " Inserted code.

35 itab-name1,

70 itab-land1.

  • itab-kunnr hotspot on. " Commented code

hide itab-kunnr.

endloop.

Regards,

Priyanka.