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

select data into deep internal table

Former Member
0 Likes
2,702

Dear Experts.

I created a dynamiv deep internal table.

while selecting data , into the internal table it is giving a dump. saying that deep structure.

SELECT OBJTY OBJID ARBPL WERKS from crhd

INTO CORRESPONDING FIELDS OF TABLE <f_tab>

where WERKS = pr_werks.

I used the field catalog also.even same error is comming.

how to get data into deep internal table by select statement.

Please help me,

Regards,

Rahul

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,830

Hi,

Make sure that the internal table has the non-flat

line type "v".

Regards,

Shamma

7 REPLIES 7
Read only

Former Member
0 Likes
1,830

HI,

Try creating dynamic internal table like:



Field-symbols: <dyn_table> type standard table,
                             <dyn_wa>   ,
                             <dyn_field>.
  Data: dy_table      type ref to data,
            ifc                  type lvc_t_fcat ,
            xfc                 type lvc_s_fcat ,
           Count             type i          ,
           Count1           type i          ,
           Index              type i          ,
           dy_line           type ref to data.
         Data counter   type i.

  Data: line   type string       ,
            List    like table of line.

  Data: idetails           type abap_compdescr_tab,
               xdetails           type abap_compdescr    .
  Data: ref_table_des type ref to cl_abap_structdescr.

*Looping at field cat internal table to populate another field cat to be passed
* In method used below for creating final dynamic internal table

  Loop at fieldcat into fieldcat1.

    Clear xfc.

       Xfc-fieldname            = fieldcat1-fieldname.
       Xfc-datatype              = fieldcat1-datatype.
       Xfc-intlen                    = fieldcat1-intlen.
     Append xfc            to ifc.
  endloop.
Clear fieldcat1.

*Method called to create dynamic internal table on the basis of field catalog created above
  Call method cl_alv_table_create=>create_dynamic_table
    Exporting
      it_fieldcatalog = ifc                     u201Cfield catalog appended above
    Importing
      ep_table        = dy_table.            u201CDynamic internal table which will be created

  Assign dy_table->* to <dyn_table>.

*Create dynamic work area and assign to FS
  Create data dy_line like line of <dyn_table>.
  Assign dy_line->* to <dyn_wa>.

Then use this dynamic internal table created from above method

in the Select Query.

Hope it helps

Regards

Mansi

Read only

0 Likes
1,830

Hi .Thank you for your replay.

Already I created Dynamic deep internal table, .while getting the data into that itab, I am fasing the problem.

Please give a solution for select statement.

like,

instead of mensioning into corresponding fields of table,

one more method ,

select f1 f2 from ztable into table itab ( f1, f2) where...

I think Like this Syntax , it will work.

Can you please send the corresponding select statement synatx.

Once again thank you,

Regards,

Rahul

Read only

Subhankar
Active Contributor
0 Likes
1,830

Hi Rahul,,

First select the records into an internal table..

Then loop this table and putting records into the deep table by statement Assign Component.

assign component p_fld2 of structure <wa_deep> to <fs_deep>.

<fs_deep> = <fs>. " Here <FS> in the value of the component of deep structure

Thanks

Subhankar

Read only

Former Member
0 Likes
1,830

Hi.

Thank you for your Reply.

Can you Please eloborate of this procedure.

Thanks in advance,

Regards,

Rahul

Read only

Former Member
0 Likes
1,830

hai,

Please refer to the given below link

[https://wiki.sdn.sap.com/wiki/display/ABAP/internal+tables]

Read only

Former Member
0 Likes
1,831

Hi,

Make sure that the internal table has the non-flat

line type "v".

Regards,

Shamma

Read only

Former Member
0 Likes
1,830

Dear Experts,

The Problem solved on my own.

Solution is very Siple,

First get the data into flat itab,

loop on that flat itab.

APPEND INITIAL LINE TO <f_tab>.

endloop.

Thank you Very much for your help.