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: 

internal tables

Former Member
0 Kudos

Hi all,

there is an internal table itab1 without headerline.

Now i selected data in to that.

if suppose matnr is field in that.

Now i want to select the data for other internal table by using FOR ALL ENTRIES in itab.

select matnr maktx

from makt

into table itab2

for all entries in itab1

where matnr = itab1-matnr.

please tell me above query is right or wrong because we are using for all entries to the table which has no header line.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hello ,

Ur coding is correct.

When using for all entries no need to consider whether the table is having header line or not.

Vasanth

6 REPLIES 6

Former Member
0 Kudos

Hello ,

Ur coding is correct.

When using for all entries no need to consider whether the table is having header line or not.

Vasanth

Former Member
0 Kudos

Its ok. Check for not initial of itab before query.

<b>IF NOT ITAB[] IS INITIAL.</b>

select matnr maktx

from makt

into table itab2

for all entries in itab1

where matnr = itab1-matnr.

<b>ENDIF.</b>

Thanks,

Santosh

Former Member
0 Kudos

Hi,

Before using for all entries pl make sure the itab1 is not empty.

Cheers.

Former Member
0 Kudos

Hi

It's right FOR ALL ENTRIES option doesn't need a table with header line, you only check if the table has some hits:

if not itab1[] is initial.

select matnr maktx

from makt

into table itab2

for all entries in itab1

where matnr = itab1-matnr.

endif.

Because if itab1 is empty the select'll get all records of MAKT.

Max

Former Member
0 Kudos

thanks to all

abhishek_gupta2
Participant
0 Kudos

Hi ,

yes ur query is correct ,

but this will give a error if the itab1 is empty .

so , it is good idea to use if not itab[] is initail.

cheers ,

abhishek