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

Dump on reading hashed table

Former Member
0 Likes
1,280

Hi,

I am getting a dump with 'time limit exceeded' from our existing program. The internal table was declared as follows:

DATA: it_bseg TYPE HASHED TABLE OF typ_bseg WITH

UNIQUE KEY bukrs belnr gjahr buzei.

And is being filled as follows:

SELECT bukrs belnr gjahr buzei dmbtr

kunnr mwskz shkzg koart hkont

hwbas

FROM bseg INTO TABLE it_bseg

FOR ALL ENTRIES IN it_bkpf

WHERE belnr EQ it_bkpf-belnr

AND gjahr EQ it_bkpf-gjahr

AND bukrs EQ it_bkpf-bukrs.

And the dump happens in the following line:

READ TABLE it_bseg WITH TABLE KEY bukrs = wa_bseg-bukrs

belnr = wa_bseg-belnr

gjahr = wa_bseg-gjahr

buzei = 002

INTO wa_bseg2.

I can't seem to find the problem. Any idea will be very much welcome.

14 REPLIES 14
Read only

Former Member
0 Likes
1,211

Hi,

Are you running the program in foreground? In which case the program reached the run time just at the point of the table read. Try rerunning with a smaller data selection range to confirm this.

It is never a good idea to read large volumes of BSEG records. Look at using BSID,BSAD or BSIK if what you want to do is to query customer other types of postings.

Read only

Former Member
0 Likes
1,211

Hi nene ,

The dump is not because of the read statement , it must be because of the select statement , this must be taking a lot of time .

So the execution time of the program exceeds the limit set in your system for a program to run in foreground.

Regards,

Arun

Read only

Former Member
0 Likes
1,211

Thanks for the responses. The program is running in foreground as it is an interactive report. The program runs fine with smaller data. From ST22, it is pointing at the read statement. Any workaround will be greatly appreciated.

Read only

0 Likes
1,211

Hi Could you please send me the dump Error, My Mail id is senthilvel.murugesan@tcs.com

Read only

0 Likes
1,211

I don't think there is a way around it. Depending on your volume of documents you cannot run data from BSEG for a full year and expect the report to be ultra fast.....

In fact depending on the Industry even a background report could get DB conflicts (SNAPSHOT TOO OLD) for a 3 months extract of all records from BSEG for the corresponding company code...

You need to seriously limit your scope and perhaps move the report to BW...

Read only

0 Likes
1,211

By the way, why are you using a hashed table? Doesn't that just add hash-key administration overhead?

You can define your table as a STANDARD table, SORT the contents after selecting, and use the BINARY SEARCH addition when READing WITH KEY specification. This gives no extra administration of the table (except the single sort statement), while giving good performance when accessing the table contents.


Kjetil Kilhavn (Vettug AS) - ABAP developer since Feb 2000, but will probably never be a Rockstar developer
Read only

KjetilKilhavn
Active Contributor
0 Likes
1,211

Like the others who have replied I assume that your BKPF table contains too many entries. You should definitely try splitting the selection into a fixed time interval. The length of the interval depends on your system configuration and number of documents created per month.

I have gone into the same trap myself - I tried to select data without limiting the timeframe and also ended with timeouts in production. One week proved to be an OK interval in the end, but you should probably experiment a little with that.

Splitting the selection (and processing) has the added advantage of reduced, and more predictable memory usage.


Kjetil Kilhavn (Vettug AS) - ABAP developer since Feb 2000, but will probably never be a Rockstar developer
Read only

Former Member
0 Likes
1,211

Hi,

If you're intent in using this program in the foreground, use the package size addition for the select statement (more info in the help on the select into statement)

And then use FM SAPGUI_PROGRESS_INDICATOR, to "reset" the dialog running process.

Kind regards, Rob Dielemans

Read only

0 Likes
1,210

Hi Rob Dielemans ,

Try to Maintain key's in the HashedTable in Order as u gave them while defining it , even for this reason also it will be taking much time .

Thanks&Regards

Bhaskar Rao.M

Read only

Former Member
0 Likes
1,210

see the coding of myin for 2 table bseg & bkpf

TYPES: BEGIN OF t_bkpf,
*  include structure bkpf.
  bukrs LIKE bkpf-bukrs,
  belnr LIKE bkpf-belnr,
  gjahr LIKE bkpf-gjahr,
  bldat LIKE bkpf-bldat,
  monat LIKE bkpf-monat,
  budat LIKE bkpf-budat,
  xblnr LIKE bkpf-xblnr,
  awtyp LIKE bkpf-awtyp,
  awkey LIKE bkpf-awkey,
 END OF t_bkpf.
DATA: it_bkpf TYPE STANDARD TABLE OF t_bkpf INITIAL SIZE 0,
      wa_bkpf TYPE t_bkpf.

TYPES: BEGIN OF t_bseg,
*include structure bseg.
  bukrs     LIKE bseg-bukrs,
  belnr     LIKE bseg-belnr,
  gjahr     LIKE bseg-gjahr,
  buzei     LIKE bseg-buzei,
  mwskz     LIKE bseg-mwskz,         "Tax code
  umsks     LIKE bseg-umsks,         "Special G/L transaction type
  prctr     LIKE bseg-prctr,         "Profit Centre
  hkont     LIKE bseg-hkont,         "G/L account
  xauto     LIKE bseg-xauto,
  koart     LIKE bseg-koart,
  dmbtr     LIKE bseg-dmbtr,
  mwart     LIKE bseg-mwart,
  hwbas     LIKE bseg-hwbas,
  aufnr     LIKE bseg-aufnr,
  projk     LIKE bseg-projk,
  shkzg     LIKE bseg-shkzg,
  kokrs     LIKE bseg-kokrs,
 END OF t_bseg.
DATA: it_bseg TYPE STANDARD TABLE OF t_bseg INITIAL SIZE 0,
      wa_bseg TYPE t_bseg.

*Select FOR ALL ENTRIES command
SELECT bukrs belnr gjahr bldat monat budat xblnr awtyp awkey
  UP TO 100 ROWS
  FROM bkpf
  INTO TABLE it_bkpf.

IF sy-subrc EQ 0.
* The FOR ALL ENTRIES comand only retrieves data which matches
* entries within a particular internal table.
  SELECT bukrs belnr gjahr buzei mwskz umsks prctr hkont xauto koart
         dmbtr mwart hwbas aufnr projk shkzg kokrs
    FROM bseg
    INTO TABLE it_bseg
    FOR ALL ENTRIES IN it_bkpf
    WHERE bukrs EQ it_bkpf-bukrs AND
          belnr EQ it_bkpf-belnr AND
          gjahr EQ it_bkpf-gjahr.
ENDIF.



reward points if it is usefull

Girish

Read only

0 Likes
1,210

Girish,

Be careful when recommending 'for all entries', 'cause if there are a lot of entries (in this case, in bkpf), the select will be even less performant...

r.

Read only

Former Member
0 Likes
1,210

Hi Nene ,

U didn't specfied work area ,check it once in the read statement ...............if u have done ur problem solves i hope...

Thanks& Regard's

Bhaskar Rao.M

Read only

Former Member
0 Likes
1,210

interesting idea with the up to 100 rows... but will be hard to get the next 100.

To check whether your problem is really at the read, set a breakpoint behind the select. And check how many lines you have in it_bseg!

Continue manually, I guess there must be a loop, go to the read and check whether it can be executed once.

Then let the program run, might be the end with a time-out, then it_beseg should be large.

Siegfried

Read only

Former Member
0 Likes
1,210

Thanks everyone for the responses.