Application Development 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: 

Dynamic create table problem

Former Member
0 Kudos
52

Hello Friends,

I have created a Dynamic internal table from the table passed on the selection screen Everythign works good but when I do a select Querry, or UPdate or Insert on this table it fails. Some memory Issue.

Below is the code I am using. I am working on 4.6C


DATA : i_fcat         TYPE STANDARD TABLE OF lvc_s_fcat.
DATA: i_table_data1  TYPE REF TO data.

FIELD-SYMBOLS: <f_table_data1>     TYPE STANDARD TABLE.

PARAMETERS: p_table TYPE tabname OBLIGATORY.

  CLEAR   i_fcat.
  REFRESH i_fcat.

  CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
       EXPORTING
            i_structure_name = p_table  " Table Name "MARA
       CHANGING
            ct_fieldcat      = i_fcat
       EXCEPTIONS
            OTHERS           = 1.

  CALL METHOD cl_alv_table_create=>create_dynamic_table
    EXPORTING
      it_fieldcatalog = i_fcat
    IMPORTING
      ep_table        = i_table_data1.
  IF sy-subrc = 0.
    ASSIGN i_table_data1->* TO <f_table_data1>.
  ELSE.
    WRITE: 'Error creating internal table'.
  ENDIF.

*Get DATA
SELECT * FROM (p_table) INTO TABLE <f_table_data1>.

The above select Querry fails because the table <f_table_data1> is created with 804 bytes for P-table as MARA..


Data : t_mara like mara occurs 0 with header line.
the above internal table T_mara is created with 806 Bytes.

My question is when we create an Internal dynamically why is created with 804 Bytes instead of 806 bytes.

Because of this memory mismatch all mt select, Update Insert statements are failing.

Any Suggestions,

Ster.

2 REPLIES 2

Former Member

0 Kudos
32

Hi,

Just try with

INTO CORRESPONDING FIELDS OF TABLE instead of into TABLE.

Regards,

Subramanian