Google Search - Blog...........

ABAP - ALV Report With A Popup Screen.

report ztest .

TYPE-POOLS: slis.

DATA: BEGIN OF itab OCCURS 0,
a TYPE p DECIMALS 2,
b TYPE p DECIMALS 2,
c TYPE c,
END OF itab.

DATA: ls_fieldcat TYPE lvc_t_fcat WITH HEADER LINE,
it_event_exit TYPE slis_t_event_exit WITH HEADER LINE.

PERFORM build_data_tab.
PERFORM build_fcat.
PERFORM build_event_table.
PERFORM alv_display.

*&---------------------------------------------------------------------*
*& Form build_data_tab
*&---------------------------------------------------------------------*
FORM build_data_tab .
itab-a = '1.12'.
itab-b = '2.25'.
itab-c = '+'.

APPEND itab.
APPEND itab.
APPEND itab.
APPEND itab.
ENDFORM. " build_data_tab
*&---------------------------------------------------------------------*
*& Form build_fcat
*&---------------------------------------------------------------------*
FORM build_fcat .
ls_fieldcat-fieldname = 'A'.
ls_fieldcat-reptext = 'field1'.
APPEND ls_fieldcat.

ls_fieldcat-fieldname = 'B'.
ls_fieldcat-reptext = 'field2'.
APPEND ls_fieldcat.

ls_fieldcat-fieldname = 'C'.
ls_fieldcat-reptext = 'field3'.
APPEND ls_fieldcat.
ENDFORM. " build_fcat
*&---------------------------------------------------------------------*
*& Form build_event_table
*&---------------------------------------------------------------------*
FORM build_event_table .
it_event_exit-ucomm = '&F03'.
APPEND it_event_exit.
it_event_exit-ucomm = '&F15'.
APPEND it_event_exit.
it_event_exit-ucomm = '&F12'.
APPEND it_event_exit.
ENDFORM. " build_event_table
*&---------------------------------------------------------------------*
*& Form alv_display
*&---------------------------------------------------------------------*
FORM alv_display .
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
EXPORTING
i_callback_program = sy-repid
i_callback_user_command = 'USER_COMMAND'
it_fieldcat_lvc = ls_fieldcat[]
it_event_exit = it_event_exit[]
TABLES
t_outtab = itab[].
ENDFORM. " alv_display
*&---------------------------------------------------------------------*
*& Form user_command
*&---------------------------------------------------------------------*
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
CASE r_ucomm .
WHEN '&F03'.
MESSAGE 'U are going back' TYPE 'I'.
WHEN '&F15'.
MESSAGE 'U are about to exit' TYPE 'I'.
WHEN '&F12'.
MESSAGE 'U have clicked cancel button' TYPE 'I'.
ENDCASE.
ENDFORM. "user_command


ALSO READ:

- ALV Pop Up To Select The Options & Display Them.

- Example On Blocking ALV List/Grid Display.

- Change The Layout Of The ALV List/Grid Display.

- Add Color In ALV List/Grid Display.

- Use Of Double Click On ALV Grid/List Display.

..... Back To Index On ALV List/ Grid Display.

..... Back To MAIN INDEX.



No comments:

Post a Comment