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 fieldcatalog

Former Member
0 Kudos

hi abapers,

i am using alv grid display in which i want some help.

1. i want to color row how it is possible in fieldcatalog. i use EMPHASIZE BUT IT COLOR COL WISE.

2. i want to truncate leading zeors in MATNR field. there is lzero in fieldcatalog but how to use it.

thanks.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

hi,

In the CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

in EXPORTING there is a structure called

is_layout = int_layout

declare it as

DATA : int_layout TYPE slis_layout_alv.

modify the value of field zebra and paas it to FM

int_layout-zebra = 'X'

reward points if useful

6 REPLIES 6

Former Member
0 Kudos

Hi,

For color you can refer to the following link,

And as far as removing zeros are concerned you can remove them before passing to the alv fieldcatlog by using FM 'CONVERSION_EXIT_ALPHA_INPUT' or using PACK statement.

Hope this will serve the purpose .

Reward pts if helpful.

Thx

Former Member
0 Kudos

hi,

for truncating the leading zero's use exit routines.

for color use the following program.

*Include for ALV styles

INCLUDE <cl_alv_control>.

*Type ppols for alv

TYPE-POOLS : slis.

*structure for t582a tbale

TYPES : BEGIN OF ty_table,

infty TYPE infty,

pnnnn TYPE pnnnn_d,

zrmkz TYPE dzrmkz,

zeitb TYPE dzeitb,

dname TYPE dianm,

edynr TYPE edynp,

ldynr TYPE ldynp,

stypt TYPE stypt,

sytxt TYPE sytxt,

davo TYPE davo,

davoe TYPE davoe,

END OF ty_table.

*Structure for infotype text

TYPES : BEGIN OF ty_itext,

infty TYPE infty,

itext TYPE intxt,

sprsl TYPE sprsl,

END OF ty_itext.

*Structure for output display

TYPES : BEGIN OF ty_output,

infty TYPE infty,

itext TYPE intxt,

pnnnn TYPE pnnnn_d,

zrmkz TYPE dzrmkz,

zeitb TYPE dzeitb,

dname TYPE dianm,

edynr TYPE edynp,

ldynr TYPE ldynp,

stypt TYPE stypt,

sytxt TYPE sytxt,

davo TYPE davo,

davoe TYPE davoe,

text(6) TYPE c,

sradio(6) TYPE c,

scheck(6) TYPE c,

END OF ty_output.

*internal table and work area declarations

DATA : it_table TYPE STANDARD TABLE OF ty_table INITIAL SIZE 0,

it_output TYPE STANDARD TABLE OF ty_output INITIAL SIZE 0,

it_ittext TYPE STANDARD TABLE OF ty_itext INITIAL SIZE 0,

wa_table TYPE ty_table,

wa_output TYPE ty_output,

wa_ittext TYPE ty_itext.

*Data declarations for ALV

DATA: c_ccont TYPE REF TO cl_gui_custom_container, "Custom container object

c_alvgd TYPE REF TO cl_gui_alv_grid, "ALV grid object

it_fcat TYPE lvc_t_fcat, "Field catalogue

it_layout TYPE lvc_s_layo. "Layout

*Field symbols declarations for style

FIELD-SYMBOLS : <wa_fcat> TYPE lvc_s_fcat.

*initialization event

INITIALIZATION.

*start of selection event

START-OF-SELECTION.

*select the infotypes maintained

SELECT infty

pnnnn

zrmkz

zeitb

dname

edynr

ldynr

stypt

sytxt

davo

davoe

FROM t582a UP TO 25 ROWS

INTO CORRESPONDING FIELDS OF TABLE it_table.

  • *Select the infotype texts

IF it_table[] IS NOT INITIAL.

SELECT itext

infty

sprsl

FROM t582s

INTO CORRESPONDING FIELDS OF TABLE it_ittext

FOR ALL ENTRIES IN it_table

WHERE infty = it_table-infty

