Skip to Content
0
Aug 03, 2006 at 06:02 AM

Entering data into a dynamically created table.

243 Views

Hi,

I have to create an alv whose field catalog is created dynamically through a few tables(that also determined at run time).

Now I need to populate this dynamically created table with values from the tables(that are also dynamically determined).

But the issue is that I cannot use into-corresponding

or appending-corresponing.

Below is a sample code...

<i> CALL METHOD cl_alv_table_create=>create_dynamic_table

EXPORTING

it_fieldcatalog = li_fieldcat

IMPORTING

ep_table = lt_table.

ASSIGN lt_table->* TO <lt_tab1>.

LOOP AT li_report_tab_kum INTO lwa_tmp_tab.

SELECT SINGLE kotab

FROM t681

INTO lv_table

WHERE kvewe = 'E'

and kotabnr = lwa_tmp_tab-kotabnr.

SELECT *

FROM (lv_table)

INTO CORRESPONDING FIELDS OF TABLE <lt_tab1>

WHERE kappl = 'V'

AND kschl = lwa_tmp_tab-kschl

AND knuma = lwa_tmp_tab-knuma.

ENDLOOP.

CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'

EXPORTING

i_callback_program = sy-cprog

i_callback_user_command = 'USER_COMMAND'

it_fieldcat = li_fieldcatalog

is_layout = gs_layout

  • it_events = lt_events

  • it_sort = li_sort

TABLES

t_outtab = <lt_tab1>.</i>

Pls let me know a way out of this.

Thanks in advance.