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: 

INTERACTIVE ALV

Former Member
0 Kudos

Hi all,

I have displayed data in alv grid now if user click on any field i have to process further. I'm not able to call interactive events. Please suggest.

Thanks,

Anup.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hey Anup,

Did u check the sample code I have attached.

It will work fine. It's very simple buddy.

Try it and let me know by EOD.

Regs,

Venkat

6 REPLIES 6

Former Member
0 Kudos

Hi Anup,

To be able to handle the events, you will have to register them. you have not specified whether you are using the Function Module approach or the OO approach.

Look at the demo program BCALV_TEST_GRID_EVENTS. It should help you understand how this is done. If you have further doubts, please get back.

Regards,

Anand Mandalika.

Former Member
0 Kudos

Hi Anup,

If you are using "REUSE_ALV_LIST_DISPLAY", then there will be one field by name

" i_callback_user_command = g_f_callback_user_command ".

you uncomment that field.

for that user command write perform.

FORM user_command USING i_f_ucomm LIKE sy-ucomm

i_r_selfield TYPE slis_selfield.

CASE i_f_ucomm.

WHEN '&IC1'.

PERFORM fcode_item_lines USING i_r_selfield.

endcase.

now in this perform you code what has to be displayed.

Former Member
0 Kudos

Hi,

Here is the complete example code, refer. This will definitely help you.

REPORT ZVENKAT NO STANDARD PAGE HEADING.

TYPE-POOLS: slis.

DATA: BEGIN OF i_data OCCURS 0,

qmnum LIKE qmel-qmnum,

qmart LIKE qmel-qmart,

END OF i_data.

DATA: report_id LIKE sy-repid.

DATA: ws_title TYPE lvc_title VALUE 'An ALV Report'.

DATA: i_layout TYPE slis_layout_alv.

DATA: i_fieldcat TYPE slis_t_fieldcat_alv.

DATA: i_events TYPE slis_t_event.

DATA: i_header TYPE slis_t_listheader.

SELECT qmnum

qmart

qmtxt

INTO TABLE i_data

FROM qmel

WHERE qmnum <= '00030000010'.

LOOP AT i_data.

i_data-ws_row = sy-tabix.

i_data-ws_char = 'AAAAA'.

MODIFY i_data.

ENDLOOP.

report_id = sy-repid.

PERFORM f1000_layout_init CHANGING i_layout.

PERFORM f2000_fieldcat_init CHANGING i_fieldcat.

PERFORM f3000_build_header CHANGING i_header.

PERFORM f4000_events_init CHANGING i_events.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

i_callback_program = report_id

i_grid_title = ws_title

is_layout = i_layout

it_fieldcat = i_fieldcat

i_save = 'A'

it_events = i_events

TABLES

t_outtab = i_data

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 F1000_Layout_Init

*&----


FORM f1000_layout_init USING i_layout TYPE slis_layout_alv.

CLEAR i_layout.

i_layout-colwidth_optimize = 'X'.

i_layout-edit = 'X'.

ENDFORM. " F1000_Layout_Init

&----


& Form f2000_fieldcat_init

*&----


FORM f2000_fieldcat_init CHANGING i_fieldcat TYPE slis_t_fieldcat_alv.

DATA: line_fieldcat TYPE slis_fieldcat_alv.

CLEAR line_fieldcat.

line_fieldcat-fieldname = 'QMNUM'. " The field name and the table

line_fieldcat-tabname = 'I_DATA'. " name are the two minimum req.

line_fieldcat-key = 'X'. " Specifies the column as a key (Blue)

line_fieldcat-seltext_m = 'Notification No.'. " Column Header

APPEND line_fieldcat TO i_fieldcat.

CLEAR line_fieldcat.

line_fieldcat-fieldname = 'QMART'.

line_fieldcat-ref_tabname = 'I_DATA'.

line_fieldcat-hotspot = 'X'. " Shows the field as a hotspot.

line_fieldcat-seltext_m = 'Notif Type'.

APPEND line_fieldcat TO i_fieldcat.

ENDFORM. " f2000_fieldcat_init

&----


& Form f3000_build_header

*&----


FORM f3000_build_header USING i_header TYPE slis_t_listheader.

DATA: gs_line TYPE slis_listheader.

CLEAR gs_line.

gs_line-typ = 'H'.

gs_line-info = 'This is line of type HEADER'.

APPEND gs_line TO i_header.

ENDFORM. " f3000_build_header

&----


& Form f4000_events_init

*&----


FORM f4000_events_init CHANGING i_events TYPE slis_t_event.

DATA: line_event TYPE slis_alv_event.

CLEAR line_event.

line_event-name = 'TOP_OF_PAGE'.

line_event-form = 'F4100_TOP_OF_PAGE'.

APPEND line_event TO i_events.

ENDFORM. " f3000_events_init

----


FORM F4100_TOP_OF_PAGE*----


*----


FORM f4100_top_of_page.

CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

EXPORTING

it_list_commentary = i_header.

ENDFORM.

Cheers,

Venkat

Former Member
0 Kudos

Hey Anup,

Did u check the sample code I gave u.

it will work fine.

Regs,

Venkat

former_member181959
Contributor
0 Kudos

Hi anup,

You can display data using ALV’s function module like

REUSE_ALV_LIST_DISPLAY .

To handle the events use SLIS structure.

To get the information about the field on which the user has clicked use

GET CURSOR FIELD <fname> VALUE <fvalue >. in AT LINE-SELECTION event.

I hope it may help u.

With regards…

Prasad.

Former Member
0 Kudos

Hey Anup,

Did u check the sample code I have attached.

It will work fine. It's very simple buddy.

Try it and let me know by EOD.

Regs,

Venkat