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

Dynamic create table problem

Former Member
0 Likes
704

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.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
673

Hi,

In your last thread Sujamol Augustine replied to your message regarding the dynamic internal table for MARA. Did you try that..please let us know..

Thanks

Naren

5 REPLIES 5
Read only

former_member194669
Active Contributor
0 Likes
673

Try to change


SELECT * FROM (p_table) INTO corresponding fields of TABLE <f_table_data1>.

Its working fine for me

a®

Read only

0 Likes
673

Thanks ARS.

IF I put in the Select Corresponding It works fine for me.

Not an Issue but however my Update and insert statements are failing.

UPDATE (p_table) FROM TABLE <f_table_data1>.

or problem with

INSERT (p_table) FROM TABLE <f_table_data1>.

The above statement is failing.

Thanks,

Ster.

Read only

Former Member
0 Likes
674

Hi,

In your last thread Sujamol Augustine replied to your message regarding the dynamic internal table for MARA. Did you try that..please let us know..

Thanks

Naren

Read only

0 Likes
673

Thanks Buddy.

Ster

Read only

0 Likes
673

You probably already know it, but just in case you don't, you definitely shouldn't do direct INSERTs or UPDATEs on standard tables like MARA.

Regards