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

Performnace issue

Former Member
0 Likes
821

Hi Gurus,

i m fetching data from A005 table and according to selection criteria there is 223,233 entries in the table because of that taking so much time.......and giving runtime error.......

this is code

SELECT MARAMATNR MAKTMAKTX MARAMATKL MARCWERKS

INTO TABLE IT_MARC

FROM MARC

INNER JOIN MARA ON MARCMATNR = MARAMATNR

INNER JOIN MAKT ON MARCMATNR = MAKTMATNR

WHERE MARC~MATNR IN S_MATNR AND

MARC~WERKS IN S_WERKS AND

MAKT~SPRAS = 'EN' AND

MARA~XCHPF = 'X' AND

MATKL IN S_MATKL.

IF IT_MARC[] IS NOT INITIAL.

SELECT KUNNR MATNR DATBI DATAB KNUMH

FROM A005

INTO TABLE IT_A005

FOR ALL ENTRIES IN IT_MARC

WHERE KSCHL = 'ZMRP' AND

VKORG = '1000' AND

VTWEG = '10' AND

KUNNR IN S_KUNNR AND

MATNR = IT_MARC-MATNR AND

datab le s_datbi-low and

DATBI ge s_datbi-low.

***

ENDIF.

during debugiing report taking time to fetch data from A005 table

IF IT_A005[] IS NOT INITIAL.

SELECT KNUMH KBETR

FROM KONP

INTO TABLE IT_KONP

FOR ALL ENTRIES IN IT_A005

WHERE KNUMH = IT_A005-KNUMH.

ENDIF.

give me some solution

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
785

Create the Indexes for respective database tables, then your problem solved

7 REPLIES 7
Read only

ThomasZloch
Active Contributor
0 Likes
785

you need to include primary key field A005-KAPPL for quicker access. It should always have the same value for your selected data, so once you find out which one it is, you can put that literal into your select statement.

Cheers

Thomas

Edit: possible values for KAPPL are stored in table T681A.

Read only

Former Member
0 Likes
786

Create the Indexes for respective database tables, then your problem solved

Read only

0 Likes
785

> Create the Indexes for respective database tables, then your problem solved

Bollocks. Always check first whether you can use an existing, fully qualified primary or secondary key access path.

Read only

Former Member
0 Likes
785

Hi,

The number of records in table IT_A005 is too high to use the FOR ALL ENTRIES OPTION. One solution would ne to copy say 500 records of table IT_A005 and do the same. So loop over table IT_A005, and after each 500 records execute the selection.

Regards,

John.

Read only

Former Member
0 Likes
785

Use KAPPL in where condition.

Field order should be the same in where condition as in the

table ..

field DATAB is after DATBI in the table ..

change the where condition accordingly ..

Read only

Former Member
0 Likes
785

Absolutely no guarantees, but you can try:

TABLES a005.

RANGES: r_kappl FOR a005-kappl.

* Get all values of KAPPL into a range table.

MOVE 'EQ' TO r_kappl-option.
MOVE 'I'  TO r_kappl-sign.
SELECT kappl FROM  t681a
  INTO r_kappl-low.
  APPEND r_kappl.
ENDSELECT.

SELECT kunnr matnr datbi datab knumh
  FROM a005
  INTO TABLE it_a005
  FOR ALL ENTRIES IN it_marc
  WHERE kappl IN r_kappl
    AND kschl = 'ZMRP'
    AND vkorg = '1000'
    AND vtweg = '10'
    AND kunnr IN s_kunnr
    AND matnr = it_marc-matnr
    AND datab LE s_datbi-low
    AND datbi GE s_datbi-low.

See if it can use the primary index.

Rob

Read only

0 Likes
785

thnks to all of u i hv tried as all of u said......................

A005 not allowing me to cerate index.......................

i hv tried with all primary key and maintain sequence as in the table and removed for all entries* but still taking so much time