AND sprsl = 'E'.

ENDIF.

*Apppending the data to the internal table of ALV output

LOOP AT it_table INTO wa_table.

wa_output-infty = wa_table-infty.

wa_output-pnnnn = wa_table-pnnnn.

wa_output-zrmkz = wa_table-zrmkz.

wa_output-zeitb = wa_table-zeitb.

wa_output-dname = wa_table-dname.

wa_output-edynr = wa_table-edynr.

wa_output-ldynr = wa_table-ldynr.

wa_output-stypt = wa_table-stypt.

wa_output-sytxt = wa_table-sytxt.

wa_output-davo = wa_table-davo.

wa_output-davoe = wa_table-davoe.

  • For texts

READ TABLE it_ittext INTO wa_ittext WITH KEY infty = wa_table-infty.

wa_output-itext = wa_ittext-itext.

wa_output-text = wa_ittext-sprsl.

APPEND wa_output TO it_output.

CLEAR wa_output.

ENDLOOP.

  • Calling the ALV screen with custom container

CALL SCREEN 0600.

On this statement double click it takes you to the screen painter SE51.Enter

the attributes

*Create a Custom container and name it CC_CONT and OK code as OK_CODE.

*Save check and Activate the screen painter.

Now a normal screen with number 600 is created which holds the ALV grid. PBO

of the actual screen ,

  • Here we can give a title and customized menus

&----


*& Module STATUS_0600 OUTPUT

&----


  • text

----


MODULE status_0600 OUTPUT.

  • SET PF-STATUS 'xxxxxxxx'.

  • SET TITLEBAR 'xxx'.

ENDMODULE. " STATUS_0600 OUTPUT

  • calling the PBO module ALV_GRID.

&----


*& Module ALV_GRID OUTPUT

&----


  • text

----


MODULE alv_grid OUTPUT.

CREATE OBJECT c_ccont

EXPORTING

container_name = 'CC_CONT'.

CREATE OBJECT c_alvgd

EXPORTING

i_parent = c_ccont.

  • SET field for ALV

PERFORM alv_build_fieldcat.

  • Setting the styles for the ALV grid control

  • using field-symbols

LOOP AT it_fcat ASSIGNING <wa_fcat>.

*For Each and every line of the fieldcat

CASE sy-tabix.

*Color Styles

*Background/Font/Group/positive/negative

WHEN '1'.

<wa_fcat>-style = alv_style_color_inv_positive.

WHEN '2'.

<wa_fcat>-style = alv_style_color_int_negative.

WHEN '3'.

<wa_fcat>-style = alv_style_color_inv_negative.

WHEN '4'.

<wa_fcat>-style = alv_style_color_int_positive.

WHEN '5'.

<wa_fcat>-style = alv_style_color_background.

<wa_fcat>-style = alv_style_color_inv_background.

WHEN '6'.

<wa_fcat>-style = alv_style_color_group.

<wa_fcat>-style = alv_style_color_int_background.

*Style for F4

WHEN '7'.

<wa_fcat>-style = alv_style_f4.

*Style for Alignment(others are also possible)

WHEN '8'.

<wa_fcat>-style = alv_style_align_left_bottom.

*Style for Font Underlined/Bold and Italic are possible

WHEN '9'.

<wa_fcat>-style = alv_style_font_underlined.

*Style for button type

WHEN '10'.

<wa_fcat>-style = alv_style_button.

*Style for Font Symbol

WHEN '11'.

<wa_fcat>-style = alv_style_font_symbol.

*Style for Radiobutton

WHEN '12'.

<wa_fcat>-style = alv_style_radio_checked.

*Style for checkbox

WHEN '13'.

<wa_fcat>-style = alv_style_checkbox_checked.

*Style for column style characteristics(highlighting the col)

WHEN '14'.

<wa_fcat>-style = alv_col_style_characteristic.

*Styles for Enabling the column

WHEN '15'.

