Skip to Content
avatar image
Former Member

ABAP CDS View performance issues

I have created a relatively complex set of views that I am having problems with.

I have a ztable that holds a date when an event should take place (take balance payment date, datum).

Along with this I store the customer number (kunnr), the customer PO number (bstnk), and an authorisation code (char10) that gets populated when the balance has been successfully requested (I do not have the salesdoc number in here, as I could not be certain it would exist when this data is captured).

To get the relevant data for my report I have created a CDS View (zv_final_bal).

Within the view I select from my ztable (this table currently only holds 3 rows) and join to 2 other views, zv_order_value and zv_amount_paid. Now these views are a little more complex (zv_order_val sums netwr and mwsbp from vbap where certain conditions are met, and zv_amount_paid uses quite complex logic on the BSID and BSAD tables to calculate all the credits and debits).

Now when I run the report by passing a customer number (or range) and/or a po number (or range) the query runs instantly (“successfully executed in 53 ms”). But if I run it open or, more importantly, with just a date (or range of dates) it takes 5 seconds to execute (“successfully executed in 5.555 seconds”).

The first table I select from in my main (zv_final_bal) is my ztable (just 3 rows remember), I then join this to zv_amount_paid via customer number and po number. This gives me the amount paid,and the salesdoc number which I then use to join to my other view (zv_order_val).

I cannot understand why selecting from the view using date doesn’t seem to restrict the work the CDS view has to do, when using customer OR po number does? Surely when I use the date then only records (therefore customers or po’s) that match this criteria are selected from my ztable (eg 1 record) and joined to the rest of my views?

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    Nov 02, 2017 at 08:41 PM

    ST05 would give you an answer faster than it takes to post a question on SCN.

    Without seeing the actual SQL statements, I can only guess that because BSID/BSAD have primary key by customer then, naturally, the whole thing works faster when using customer vs. using something else. But it might as well be 1001 other reason. Use ST05.

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Thanks Jelena, possibly i need to structure my question better, but fair points with the info i provided.