Skip to Content

For All entries in

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.

regards

Vikas

Add a comment
10|10000 characters needed characters exceeded

Related questions

4 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Aug 31, 2007 at 04:51 AM

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

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Aug 31, 2007 at 04:58 AM

    Hi

    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

    endif.

    try like this

    reward if usefull

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Aug 31, 2007 at 05:49 AM

    Hi,

    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.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Aug 31, 2007 at 06:11 AM

    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".

    Andrew

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.