<wa_fcat>-style = alv_style_enabled.

ENDCASE.

ENDLOOP.

  • Set ALV attributes FOR LAYOUT

PERFORM alv_report_layout.

CHECK NOT c_alvgd IS INITIAL.

  • Call ALV GRID

CALL METHOD c_alvgd->set_table_for_first_display

EXPORTING

is_layout = it_layout

CHANGING

it_outtab = it_output

it_fieldcatalog = it_fcat

EXCEPTIONS

invalid_parameter_combination = 1

program_error = 2

too_many_lines = 3

OTHERS = 4.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

ENDMODULE. " ALV_GRID OUTPUT

&----


*& Form alv_build_fieldcat

&----


  • text

----


  • <--P_IT_FCAT text

----


*subroutine to build fieldcat

FORM alv_build_fieldcat.

DATA lv_fldcat TYPE lvc_s_fcat.

CLEAR lv_fldcat.

lv_fldcat-row_pos = '1'.

lv_fldcat-col_pos = '1'.

lv_fldcat-fieldname = 'INFTY'.

lv_fldcat-tabname = 'IT_OUTPUT'.

lv_fldcat-outputlen = 8.

lv_fldcat-scrtext_m = 'Infotype'.

lv_fldcat-icon = 'X'.

APPEND lv_fldcat TO it_fcat.

CLEAR lv_fldcat.

lv_fldcat-row_pos = '1'.

lv_fldcat-col_pos = '2'.

lv_fldcat-fieldname = 'PNNNN'.

lv_fldcat-tabname = 'IT_OUTPUT'.

lv_fldcat-outputlen = 15.

lv_fldcat-scrtext_m = 'Structure'.

lv_fldcat-icon = ''.

APPEND lv_fldcat TO it_fcat.

CLEAR lv_fldcat.

lv_fldcat-row_pos = '1'.

lv_fldcat-col_pos = '3'.

lv_fldcat-fieldname = 'ITEXT'.

lv_fldcat-tabname = 'IT_OUTPUT'.

lv_fldcat-outputlen = 60.

lv_fldcat-scrtext_m = 'Description'.

lv_fldcat-icon = ''.

APPEND lv_fldcat TO it_fcat.

CLEAR lv_fldcat.

lv_fldcat-row_pos = '1'.

lv_fldcat-col_pos = '4'.

lv_fldcat-fieldname = 'TEXT'.

lv_fldcat-tabname = 'IT_OUTPUT'.

lv_fldcat-outputlen = 5.

lv_fldcat-scrtext_m = 'General'.

lv_fldcat-icon = ''.

APPEND lv_fldcat TO it_fcat.

CLEAR lv_fldcat.

lv_fldcat-row_pos = '1'.

lv_fldcat-col_pos = '5'.

lv_fldcat-fieldname = 'ZRMKZ'.

lv_fldcat-tabname = 'IT_OUTPUT'.

lv_fldcat-outputlen = 1.

lv_fldcat-scrtext_m = 'PERIOD'.

lv_fldcat-icon = ''.

APPEND lv_fldcat TO it_fcat.

CLEAR lv_fldcat.

lv_fldcat-row_pos = '1'.

lv_fldcat-col_pos = '6'.

lv_fldcat-fieldname = 'ZEITB'.

lv_fldcat-tabname = 'IT_OUTPUT'.

lv_fldcat-outputlen = 60.

lv_fldcat-scrtext_m = 'Time constraint'.

lv_fldcat-icon = ''.

APPEND lv_fldcat TO it_fcat.

CLEAR lv_fldcat.

lv_fldcat-row_pos = '1'.

lv_fldcat-col_pos = '7'.

lv_fldcat-fieldname = 'DNAME'.

lv_fldcat-tabname = 'IT_OUTPUT'.

lv_fldcat-outputlen = 15.

lv_fldcat-scrtext_m = 'Dialogmodule'.

lv_fldcat-icon = ''.

