Skip to Content
0
Former Member
Oct 27, 2005 at 06:41 AM

Dynamic table from an structure

15 Views

Hi,

I want to create one alv grid using function REUSE_ALV_GRID_DISPLAY,for this i have passing the fieldcatalog to slis_t_fieldcat_alv.i have been passing my fieldnames ,and col,sel_text_m to fieldcatalog.instead of passing the fields can we assign fields catalog dynamically from the structure.....i have all the fieldnames in one structure for to be displayed in alv list.

pls read the below for reference....

DATA : BEGIN OF wa_inv,

lifnr LIKE rbkp-lifnr,

belnr LIKE rbkp-belnr,

bldat LIKE rbkp-bldat,

END OF wa_inv.

fieldcatalog-fieldname = 'LIFNR'.

fieldcatalog-seltext_m = 'Vendor'.

fieldcatalog-col_pos = 0.

fieldcatalog-outputlen = 10.

fieldcatalog-sp_group = 'X'.

append fieldcatalog to fieldcatalog.

clear fieldcatalog.

*.....this following part will be avaid ..and it should *..be assigned to dynamically

fieldcatalog-fieldname = 'BELNR'.

fieldcatalog-col_pos = 1.

fieldcatalog-seltext_m = 'Invoice No'.

fieldcatalog-key = 'X'.

append fieldcatalog to fieldcatalog.

clear fieldcatalog.

fieldcatalog-fieldname = 'BLDAT'.

fieldcatalog-seltext_m = 'Invoice Date'.

fieldcatalog-col_pos = 2.

append fieldcatalog to fieldcatalog.

clear fieldcatalog.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

I_CALLBACK_PROGRAM = gd_repid

IS_LAYOUT = gd_layout

IT_FIELDCAT = fieldcatalog[]

Prakash