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 table line F2 details

Former Member
0 Kudos

when F2 is pressed in ALV, a pop-up window shows, giving the details of that table line.

how do I do the same in OO ALV report when F2 or double-click is used.

1 ACCEPTED SOLUTION

former_member480923
Active Contributor
0 Kudos

Please find the code:

FORM sub_show_detail USING uw_check TYPE boole_d.

DATA: lt_fcat_main TYPE lvc_t_fcat,

lt_fcat TYPE lvc_t_fcat,

ls_fcat TYPE lvc_s_fcat,

ls_data TYPE lvc_s_deta,

ls_deta TYPE lvc_s_detm,

lw_layo TYPE lvc_s_layo,

lt_deta TYPE lvc_t_detm,

lw_main TYPE zfd0r_invoice_analysis_strc,

lw_count TYPE lvc_index,

lw_title TYPE string.

FIELD-SYMBOLS: <l_fcat> TYPE lvc_s_fcat,

<l_data> TYPE zfd0r_invoice_analysis_strc,

<l_cval> TYPE ANY,

<l_tval> TYPE ANY.

    • Get the Global Field Catalog.

lt_fcat_main = gt_fieldcat.

    • Delete entries based on Invoice or F2 Invoice

IF uw_check = abap_true.

DELETE lt_fcat_main WHERE emphasize EQ space

AND fieldname NE 'GERNR'.

lw_title = text-f30.

ELSE.

DELETE lt_fcat_main WHERE emphasize >< space.

lw_title = text-f29.

ENDIF.

    • Get the Detail Display Fieldcatalog

ls_fcat-fieldname = 'COLUMNTEXT'.

ls_fcat-ref_table = 'LVC_S_DETA'.

ls_fcat-key = abap_true.

ls_fcat-coltext = text-f27.

ls_fcat-outputlen = 20.

APPEND ls_fcat TO lt_fcat.

CLEAR ls_fcat.

ls_fcat-fieldname = 'VALUE'.

ls_fcat-ref_table = 'LVC_S_DETA'.

ls_fcat-coltext = text-f28.

ls_fcat-outputlen = 35.

APPEND ls_fcat TO lt_fcat.

CLEAR ls_fcat.

    • Define layout

lw_layo-no_toolbar = abap_true.

    • Fill the Main table

LOOP AT gt_main ASSIGNING <l_data>.

lw_count = lw_count + 1.

DO.

READ TABLE lt_fcat_main ASSIGNING <l_fcat> INDEX sy-index.

    • End of All Fields -> EXIT

IF sy-subrc >< 0.

EXIT.

ENDIF.

ASSIGN COMPONENT <l_fcat>-fieldname

OF STRUCTURE <l_data> TO <l_cval>.

IF sy-subrc = 0.

ls_data-columntext = <l_fcat>-scrtext_l.

ls_data-value = <l_cval>.

APPEND ls_data TO ls_deta-detailtab.

CLEAR: ls_data.

ENDIF.

ENDDO.

      • Generate the Index

ls_deta-blockindex = lw_count.

      • append the display data.

APPEND ls_deta TO lt_deta.

CLEAR: ls_deta.

ENDLOOP.

      • Call The Item Detail FM.

CALL FUNCTION 'LVC_ITEM_DETAIL'

EXPORTING

i_title = lw_title

it_fieldcatalog = lt_fcat

is_layout = lw_layo

TABLES

t_outtab = lt_deta.

Hope That Helps

Anirban M.

4 REPLIES 4

Kanagaraja_L
Active Contributor
0 Kudos

Good Example program for OO ALV Duble Click

Kanagaraja L

vishal_sharda2
Participant
0 Kudos

Hi,

You can use AT LINE-SELECTION event for the same.

write your code which you need to execute on double click.

Please award points if useful.

Regards,

Vishal.

former_member480923
Active Contributor
0 Kudos

Please find the code:

FORM sub_show_detail USING uw_check TYPE boole_d.

DATA: lt_fcat_main TYPE lvc_t_fcat,

lt_fcat TYPE lvc_t_fcat,

ls_fcat TYPE lvc_s_fcat,

ls_data TYPE lvc_s_deta,

ls_deta TYPE lvc_s_detm,

lw_layo TYPE lvc_s_layo,

lt_deta TYPE lvc_t_detm,

lw_main TYPE zfd0r_invoice_analysis_strc,

lw_count TYPE lvc_index,

lw_title TYPE string.

FIELD-SYMBOLS: <l_fcat> TYPE lvc_s_fcat,

<l_data> TYPE zfd0r_invoice_analysis_strc,

<l_cval> TYPE ANY,

<l_tval> TYPE ANY.

    • Get the Global Field Catalog.

lt_fcat_main = gt_fieldcat.

    • Delete entries based on Invoice or F2 Invoice

IF uw_check = abap_true.

DELETE lt_fcat_main WHERE emphasize EQ space

AND fieldname NE 'GERNR'.

lw_title = text-f30.

ELSE.

DELETE lt_fcat_main WHERE emphasize >< space.

lw_title = text-f29.

ENDIF.

    • Get the Detail Display Fieldcatalog

ls_fcat-fieldname = 'COLUMNTEXT'.

ls_fcat-ref_table = 'LVC_S_DETA'.

ls_fcat-key = abap_true.

ls_fcat-coltext = text-f27.

ls_fcat-outputlen = 20.

APPEND ls_fcat TO lt_fcat.

CLEAR ls_fcat.

ls_fcat-fieldname = 'VALUE'.

ls_fcat-ref_table = 'LVC_S_DETA'.

ls_fcat-coltext = text-f28.

ls_fcat-outputlen = 35.

APPEND ls_fcat TO lt_fcat.

CLEAR ls_fcat.

    • Define layout

lw_layo-no_toolbar = abap_true.

    • Fill the Main table

LOOP AT gt_main ASSIGNING <l_data>.

lw_count = lw_count + 1.

DO.

READ TABLE lt_fcat_main ASSIGNING <l_fcat> INDEX sy-index.

    • End of All Fields -> EXIT

IF sy-subrc >< 0.

EXIT.

ENDIF.

ASSIGN COMPONENT <l_fcat>-fieldname

OF STRUCTURE <l_data> TO <l_cval>.

IF sy-subrc = 0.

ls_data-columntext = <l_fcat>-scrtext_l.

ls_data-value = <l_cval>.

APPEND ls_data TO ls_deta-detailtab.

CLEAR: ls_data.

ENDIF.

ENDDO.

      • Generate the Index

ls_deta-blockindex = lw_count.

      • append the display data.

APPEND ls_deta TO lt_deta.

CLEAR: ls_deta.

ENDLOOP.

      • Call The Item Detail FM.

CALL FUNCTION 'LVC_ITEM_DETAIL'

EXPORTING

i_title = lw_title

it_fieldcatalog = lt_fcat

is_layout = lw_layo

TABLES

t_outtab = lt_deta.

Hope That Helps

Anirban M.