Application Development and Automation 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: 
Read only

ABAP Report Performance Problem

Former Member
0 Likes
981

Hello Experts,

Check the folowing code and suggest me a solution.

IF BSIS-BLART = 'KR'.

SELECT SINGLE LIFNR AS LIFNR2 FROM BSAK INTO CORRESPONDING FIELDS OF ITAB WHERE BELNR = ITAB-BELNR AND GJAHR = ITAB-GJAHR.

SELECT SINGLE NAME1 AS NAME2 FROM LFA1 INTO CORRESPONDING FIELDS OF ITAB WHERE LIFNR = ITAB-LIFNR2.

WRITE: 42 ITAB-LIFNR2, 56 ITAB-NAME2.

ELSEIF BSIS-BLART = 'SA'.

SELECT SINGLE HKONT FROM BSIS INTO CORRESPONDING FIELDS OF ITAB WHERE BELNR = ITAB-BELNR AND GJAHR =

ITAB-GJAHR AND BUKRS = ITAB-BUKRS .

SELECT SINGLE TXT20 FROM SKAT INTO CORRESPONDING FIELDS OF ITAB WHERE SAKNR = BSIS-HKONT

In the above query, the table BSAK, BSIS and SKAT contains lakhs and lakhs of record, its give time out dump in test server. Kindly provide me a solution for the same.

Regards,

Senthil Kumar

10 REPLIES 10
Read only

Former Member
0 Likes
944

Hi,

Avoid usage of INTO CORRESPONDING FIELDS of ITAB as this is a costly statement.

Also make sure these are outside LOOP / ENDLOOP if at all its within .

See if you can use the index.

Rgds,

HR

Read only

0 Likes
944

Hi I have changed like this, however in se30 it shows database as 75%. Suggest me some other alternative.

if itab-blart = 'KR'.

select single * from bsip where belnr = itab-refbn and gjahr = itab-gjahr.

itab-lifnr2 = bsip-lifnr.

select single * from lfa1 where lifnr = itab-lifnr2.

itab-name2 = lfa1-name1.

elseif itab-blart = 'SA'.

select single * from bsis where belnr = itab-refbn and gjahr = itab-gjahr .

itab-hkont = bsis-hkont.

select single * from skat where saknr = itab-hkont.

itab-txt20 = skat-txt20.

endif.

Regards,

Senthil

Read only

0 Likes
944

As it is likly you get the same Vendor or Account several times. The SKAT and LFA1 selects should be done outside of any loop.

Or create reference tables as you you loop. and check those tables before you go to the DB.

MattG.

Read only

Former Member
0 Likes
944

Are you using these select statement in Loop...Endloop?

If yes, then instead of that use select...for all entries in ITAB...

Best Regards,

Vibha Deshmukh

*Please mark all the helpful answers

Read only

0 Likes
944

Hi,

its inside a Select .. endselect. like this.

select * from covp where kokrs eq itab-kokrs and

lednr eq '00' and

objnr eq itab-objnr and

versn eq '000' and

wrttp eq '04' and

gjahr ge fyr.

itab-belnr = covp-refbn.

if sy-subrc eq 0.

itab-kstar = covp-kstar.

itab-budat = covp-budat.

itab-refbn = covp-refbn.

itab-gjahr = covp-gjahr.

itab-ebeln = covp-ebeln.

itab-ebelp = covp-ebelp.

itab-awtyp = covp-awtyp.

itab-mbgbtr = covp-mbgbtr.

Here the above coding comes.

endselect.

So, How can i proceed wit this.

Read only

0 Likes
944

Senthil,

My advice would be to use internal tables...So you can collect all the information from covp into itab first. Next So use the select with for all entries in itab variation to realise your objective.

Regards

Anurag

Read only

0 Likes
944

Hi,

If you are sure that you mostly access one record at a time from these tables Enable Single Record Buffering for these tables and use primary key to select.

If you want multiple rows create a local structure and its internaltable with the fileds you want and use SELECT INTO TABLE itab instead of select endselect.

If there are only few records in the table and you mostly read from it use full table buffering.

Make your Where clause as simple as possible avoid LIKE, NOT etc and have all the primay key fields in the Where clause if possible this will use primary index.

Regards,

Sesh

Read only

0 Likes
944

Hey,

U haven't used the key feilds in the LFA1.There should be the key feild lifnr followed by your required feild to enhance the performance because it retreives values from DB based on the Primary index or the secondary indexes. Also in the BSAK table try using the Bukrs feild and then followed by your LIFNR feild. this will certainly enhance your select statement performance.

Still if you face the same probelm , try creating secondary indexes for both the tables with the key feilds followed by your required feilds.

Read only

Former Member
0 Likes
944

hi,

Avoid using select-endselect.

Instead, create an itab with the same structure as covp and use 'into table'.

data : it_covp like table of covp with header line.

select *

from covp

into table it_covp

where kokrs eq itab-kokrs and

lednr eq '00' and

objnr eq itab-objnr and

versn eq '000' and

wrttp eq '04' and

gjahr ge fyr.

Regards,

Sandeep.

pls mark helpful answers

Message was edited by: sandeep kumar

Read only

Former Member
0 Likes
944

You're going against BSAK and BSIS, using the document number and fiscal year. You should be using BSEG. You also need the company code from BSIS.

Rob