2022 Nov 26 5:52 AM
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
2022 Nov 26 6:27 AM
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.
2022 Nov 26 8:05 AM
Please edit your answer, select your code and click the button CODE so that it's nicely displayed and people can read it easily.
2022 Nov 26 8:05 AM
Please edit your question, select your code and click the button CODE so that it's nicely displayed and people can read it easily.