APPEND lv_fldcat TO it_fcat.

CLEAR lv_fldcat.

lv_fldcat-row_pos = '1'.

lv_fldcat-col_pos = '8'.

lv_fldcat-fieldname = 'EDYNR'.

lv_fldcat-tabname = 'IT_OUTPUT'.

lv_fldcat-outputlen = 10.

lv_fldcat-scrtext_m = 'Single screenno'.

lv_fldcat-icon = ''.

APPEND lv_fldcat TO it_fcat.

CLEAR lv_fldcat.

lv_fldcat-row_pos = '1'.

lv_fldcat-col_pos = '9'.

lv_fldcat-fieldname = 'LDYNR'.

lv_fldcat-tabname = 'IT_OUTPUT'.

lv_fldcat-outputlen = 10.

lv_fldcat-scrtext_m = 'List screenno'.

lv_fldcat-icon = ''.

APPEND lv_fldcat TO it_fcat.

CLEAR lv_fldcat.

lv_fldcat-row_pos = '1'.

lv_fldcat-col_pos = '10'.

lv_fldcat-fieldname = 'STYPT'.

lv_fldcat-tabname = 'IT_OUTPUT'.

lv_fldcat-outputlen = 10.

lv_fldcat-scrtext_m = 'SubtypeTable'.

lv_fldcat-icon = ''.

APPEND lv_fldcat TO it_fcat.

CLEAR lv_fldcat.

lv_fldcat-row_pos = '1'.

lv_fldcat-col_pos = '11'.

lv_fldcat-fieldname = 'SYTXT'.

lv_fldcat-tabname = 'IT_OUTPUT'.

lv_fldcat-outputlen = 10.

lv_fldcat-scrtext_m = 'Font Symbol'.

lv_fldcat-icon = ''.

APPEND lv_fldcat TO it_fcat.

CLEAR lv_fldcat.

lv_fldcat-row_pos = '1'.

lv_fldcat-col_pos = '12'.

lv_fldcat-fieldname = 'SRADIO'.

lv_fldcat-tabname = 'IT_OUTPUT'.

lv_fldcat-outputlen = 10.

lv_fldcat-scrtext_m = 'RADIO'.

lv_fldcat-icon = ''.

APPEND lv_fldcat TO it_fcat.

CLEAR lv_fldcat.

lv_fldcat-row_pos = '1'.

lv_fldcat-col_pos = '13'.

lv_fldcat-fieldname = 'SCHECK'.

lv_fldcat-tabname = 'IT_OUTPUT'.

lv_fldcat-outputlen = 10.

lv_fldcat-scrtext_m = 'CHECK'.

lv_fldcat-icon = ''.

APPEND lv_fldcat TO it_fcat.

CLEAR lv_fldcat.

lv_fldcat-row_pos = '1'.

lv_fldcat-col_pos = '14'.

lv_fldcat-fieldname = 'DAVO'.

lv_fldcat-tabname = 'IT_OUTPUT'.

lv_fldcat-outputlen = 10.

lv_fldcat-scrtext_m = 'Start Date'.

lv_fldcat-icon = ''.

APPEND lv_fldcat TO it_fcat.

CLEAR lv_fldcat.

lv_fldcat-row_pos = '1'.

lv_fldcat-col_pos = '15'.

lv_fldcat-fieldname = 'DAVOE'.

lv_fldcat-tabname = 'IT_OUTPUT'.

lv_fldcat-outputlen = 10.

lv_fldcat-scrtext_m = 'End date'.

lv_fldcat-icon = ''.

APPEND lv_fldcat TO it_fcat.

CLEAR lv_fldcat.

ENDFORM. " alv_build_fieldcat

&----


*& Form alv_report_layout

&----


  • text

----


  • <--P_IT_LAYOUT text

----


*Subroutine for setting alv layout

FORM alv_report_layout.

it_layout-cwidth_opt = 'X'.

it_layout-zebra = 'X'.

