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

create_dynamic_table and field type QUAN

former_member498918
Participant
0 Likes
956

I have written some code to update various table fields via a dynamic list stating the table and field name.

I'm using create_dynamic_table and create data new_line like line of <dyn_table>

This is working fine except when there is a QUAN type field in the table. Then I get a dump saying SAPSQL_WA_TOO_SMALL.

It is definitely the QUAN field which is causing the problem because I changed this to a CHAR field in the test system and the code updated the table no problem. When I change the field back to QUAN it dumps.

Any ideas what is casuing this problem and how I can get around it.

Thank you

Karen

1 ACCEPTED SOLUTION
Read only

Subhankar
Active Contributor
0 Likes
816

Hi,

You have table name and field name. Then you can go for the easiest way. No need to go for create_dynamic_table.

Check the sample code.

DATA: l_tabname TYPE tabname VALUE 'MARA',

l_fieldname TYPE char30 VALUE 'MATNR',

l_value TYPE char10 VALUE '123',

l_ref_data TYPE REF TO data.

FIELD-SYMBOLS: <i_tab> TYPE ANY TABLE,

<wa> TYPE ANY,

<fs> TYPE ANY.

CREATE DATA l_ref_data TYPE STANDARD TABLE OF (l_tabname).

ASSIGN l_ref_data->* TO <i_tab>.

CREATE DATA l_ref_data LIKE LINE OF <i_tab>.

ASSIGN l_ref_data->* TO <wa>.

ASSIGN COMPONENT l_fieldname OF STRUCTURE <wa> TO <fs>.

<fs> = l_value.

APPEND <WA> to <i_TAB>.

Thanks

Subhankar

I have written some code to update various table fields via a dynamic list stating the table and field name.

I'm using create_dynamic_table and create data new_line like line of <dyn_table>

This is working fine except when there is a QUAN type field in the table. Then I get a dump saying SAPSQL_WA_TOO_SMALL.

It is definitely the QUAN field which is causing the problem because I changed this to a CHAR field in the test system and the code updated the table no problem. When I change the field back to QUAN it dumps.

Any ideas what is casuing this problem and how I can get around it.

Thank you

Karen

3 REPLIES 3
Read only

Subhankar
Active Contributor
0 Likes
817

Hi,

You have table name and field name. Then you can go for the easiest way. No need to go for create_dynamic_table.

Check the sample code.

DATA: l_tabname TYPE tabname VALUE 'MARA',

l_fieldname TYPE char30 VALUE 'MATNR',

l_value TYPE char10 VALUE '123',

l_ref_data TYPE REF TO data.

FIELD-SYMBOLS: <i_tab> TYPE ANY TABLE,

<wa> TYPE ANY,

<fs> TYPE ANY.

CREATE DATA l_ref_data TYPE STANDARD TABLE OF (l_tabname).

ASSIGN l_ref_data->* TO <i_tab>.

CREATE DATA l_ref_data LIKE LINE OF <i_tab>.

ASSIGN l_ref_data->* TO <wa>.

ASSIGN COMPONENT l_fieldname OF STRUCTURE <wa> TO <fs>.

<fs> = l_value.

APPEND <WA> to <i_TAB>.

Thanks

Subhankar

Read only

0 Likes
816

Using

CREATE DATA l_ref_data TYPE STANDARD TABLE OF (l_tabname).

ASSIGN l_ref_data->* TO <i_tab>.

rather than create_dynamic_table fixed the problem.

Thank you for your help.

Karen

Read only

Clemenss
Active Contributor
0 Likes
816

Hi Karen,

1. do not use cl_alv_table_create=>create_dynamic_table. It triggers unwanted database commit an is obsolete since we have RTTS run Time Type Services. Check [Creating Flat and Complex Internal Tables Dynamically using RTTI|http://wiki.sdn.sap.com/wiki/display/Snippets/CreatingFlatandComplexInternalTablesDynamicallyusingRTTI]

2. I do not believe that the error is related to quantity field.

Please let us know at point exactly the dump occurs, what is the exact error message with message number and message class and post the code section where the dump occurs (see in short dump!).

without this information all replies are 105 % speculation.

Regards,

Clemens