Application Development and Automation 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: 
Read only

what is dynamic table?

Former Member
0 Likes
923

what is dynamic table?

1 ACCEPTED SOLUTION
Read only

sachin_mathapati
Contributor
0 Likes
890

Hi Vinay,

Dynamic table are those whose fields are decided at RUNTIME based on the requirement.

Check this code where we have created a Dynamic Internal table for uploading DATA from Application server.

*----


  • Get the structure of the table.

*----


ref_table_des ?=

cl_abap_typedescr=>describe_by_name( wa_file-file_structure ).

tb_details = ref_table_des->components[].

LOOP AT tb_details INTO wa_details.

CLEAR wa_fieldcat.

wa_fieldcat-fieldname = wa_details-name .

wa_fieldcat-datatype = wa_details-type_kind.

wa_fieldcat-inttype = wa_details-type_kind.

wa_fieldcat-intlen = wa_details-length.

wa_fieldcat-decimals = wa_details-decimals.

APPEND wa_fieldcat TO tb_fieldcat.

ENDLOOP.

  • Create the dynamic table and assign to FS

CALL METHOD cl_alv_table_create=>create_dynamic_table

EXPORTING

it_fieldcatalog = tb_fieldcat

IMPORTING

ep_table = tb_dynamic.

ASSIGN tb_dynamic->* TO <dyn_table>.

  • Create dynamic work area and assign to FS

CREATE DATA wa_line LIKE LINE OF <dyn_table>.

ASSIGN wa_line->* TO <dyn_wa>.

Regards,

Sachin M M

Hi Vinay,

Dynamic table are those whose fields are decided at RUNTIME based on the requirement.

Check this code where we have created a Dynamic Internal table for uploading DATA from Application server.

*----


  • Get the structure of the table.

*----


ref_table_des ?=

cl_abap_typedescr=>describe_by_name( wa_file-file_structure ).

tb_details = ref_table_des->components[].

LOOP AT tb_details INTO wa_details.

CLEAR wa_fieldcat.

wa_fieldcat-fieldname = wa_details-name .

wa_fieldcat-datatype = wa_details-type_kind.

wa_fieldcat-inttype = wa_details-type_kind.

wa_fieldcat-intlen = wa_details-length.

wa_fieldcat-decimals = wa_details-decimals.

APPEND wa_fieldcat TO tb_fieldcat.

ENDLOOP.

  • Create the dynamic table and assign to FS

CALL METHOD cl_alv_table_create=>create_dynamic_table

EXPORTING

it_fieldcatalog = tb_fieldcat

IMPORTING

ep_table = tb_dynamic.

ASSIGN tb_dynamic->* TO <dyn_table>.

  • Create dynamic work area and assign to FS

CREATE DATA wa_line LIKE LINE OF <dyn_table>.

ASSIGN wa_line->* TO <dyn_wa>.

Regards,

Sachin M M

5 REPLIES 5
Read only

Former Member
0 Likes
890

Hi Vinay,

Dynamic table is a kind of internal table that is populated on runtime.

You decide on runtime, what all fields you want in your internal table.

FIELD-SYMBOLS are used to create such an internal table.

Regards,

Nitin.

Read only

Former Member
0 Likes
890

Hi,

In a dynamic table the table "coloums" will be determined during the run time.

Sometime they may be a requirement where based on certain conditionds the table field to be displayed in such case dynamic tables are used.

Regards,

Jaya Vani

Read only

sachin_mathapati
Contributor
0 Likes
891

Hi Vinay,

Dynamic table are those whose fields are decided at RUNTIME based on the requirement.

Check this code where we have created a Dynamic Internal table for uploading DATA from Application server.

*----


  • Get the structure of the table.

*----


ref_table_des ?=

cl_abap_typedescr=>describe_by_name( wa_file-file_structure ).

tb_details = ref_table_des->components[].

LOOP AT tb_details INTO wa_details.

CLEAR wa_fieldcat.

wa_fieldcat-fieldname = wa_details-name .

wa_fieldcat-datatype = wa_details-type_kind.

wa_fieldcat-inttype = wa_details-type_kind.

wa_fieldcat-intlen = wa_details-length.

wa_fieldcat-decimals = wa_details-decimals.

APPEND wa_fieldcat TO tb_fieldcat.

ENDLOOP.

  • Create the dynamic table and assign to FS

CALL METHOD cl_alv_table_create=>create_dynamic_table

EXPORTING

it_fieldcatalog = tb_fieldcat

IMPORTING

ep_table = tb_dynamic.

ASSIGN tb_dynamic->* TO <dyn_table>.

  • Create dynamic work area and assign to FS

CREATE DATA wa_line LIKE LINE OF <dyn_table>.

ASSIGN wa_line->* TO <dyn_wa>.

Regards,

Sachin M M

Read only

Former Member
0 Likes
890

Hi,

Chk the link...

Regards.

Read only

Former Member
0 Likes
890

Hi vinay,

There is a good webblogs reg ur issue. Have a look into it.

Regards

Nani