2011 Jan 12 4:48 PM
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
2011 Jan 12 5:25 PM
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
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
2011 Jan 12 5:25 PM
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
2011 Jan 13 9:59 AM
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
2011 Jan 12 6:58 PM
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
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |