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

internal tables

Former Member
0 Likes
750

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
Read only

Former Member
0 Likes
729

Hello ,

Ur coding is correct.

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

Vasanth

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.

6 REPLIES 6
Read only

Former Member
0 Likes
730

Hello ,

Ur coding is correct.

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

Vasanth

Read only

Former Member
0 Likes
729

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

Read only

Former Member
0 Likes
729

Hi,

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

Cheers.

Read only

Former Member
0 Likes
729

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

Read only

Former Member
0 Likes
729

thanks to all

Read only

Former Member
0 Likes
729

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