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: 

Days Sales Outstanding (DSO) calculation performance issue?

Former Member
0 Kudos

We have written an abap that dumps out data for a credit rescoring check process. As part of the process we are taking the KNB1 data and capturing the current DSO for each account via the function CUSTOMER_DSO_CALCULATION. The code is being extremely cpu intensive and we found that the problem is that calling this function for each of our 1million plus customers is getting extremely poor performance due to the sql in the function. I did check OSS and there appears to be nothing out there for this item.

Does anyone know if there is a different way to do this calculation?

3 REPLIES 3

Former Member
0 Kudos

What portion of the SQL is the problem?

Rob

0 Kudos

We saw massive hits on the database and ran a ST05 trace of the program as it ran. The function was in the include LF059F01 and doing this section of the code

SELECT * FROM T001CM WHERE BUKRS = T001CMTAB-BUKRS.

IF T001CM-KKBER NE T001CMTAB-KKBER.

SELECT SINGLE COUNT(*) FROM KNKK WHERE KUNNR = I_KUNNR

AND KKBER = T001CM-KKBER.

IF SY-SUBRC = 0.

BUKTAB-XBSID = 'X'.

ELSE.

CLEAR BUKTAB-XBSID.

ENDIF.

ENDIF.

ENDSELECT.

I checked and we have 12 records in the T001CM, about 3-4 for each company code in the system. It seems like this should be a fairly quick read against the KNKK table but it is going extremely slowly.

The main thing is that I know these records exist in the company code and controlling areas that are being checked because of how I am capturing them in the first place. What I am trying to determine is if or how to do the calculation without repeating the overhead of the various validity checks.

0 Kudos

The coding doesn't seem very sophisticated in a number of places. A where used list doesn't show any hits, so I wonder if SAP is still using it.

If all else fails, I guess you could try copying the function group and get rid of everything you don't need and improve the rest.

Rob