on 09-14-2011 1:25 AM
Hi Experts,
I have put a select statement in a function module which takes a lot of time to pick the data as it has got some complex selections in it.
Here is the code:
SELECT DOCNUM STATUS CREDAT CRETIM UPDDAT UPDTIM DIRECT IDOCTP MESTYP
FROM EDIDC
INTO CORRESPONDING FIELDS OF TABLE IT_EDIDC
FOR ALL ENTRIES IN IT_DOC
WHERE DOCNUM = IT_DOC-DOC_NUM AND STATUS = '03' OR STATUS = '16'
AND DIRECT = '1' AND IDOCTP = 'SHPMNT05' AND MESTYP = 'SHPADV' OR MESTYP = 'ZDESADV01'.
Can anyone help me how to simplify it and improve the performance there with?
Your help will be highly appreciated.
Thanking you in advance,
With Kind Regards,
Gokulan
Hello,
Limit your select to only Doc number . Then delete the unnecessary records from internal table . Since your EDIDC table may not have all the mentioned fields in the where clause in the primary key , the system generates multiple select querys with joins.
If possible get basis to generate a secondary index on this table with your required fields.
Hope this helps.
Thanks,
VSK
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Using the select statement with CORRESPONDING FIELDS will take more time in data fetching, rather you should design your internal table IT_EDIC using type statement and then put the sequence of fields same as that you have maintained in SELECT statement,
So your final statement should be like below,
begin of types: t_edidc,
docnum type docnum,
......
end of types t_edidc.
Data: IT_EDIDC type standard table of t_edidc.
SELECT DOCNUM STATUS CREDAT CRETIM UPDDAT UPDTIM DIRECT IDOCTP MESTYP
FROM EDIDC
INTO table IT_EDIDC
FOR ALL ENTRIES IN IT_DOC
WHERE DOCNUM = IT_DOC-DOC_NUM AND STATUS = '03' OR STATUS = '16'
AND DIRECT = '1' AND IDOCTP = 'SHPMNT05' AND MESTYP = 'SHPADV' OR MESTYP = 'ZDESADV01'.
Regards,
Durgesh.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.