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: 

How to solve this error?

uzair_1234
Explorer
0 Kudos
571

Hi,

I have added this select query in my report:

select matnr
aufnr
from mseg
client specified into table it_mseg2
where matnr eq it_mseg-matnr and
charg eq it_mseg-charg and
werks eq it_mseg-werks and
bwart in ('262').

I am getting an error that says "IT_MSEG" is a table without a header line and therefore has no component called MATNR"

I have declared the internal table and the structure as MSEG2. Also, the report already has two select queries of MSEG. Please suggest a solution

Warm Regards,

Uzair

3 REPLIES 3

sagarprusty1988
Explorer
462

1. If you are referring to any table then for all entries is needed.

2. For best performance use joins instead of multiple selection referring to the foreign key.

If still want to use it then go for below SELECT query with initial check to IT_MSEG and use FOR ALL ENTRIES

select matnr
aufnr
from mseg
client specified into table it_mseg2
FOR ALL ENTRIES IN it_mseg
where matnr eq it_mseg-matnr and
charg eq it_mseg-charg and
werks eq it_mseg-werks and
bwart in ('262')

USING HEADER table is obsolete. Do avoid.

You can use STANDARD, SORTED and HASHED table. Best is SORTED and HASHED.

Why MSEG is selected multiple time. The Material document table has huge data and create performance issue. Better to get all the data at once.

Try to find standard I_* CDS view for the data selection. The data fetch will be faster. Best for S4 HANA system.

462

Please edit your answer, select your code and click the button CODE so that it's nicely displayed and people can read it easily.

Sandra_Rossi
Active Contributor
0 Kudos
462

Please edit your question, select your code and click the button CODE so that it's nicely displayed and people can read it easily.