Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

BSIK select data

Former Member
0 Kudos

Hi experts,

I am preparing a service tax report.

I am fetching the data from BSAK and BSIK table based on the reference no. from BKPF table.

I understand the data would be very huge but when I am extracting data from other tables it is working fine

but when I am fetching data from BSIK table based on reference no. it is taking very long time.

In fact when I checked in debugger there are only 44 reference nos. but it is taking very long time i guess around 30-35 mins.

Although it took some seconds to fetch from BSAK table for same no. of references.

I checked in table through DD and there are 525 entires for that reference nos.

I don't know what is d prob while fetching. I have not created any indexes also for BSIK, der is some prob which I am not gettin.

So if any1 can plz suggest sumthing for it since now report is takin almost an hour for executing which is unacceptable.

Thanx.

Anil.

Moderator message - Moved to the correct forum

Edited by: Rob Burbank on Aug 13, 2009 8:59 AM

8 REPLIES 8

Former Member
0 Kudos

hi,

Post the select query you are using so that you can receive suggestions on improving the performance

0 Kudos

SELECT belnr budat lifnr augdt xblnr hkont bukrs dmbtr blart gjahr

FROM bsik

into TABLE it_bsik

FOR ALL ENTRIES IN it_out7

WHERE xblnr = it_out7-xblnr

AND bukrs IN so_bukrs.

it_bsik is declared in d same manner.

0 Kudos

Hi

U need to use the main key fields of BSIK table, so Company code (BUKRS) and Vendor Code (LIFNR).

If you know reference field XBLNR it should be better to upload the header data from BKPF and then from BSEG, not from BSIK or BSAK, because you don't know the vendor code:

 SELECT * FROM BKPF INTO TABLE T_BKPF
  FOR ALL ENTRIES IN IY_OUT7
      WHERE BUKRS IN S_BUKRS
           AND XBLNR = IT_OUT7-XBLNR.
IF SY-SUBRC = 0.
  SELECT * FROM BSEG INTO TABLE T_BSEG
    FOR ALL ENTRIES IN T_BKPF
      WHERE BUKRS = T_BKPF-BUKRS
           AND BELNR = T_BKPF-BELNR
           AND GJAHR = T_BKPF-GJAHR
          AND KOART = 'K'.  "<-----------------------Item Vendor Only

BSIK and BSAK tables have the fields of BSEG and BKPF

Max

0 Kudos

But what is d prob if I fetch d data based on reference no in BSIK table.

I don't want to change d logic since I want clearing date which is present in BSAK/BSIK.

But d thing I m not gettin is why it is taking so much time to fetch data from BSIK whereas for same reference nos. it is took very less time to fetch data from BSAK.

Wht cud be d prob in simple select.

der r around 44 refernce nos in it_out7.

SELECT belnr budat lifnr augdt xblnr hkont bukrs dmbtr blart gjahr

FROM bsik

into TABLE it_bsik

FOR ALL ENTRIES IN it_out7

WHERE xblnr = it_out7-xblnr

AND bukrs IN so_bukrs

and blart not in ('KR','KG','RE').

0 Kudos

Hi

Something sounds bad:

I don't want to change d logic since I want clearing date which is present in BSAK/BSIK.

BSIK is the index table with open vendor item only, so the clearing date will be initial there, so it's useless to select the record from BSIK.

But d thing I m not gettin is why it is taking so much time to fetch data from BSIK whereas for same reference nos. it is took very less time to fetch data from BSAK.

Probably BSAK table have a secondary index with field XBLNR and BSIK hasn't it, have you checked the secondary index?

Anyway u should consider BSAK and BSIK table are index table for Vendor accounting, so if you don't have the vendor code it should be better not to use them.

Max

Former Member
0 Kudos

Please see:

[Using an Index When You Don't Have all of the Fields|/people/rob.burbank/blog/2006/09/13/using-an-index-when-you-dont-have-all-of-the-fields]

Rob

0 Kudos

Hi Max,

I m not a functional person so I don't have much knowledge about it, but acc. to my FI consultant BSIK is needed since v need partial payment data which is present only in BSIK table.

So I have to go to BSIK table for partial payment data.

I hope u have got it.

My only concern is d time taken to execute the BSIK select query not the report which is around 30-35 mins.

kindly suggest sumthin.

Anil.

Former Member
0 Kudos

XBLNR is not a key field in BSIK. Better create a secondary index for MANDT, BUKRS & XBLNR and check. This will surely improve the performance.