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

Query regarding a method

Former Member
0 Likes
512

Hi all,

I am creating a dynamic internal table using methods.

I have used a method

<b>ref_table_des ?=

cl_abap_typedescr=>describe_by_name( p_table ).

idetails[] = ref_table_des->components[].</b>

where p_table is name of my parameter to capture the table name.

the problem i am facing is that this method creates a structure similar to my table, but it doubles the length of each field in the new structure created.

what can be the possible reasons/bugs?

Kindly help.

Points will be rewarded for useful answers.

Regards,

Ravish Garg

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
491

Hi,

I dont think their's any problem in it but try if this works.

ref_table_des ?=

cl_abap_typedescr=>describe_by_name( p_table[] ).

idetails[] = ref_table_des->components[].

Regards,

Ameet

3 REPLIES 3
Read only

Former Member
0 Likes
491

check the following.. by this way you can create dynamic internal table..

  • for dynamic tables .................

DATA: l_d_tab_ref TYPE REF TO data,

l_d_str_ref TYPE REF TO data.

CALL METHOD cl_alv_table_create=>create_dynamic_table

EXPORTING

I_STYLE_TABLE = ' TABLE_NAME' " table name

IMPORTING

ep_table = l_d_tab_ref.

ASSIGN l_d_tab_ref->* TO <fs_alv_tab> .

CREATE DATA l_d_str_ref LIKE LINE OF <fs_alv_tab>.

ASSIGN l_d_str_ref->* TO <fs_alv_str> .

reward if usefull...

Read only

0 Likes
491

hi i have done this already. the table is being created. The problem is in the field lengths.

Read only

Former Member
0 Likes
492

Hi,

I dont think their's any problem in it but try if this works.

ref_table_des ?=

cl_abap_typedescr=>describe_by_name( p_table[] ).

idetails[] = ref_table_des->components[].

Regards,

Ameet