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: 

Creation of Table type with out using structure

former_member450029
Participant
0 Kudos

Hi experts,

I want to create a table type with single field and without referring to the structure at DB level.

Can I refer to any data element, If this is possible how to use this Table type.

I have created a table type by referring to Data element but not able to use it.

For example..

ztt_mattnr is a table type which is referring to matnr.

When I am trying to use it for For all entries it is throwing me an error.

     data it_mara type ztt_mattnr.

     SELECT * FROM mara INTO TABLE lt_mara

              FOR ALL ENTRIES IN it_mara

              WHERE matnr = it_mara-matnr.


How to overcome this ?

BR,

Eshwar

1 ACCEPTED SOLUTION

former_member200338
Active Contributor
0 Kudos

use below code.

SELECT * FROM mara

        INTO TABLE lt_mara

         FOR ALL ENTRIES IN lt_matnr

         WHERE matnr = lt_matnr-table_line.

2 REPLIES 2

former_member200338
Active Contributor
0 Kudos

use below code.

SELECT * FROM mara

        INTO TABLE lt_mara

         FOR ALL ENTRIES IN lt_matnr

         WHERE matnr = lt_matnr-table_line.

former_member226225
Contributor
0 Kudos

Hi Eshwar,

You Can create table type as Range Table type  ZTEST_RTB and give data Data Element as MATNR and give Structured Row Type ZTEST_STC and click on create and activate the range table type .

make the changes of the above select query with

DATA : r_matnr TYPE ZTEST_RTB.

DATA : lt_mara TYPE TABLE OF mara.

SELECT * FROM mara INTO TABLE lt_mara

                        WHERE matnr  in r_matnr.

I hope this will be helpful.

Thanks & Regards,

Raghunadh Kodali