it_layout-col_opt = 'X'.

ENDFORM. " alv_report_layout

  • PAI module of the screen created. In case we use an interactive ALV or

*for additional functionalities we can create OK codes

*and based on the user command we can do the coding.

&----


*& Module USER_COMMAND_0600 INPUT

&----


  • text

----


MODULE user_command_0600 INPUT.

ENDMODULE. " USER_COMMAND_0600 INPUT

Output

Part 1

Former Member
0 Kudos

Hi,

Have a look on the following code,it will display the each row in a color.

TABLES VBAK.

TYPE-POOLS SLIS.

  • Data Declaration

TYPES: BEGIN OF T_VBAK,

VBELN TYPE VBAK-VBELN,

ERDAT TYPE VBAK-ERDAT,

ERNAM TYPE VBAK-ERNAM,

AUDAT TYPE VBAK-AUDAT,

VBTYP TYPE VBAK-VBTYP,

NETWR TYPE VBAK-NETWR,

VKORG TYPE VBAK-VKORG,

VKGRP TYPE VBAK-VKGRP,

LINE_COLOR(4) TYPE C,

END OF T_VBAK.

DATA: IT_VBAK TYPE STANDARD TABLE OF T_VBAK INITIAL SIZE 0,

WA_VBAK TYPE T_VBAK.

  • ALV Data Declaration

DATA: FLDCAT TYPE SLIS_T_FIELDCAT_ALV WITH HEADER LINE,

GD_LAYOUT TYPE SLIS_LAYOUT_ALV,

GD_REPID TYPE SY-REPID.

START-OF-SELECTION.

PERFORM DATA_RETRIEVAL.

PERFORM BLD_FLDCAT.

PERFORM BLD_LAYOUT.

PERFORM DISPLAY_ALV_REPORT.

  • Build Field Catalog for ALV Report

FORM BLD_FLDCAT.

FLDCAT-FIELDNAME = 'VBELN'.

FLDCAT-SELTEXT_M = 'Sales Document'.

FLDCAT-COL_POS = 0.

*FLDCAT-EMPHASIZE = 'C411'.

FLDCAT-OUTPUTLEN = 20.

FLDCAT-KEY = 'X'.

APPEND FLDCAT TO FLDCAT.

CLEAR FLDCAT.

FLDCAT-FIELDNAME = 'ERDAT'.

FLDCAT-SELTEXT_L = 'Record Date created'.

FLDCAT-COL_POS = 1.

FLDCAT-KEY = 'X'.

APPEND FLDCAT TO FLDCAT.

CLEAR FLDCAT.

FLDCAT-FIELDNAME = 'ERNAM'.

FLDCAT-SELTEXT_L = 'Cteated Object Person Name'.

APPEND FLDCAT TO FLDCAT.

CLEAR FLDCAT.

FLDCAT-FIELDNAME = 'AUDAT'.

FLDCAT-SELTEXT_M = 'Document Date'.

FLDCAT-COL_POS = 3.

FLDCAT-EMPHASIZE = 'C110'.

APPEND FLDCAT TO FLDCAT.

CLEAR FLDCAT.

FLDCAT-FIELDNAME = 'VBTYP'.

FLDCAT-SELTEXT_L = 'SD Document category'.

FLDCAT-COL_POS = 4.

APPEND FLDCAT TO FLDCAT.

CLEAR FLDCAT.

FLDCAT-FIELDNAME = 'NETWR'.

FLDCAT-SELTEXT_L = 'Net Value of the SO in Document Currency'.

FLDCAT-COL_POS = 5.

FLDCAT-OUTPUTLEN = 60.

FLDCAT-DO_SUM = 'X'.

FLDCAT-DATATYPE = 'CURR'.

APPEND FLDCAT TO FLDCAT.

CLEAR FLDCAT.

FLDCAT-FIELDNAME = 'VKORG'.

FLDCAT-SELTEXT_L = 'Sales Organization'.

