on 05-17-2004 10:00 PM
Hey all, i'm trying to get a list of production orders that have a particular material in them and unfortunately it is taking WAY to long because the material is not a key field. Does anyone know a good table to go to where they key is a material and one of the fields is the production order? ... if there is another way to do it please let me know.
I've looked in co03 and that seems to be doing the same thing however, I can't figure out exactly how they are doing it.
Any help would be greatly appreciated. Thank you!
-Shaunt
You could always create an non-unique index against AFPO with the following key.
MANDT
MATNR
This should speed up your select statement.
Regards,
Rich Heilman
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Not sure what you mean when you say "its already done in tcode CO03" More information please. I have done extensive work in PP and have had great success in writing fast custom reporting. I do believe that I can help you with the right information. Maybe post your select statement so that I can take a look.
Regards,
Rich Heilman
Looks like that transaction uses a logical database. You don't want to mess with that. My suggestion is to create an index on table AFKO with key MANDT PLNBEZ. I just created an index on my system and a quick program and it ran in under 5 secounds.
REPORT ZRICH_0001 .
DATA: ICAUFV LIKE CAUFV OCCURS 0 WITH HEADER LINE.
PARAMETERS: P_MATNR LIKE MARA-MATNR.
START-OF-SELECTION.
SELECT * INTO CORRESPONDING FIELDS OF TABLE ICAUFV
FROM CAUFV
WHERE PLNBEZ = P_MATNR.
LOOP AT ICAUFV.
WRITE:/ ICAUFV-AUFNR, ICAUFV-PLNBEZ.
ENDLOOP.
There is something in the ABAP runtime called the optimizer. It looks at your select statement and the table and all available keys(indexes). The optimizer then chooses the best one by looking at the "where" clause and the keys(indexes). I believe that if there are any programs that will be affected by this, it will only make them better.
Regards,
Rich Heilman
I'm added the index to AFKO with mandt, plnbez as the index and the performance did not increase at all. For some reason AFKO has a lot of indices although none of them have plnbez in it. Why this is the case? I further attempted to query first AFKO and then AUFK to make it a little more obvious and it was even longer then the last time. Any ideas how to improve this???
data: xcaufv like caufv occurs 0 with header line.
==========================================
select * from caufv
into table xcaufv
where plnbez = part_no.
=======================================================
select * from afko
into corresponding fields of table xcaufv
where plnbez = part_no.
loop at xcaufv.
select single objnr werks
from aufk
into (xcaufv-objnr, xcaufv-werks)
where aufnr = xcaufv-aufnr.
========================================================
User | Count |
---|---|
87 | |
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.