Skip to Content
0
Former Member
Jul 14, 2008 at 03:49 PM

Dynamic create table problem

20 Views

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.