2006 Jul 06 5:52 PM
Hi all,
I have created a secondary index for BSIP table for fields
mandt,lifnr,waers .
i want to see how performance has been improved if i use these secondary indexs.
Please help me to write a select statment using this secondary indexs and how do i check performance.
why do i need to include mandt field in secondary index.
do i need to include my primary key too in my select statement .
pLEASE CLARIFY THIS
SWATHI
2006 Jul 06 6:05 PM
BSIP itself is an indexed table in accounting to be used in reporting.
Any ways for the databse to use the secondary index while accessing data u need to provide the fields in the index in the where clause.
For eg if the flds in the index are f1 f2 f3 then ur where clause shud be where f1 = '' and f2 = '' and f3 = ''.
You do not need to include the primary key in ur select. This will not help if u want the databse to select the 2ndary index.
-Kiran
2006 Jul 06 6:17 PM
Hello Swathi,
Always use MANDT field in your secondary indexs. Some time bacause of that index does not work. Create secondary index using mandt and requred where cause field in same sequence. Then you can do the run time analysis and SQL trace to find our your index is in use or not.
Regards,
Amit
2006 Jul 06 6:27 PM
Hi am trying to compare the run time for following piece of code
1)only primary key is included in select statment
tables : mara.
data: begin of itab occurs 100.
include structure mara.
data :end of itab.
select * from mara into itab
where matnr = '00-380-C'.
*and mtart = 'NSTK'.
endselect.
write : / itab-matnr, 40 itab-MATKL.
2)primary and second index are included.
tables : mara.
data: begin of itab occurs 100.
include structure mara.
data :end of itab.
select * from mara into itab
where matnr = '00-380-C'
and mtart = 'NSTK'.
endselect.
write : / itab-matnr, 40 itab-MATKL.
is this right way .WHERE DO I NEED TO CHECK THE RUN TIME ANALYSIS, I.E T CODE ETC
2006 Jul 06 6:36 PM
Hello Swathi,
I think you need a book. Please find online book here
---> http://cma.zdnet.com/book/abap/index.htm
Well if your are doing performance tunning never ever use select endselect.
Below examples will never give you any improvements.
For run time analysis
se38-Excute-runtime
run program and after program will display data hit back and then back and click on analysis. you will see where program is consuming more time.
Regards,
Amit
2006 Jul 06 6:37 PM
Hi swathi,
goto utilitiese-> moreutilities->runtime analysis.
give the program name and execute it.after gettinf the output, come back to this screen and press analyse.
hope this helps u.
regards,
keerthi.
2006 Jul 06 6:56 PM
hi swathi,
goto TRANSACTION SE30 OR
UTILITIES->MORE UTILITIES->RUNTIME ANALYSIS AND EXECUTE YOUR PROGRAM AND COME BACK AND CLICK ON ANALYSE.
2006 Jul 07 6:04 AM
Hi Dyapa ,
For Performance run ST05 .
data :end of itab.
<b>select * from mara into corresponding fields table
itab
where matnr = '00-380-C'.</b>.
and write stmt in loop.
loop at itab.
write: itab.
endloop.
2006 Jul 06 6:55 PM
I really don't think you need a secondary index. You can use the primary index by selecting all of the company codes into a range table:
REPORT ztest NO STANDARD PAGE HEADING LINE-SIZE 255.
TABLES: t001, bsip.
SELECT-OPTIONS: s_lifnr FOR bsip-lifnr,
s_waers FOR bsip-waers.
DATA: BEGIN OF bsip_int OCCURS 0.
INCLUDE STRUCTURE bsip.
DATA: END OF bsip_int.
RANGES: r_bukrs FOR bsip-bukrs.
* Populate range table with all company codes
r_bukrs-option = 'EQ'.
r_bukrs-sign = 'I'.
SELECT bukrs FROM t001
INTO r_bukrs-low.
APPEND r_bukrs.
ENDSELECT.
REFRESH bsip_int.
SELECT * FROM bsip
INTO TABLE bsip_int
WHERE bukrs IN r_bukrs
AND lifnr IN s_lifnr
AND waers IN s_waers.
Rob
2006 Jul 07 6:09 AM
u can use transaction st05 for an sql trace and check the performance here.