10-18-2012 9:36 AM
Hi all,
Can we join MCHA and MCHB tables based on matnr,werks,charg?
actually i am using for all entries like below...
SELECT matnr werks charg bwtar
FROM mcha CLIENT SPECIFIED
INTO TABLE it_mcha
FOR ALL ENTRIES IN it_mara
WHERE mandt = sy-mandt
AND matnr = it_mara-matnr
AND werks IN s_werks.
SELECT matnr werks lgort charg clabs cspem
FROM mchb CLIENT SPECIFIED
INTO TABLE it_data
FOR ALL ENTRIES IN it_mcha
WHERE mandt = sy-mandt
AND matnr = it_mcha-matnr
AND werks = it_mcha-werks
AND lgort IN s_lgort
AND charg = it_mcha-charg.
So it is taking lot of time for execution...
Can i use join like this below?
SELECT mchb~matnr
mchb~werks
mchb~lgort
mchb~charg
mchb~clabs
mchb~cspem
mcha~bwtar
INTO TABLE it_data
FROM mchb AS mchb
INNER JOIN mcha AS mcha
ON mcha~matnr EQ mchb~matnr
AND mcha~werks EQ mchb~werks
AND mcha~charg EQ mchb~charg
FOR ALL ENTRIES IN it_mara
WHERE mcha~matnr = it_mara-matnr
AND mcha~werks IN s_werks
AND lgort IN s_lgort.
Please advise me?
Regards
Ram
10-18-2012 9:43 AM
Hi,
As all the three fields of selection were available in mchb you can fetch directly from MCHB
You can remove the batches with stock zero if required and then if some of the
fields were needed from MCHA then go for MCHA by using for all entries in MCHB
so that the execution time will be reduced.
Regards,
Prakash.
10-18-2012 9:54 AM
10-18-2012 10:32 AM
No Problem is facing in joins..
For the performance wise which one is better...and also i want the execution time to come down..
Regards
Ram
10-18-2012 12:58 PM
Why don't you try this yourself and compare the runtimes?
Results can vary greatly based on data present in each system, so you better compare it in your own landscape.
Thomas
10-18-2012 2:29 PM
Hi Thomas,
I used joins instead of FAE.
Retreving data is faster than the FAE.
Thanks to all.
I am closing this thread.
Regards
Ram