FLDCAT-COL_POS = 6.

APPEND FLDCAT TO FLDCAT.

CLEAR FLDCAT.

FLDCAT-FIELDNAME = 'VKGRP'.

FLDCAT-SELTEXT_M = 'Sales Group'.

FLDCAT-COL_POS = 7.

FLDCAT-EMPHASIZE = 'C801'.

APPEND FLDCAT TO FLDCAT.

CLEAR FLDCAT.

ENDFORM.

  • Build Layout for ALV Grid Report

FORM BLD_LAYOUT.

GD_LAYOUT-NO_INPUT = 'X'.

GD_LAYOUT-COLWIDTH_OPTIMIZE = 'X'.

GD_LAYOUT-INFO_FIELDNAME = 'LINE_COLOR'.

GD_LAYOUT-WINDOW_TITLEBAR = 'GRID DISPLAY'.

GD_LAYOUT-CONFIRMATION_PROMPT = 'X'. “ This asks the confirmation before leaving the screen.

ENDFORM.

  • Display report using ALV grid

FORM DISPLAY_ALV_REPORT.

GD_REPID = SY-REPID.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

I_CALLBACK_PROGRAM = GD_REPID

IS_LAYOUT = GD_LAYOUT

I_CALLBACK_TOP_OF_PAGE = 'TOP_OF_PAGE'

I_GRID_TITLE = 'SALES DOCUMENT HEADER'

IT_FIELDCAT = FLDCAT[]

I_SAVE = 'X'

TABLES

T_OUTTAB = IT_VBAK

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.

ENDFORM.

  • Retrieve data from VBAK table and populate itab IT_VBAK

FORM DATA_RETRIEVAL.

DATA LD_COLOR(1) TYPE C.

SELECT VBELN ERDAT ERNAM AUDAT VBTYP NETWR VKORG

UP TO 20 ROWS

FROM VBAK

INTO TABLE IT_VBAK.

LOOP AT IT_VBAK INTO WA_VBAK.

LD_COLOR = LD_COLOR + 1.

IF LD_COLOR = 8.

LD_COLOR = 1.

ENDIF.

CONCATENATE 'C' LD_COLOR '10' INTO WA_VBAK-LINE_COLOR.

MODIFY IT_VBAK FROM WA_VBAK.

ENDLOOP.

ENDFORM.

FORM TOP_OF_PAGE.

DATA: T_HEADER TYPE SLIS_T_LISTHEADER,

W_HEADER TYPE SLIS_LISTHEADER.

W_HEADER-TYP = 'H'.

W_HEADER-INFO = 'WELCOME HEADER LIST'.

APPEND W_HEADER TO T_HEADER.

W_HEADER-TYP = 'S'.

W_HEADER-KEY = 'REPORT:'.

W_HEADER-INFO = SY-REPID.

APPEND W_HEADER TO T_HEADER.

W_HEADER-TYP = 'S'.

W_HEADER-KEY = 'DATE:'.

CONCATENATE SY-DATUM6(2) ' / ' SY-DATUM4(2) ' / ' SY-DATUM(4) INTO W_HEADER-INFO.

APPEND W_HEADER TO T_HEADER.

CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

EXPORTING

IT_LIST_COMMENTARY = T_HEADER.

ENDFORM.

2.To remove the leading zero's use search for layout options.

Reward,if useful.

thanks,

Chandu

Former Member
0 Kudos

hi,

In the CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

in EXPORTING there is a structure called

is_layout = int_layout

declare it as

DATA : int_layout TYPE slis_layout_alv.

modify the value of field zebra and paas it to FM

int_layout-zebra = 'X'

reward points if useful

Former Member
0 Kudos

hi for truncating the zeros you can use this..

it_fielcdcat-no-zero = 'X'.

hi check this example for the color for every row in the alv..

http://sapprograms.blogspot.com/2008/04/repeating-colors.html

or use the program for the 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.

regards,

venkat.