cancel
Showing results for 
Search instead for 
Did you mean: 

Help needed in coding

0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

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

Answers (1)

Answers (1)

Former Member
0 Kudos

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.