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

ABAP - Sample Code On ALV Display With Colors.

REPORT ztest_alv_perc_13317.
TYPE-POOLS: slis.

DATA: it_fieldcat TYPE slis_t_fieldcat_alv,
wa_fieldcat TYPE slis_fieldcat_alv,
it_events TYPE slis_t_event,
wa_events TYPE slis_alv_event,
it_sort TYPE slis_t_sortinfo_alv,
wa_sort TYPE slis_sortinfo_alv,
l_layout TYPE slis_layout_alv.


TYPES: BEGIN OF ty_itab,
field1(10),
qty1 TYPE i,
qty2 TYPE i,
qty3 TYPE i,
END OF ty_itab.

DATA: itab TYPE STANDARD TABLE OF ty_itab WITH HEADER LINE,
itab1 TYPE ty_itab.

START-OF-SELECTION.
itab-field1 = 'FIRST'.
itab-qty1 = 21.
itab-qty2 = 12.
itab-qty3 = 53.
APPEND itab.

itab-field1 = 'SECOND'.
itab-qty1 = 12.
itab-qty2 = 31.
itab-qty3 = 05.
APPEND itab.

itab-field1 = 'THIRD'.
itab-qty1 = 34.
itab-qty2 = 16.
itab-qty3 = 75.
APPEND itab.

wa_fieldcat-col_pos = 1.
wa_fieldcat-fieldname = 'FIELD1'.
wa_fieldcat-EMPHASIZE = 'C320'.
wa_fieldcat-tabname = 'ITAB'.
APPEND wa_fieldcat TO it_fieldcat.

wa_fieldcat-col_pos = 2.
wa_fieldcat-fieldname = 'QTY1'.
wa_fieldcat-tabname = 'ITAB'.
wa_fieldcat-EMPHASIZE = 'C321'.
APPEND wa_fieldcat TO it_fieldcat.

wa_fieldcat-col_pos = 3.
wa_fieldcat-fieldname = 'QTY2'.
wa_fieldcat-tabname = 'ITAB'.
wa_fieldcat-EMPHASIZE = 'C520'.
APPEND wa_fieldcat TO it_fieldcat.

wa_fieldcat-col_pos = 4.
wa_fieldcat-fieldname = 'QTY3'.
wa_fieldcat-tabname = 'ITAB'.
wa_fieldcat-EMPHASIZE = 'C621'.
APPEND wa_fieldcat TO it_fieldcat.



CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
i_callback_program = sy-repid
it_fieldcat = it_fieldcat
TABLES
t_outtab = itab
EXCEPTIONS
program_error = 1
OTHERS = 2
.
IF sy-subrc <> 0.
ENDIF.



ALSO READ:

- ALV Header With Logo.

- Including Line After Subtotal In ALV Display.

- ALV Subtotals In Different Blocks.

- ALV With Page Numbers & Subtotals.

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

..... Back To MAIN INDEX.


No comments:

Post a Comment