2008 Jul 01 1:28 PM
2008 Jul 01 1:36 PM
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
what is dynamic table?
2008 Jul 01 1:31 PM
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.
2008 Jul 01 1:33 PM
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
2008 Jul 01 1:36 PM
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
2008 Jul 01 1:37 PM
2008 Jul 01 2:03 PM
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |