SAP Knowledge Base Article - Preview

2384488 - Poor performance with CK40N on SQL Server


You notice poor performance of transaction CK40N on SQL Server. After analyzing through DBA Cockpit's SQL Statement (DBACockpit transaction > Performance > SQL Statements) you find the most impactful statement /* R3:SAPRCK60:526 T:MACKW */.

The ABAP code for this statement is present in the report SAPRCK60:

        select        * from  mackw
                        into table t_mackw
                        for all entries in ck_matnr
                        where matnr eq ck_matnr-low
                        and   disst in ck_disst
                        and   mtart in ck_mtart
                        and   werks in ck_werks
                        and   cuobj in ck_cuobj.

The query on SQL Server is similar to the following:

SELECT <Column, Column..>
    (SELECT "C_01"= <VAR1>
     UNION ALL SELECT <VAR3> ...) as T_01
WHERE T_00.<FIELD1> = <VAR> AND T_00.<FIELD2> = T_01.C_01 AND ...



  • SAP systems based on SAP NetWeaver with ABAP/Dual Stack;
  • MS SQL Server 2008 and higher;
  • SAP_APPL 600 and higher;


SAP ERP 6.0 ; SAP NetWeaver all versions ; SAP enhancement package for SAP ERP all versions


mackw, cuobj, werks, mtart, matnr, performance, sqlserver, sqlsrv, sqlservr, mssql, ms sql, ms_sql, msql, dbacockpit, saprck60, dba cockpit, SAP_APPL, CK40N, FAE, FOR ALL ENTRIES, prefer join, view, MARA, MARC, statement, tune, tuning , KBA , BC-DB-MSS , SQL Server in SAP NetWeaver Products , CO-PC-PCP , Product Cost Planning , CO-PC-PCP-WQS , Product Costing with Quantity Structure , SV-PERF , Performance Problems , Problem

About this page

This is a preview of a SAP Knowledge Base Article. Click more to access the full version on SAP for Me (Login required).

Search for additional results

Visit SAP Support Portal's SAP Notes and KBA Search.