Showing results for 
Search instead for 
Did you mean: 

For All entries in

0 Kudos

Dear Abapers,

I want to get all the records from COEP table on the basis of record selected from AFPO table. Its very very slow , some times SAP Clicked out from the report. Pl. help.

In AFPO -> AUFNR field links to OBJNR field for that I have to Pass OR+Aufnr for check.



Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

The reason for the poor performance of your COEP select is that you are not supplying sufficient fields for it to use an existing index or the table key, and therefore the database will be performing a table scan for each record.

To read COEP based on OBJNR you need to select with LEDNR and OBJNR supplied in your WHERE block. You will most likely find that LEDNR has a fixed value (probably '00') - specifying this as well as the OBJNR will speed up the select.

Looking at COEP inxedes, it looks like index 2 would allow select using OBJNR without needing LEDNR, but SAP delivers index 2 and 4 of the COEP table flagged as "No Database Index" so they do not really exist and cannot be used without creating them (a repair to the table). So this leaves only index 1 as a real index, and it needs the additional field provided.

So your process would be:

1. Read AFPO and populate internal tabel.

2. Loop at internal table and set up extra OBJNR field as 'OR'+Aufnr

3. Check internal table is not empty

4. Read COEP using FOR ALL ENTRIES and both LEDNR and OBJNR fields

NB: make sure you read all three key COEP fields KOKRS, BELNR, BUZEI to avoid loss of duplicates due to FOR ALL ENTRIES behaving like "SELECT DISTINCT".


Former Member
0 Kudos


Plsz make sure give your query very clear, so that any people can understand then you can expect immedt responec.

as you told aufnr having field length is 12 and it is order number and you have give link to COEP- OBJNR having length is 22 and it is object number, r u sure order number is same as object number.

try to explain your problem clearly.

Former Member
0 Kudos


select -

from AFPO int itab1 where condition(in this condition give primary or secondary index )

if not itab1[] is initial.

select -

from COEP into table itab2 for all entries in itab1 where condition field = itab1-field and so o


try like this

reward if usefull

Former Member
0 Kudos

im not able to understand ur question...tell me the prob in detail...