Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Dyanamic selection screen


I have a Ztable created my program should create a dynamic selection screen depending on tht ztable

can you suggest me a solutin for this


Former Member
Former Member replied


Use this code

type-pools : abap.

field-symbols: <dyn_table> type standard table,



data: dy_table type ref to data,

dy_line type ref to data,

xfc type lvc_s_fcat,

ifc type lvc_t_fcat.

selection-screen begin of block b1 with frame.

parameters: p_table(30) type c default 'T001'.

selection-screen end of block b1.


perform get_structure.

perform create_dynamic_itab. *********Creates a dyanamic internal table*********

form get_structure.

data : idetails type abap_compdescr_tab,

xdetails type abap_compdescr.

data : ref_table_des type ref to cl_abap_structdescr.

  • Get the structure of the table.

ref_table_des ?=

cl_abap_typedescr=>describe_by_name( p_table ).

idetails[] = ref_table_des->components[].

loop at idetails into xdetails.

clear xfc.

xfc-fieldname = xdetails-name .

xfc-datatype = xdetails-type_kind.

xfc-inttype = xdetails-type_kind.

xfc-intlen = xdetails-length.

xfc-decimals = xdetails-decimals.

append xfc to ifc.



form create_dynamic_itab.

  • Create dynamic internal table and assign to FS

call method cl_alv_table_create=>create_dynamic_table


it_fieldcatalog = ifc


ep_table = dy_table.

assign dy_table->* to <dyn_table>.

  • Create dynamic work area and assign to FS

create data dy_line like line of <dyn_table>.

assign dy_line->* to <dyn_wa>.



0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question