Professional Documents
Culture Documents
/*
[NAME]
- HANA_ABAP_SDFSMON_FilterAndAggregation
[DESCRIPTION]
[SOURCE]
[259]: invalid table name: Could not find table/view /SDF/SMON_WPINFO in schema
- If access to ABAP objects is possible but you cannot log on as ABAP user, you can
switch the default schema before executing the command:
[VALID FOR]
- Revisions: all
- Statistics server type: all
- Client application: ABAP
[INVOLVED TABLES]
- /SDF/SMON_WPINFO
[INPUT PARAMETERS]
- BEGIN_TIME
Begin time
'2018/12/05 14:05:00' --> Set begin time to 5th of December 2018, 14:05
'C' --> Set begin time to current time
'C-S900' --> Set begin time to current time minus 900 seconds
'C-M15' --> Set begin time to current time minus 15 minutes
'C-H5' --> Set begin time to current time minus 5 hours
'C-D1' --> Set begin time to current time minus 1 day
'C-W4' --> Set begin time to current time minus 4 weeks
'E-S900' --> Set begin time to end time minus 900 seconds
'E-M15' --> Set begin time to end time minus 15 minutes
'E-H5' --> Set begin time to end time minus 5 hours
'E-D1' --> Set begin time to end time minus 1 day
'E-W4' --> Set begin time to end time minus 4 weeks
'MIN' --> Set begin time to minimum (1000/01/01 00:00:00)
- END_TIME
End time
'2018/12/08 14:05:00' --> Set end time to 8th of December 2018, 14:05
'C' --> Set end time to current time
'C-S900' --> Set end time to current time minus 900 seconds
'C-M15' --> Set end time to current time minus 15 minutes
'C-H5' --> Set end time to current time minus 5 hours
'C-D1' --> Set end time to current time minus 1 day
'C-W4' --> Set end time to current time minus 4 weeks
'B+S900' --> Set end time to begin time plus 900 seconds
'B+M15' --> Set end time to begin time plus 15 minutes
'B+H5' --> Set end time to begin time plus 5 hours
'B+D1' --> Set end time to begin time plus 1 day
'B+W4' --> Set end time to begin time plus 4 weeks
'MAX' --> Set end time to maximum (9999/12/31 23:59:59)
- APP_SERVER
- MANDT
- WP_TYPE
SAP ABAP work process type (e.g. DIA, ENQ, BTC, UPD)
- WP_ID
- CPID
1234 --> Show information for work process with client process ID
1234
-1 --> No restriction related to client process ID
- ACTION
- TABLE_NAME
- STATE
'SYNC RFC' --> Restrict output to work processes in state SYNC RFC
'%' --> No process state restriction
- WAITING_FOR
Wait situation
- APP_USER
Application user
- APP_SOURCE
Application source
- REQUEST_TYPE
- BATCH_JOB
- TIME_AGGREGATE_BY
- ORDER_BY
[OUTPUT PARAMETERS]
[EXAMPLE OUTPUT]
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
----------------------------
|START_TIME |APP_SERVER |MANDT|TYP|WP_ID|CPID |DB_ROWS |DB_TIME_S |
ACTION |TABLE_NAME |STATE |APP_USER |APP_SOURCE
|BATCH_JOB |WAITING_FOR
|
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
----------------------------
|2017/02/15 12:01:00|saphana0_E9A_02| 103|DIA| 33| 20032| 0| 0.00|
SELECT |LQUA | |RUPUZIDAEK |SAPML03T -> SAPLL03A
| |
|
|2017/02/15 12:01:00|saphana0_E9A_02| 103|DIA| 34| 20033| 1227| 0.27|
| | |JOBRUN |SAPMSSY1 -> SAPLVEDA
| |
|
|2017/02/15 12:01:00|saphana0_E9A_02| 103|DIA| 66| 20066| 0| 0.00|
SELECT |COST | |PUZUTTIOBA |/GLB/RGTPTR_PROCESS_ORDER_VAR ->
SAPLKARS | |
|
|2017/02/15 12:01:00|saphana0_E9A_02| 103|DIA| 77| 28920| 361| 0.51|
| |SYNC RFC |BGVASILEVA |RVV50R10C -> SAPLATPC
| |CMSEND(SAP) / 13410508 / SYNC_CPIC /
141.122.207.43|
|2017/02/15 12:01:00|saphana0_E9A_02| 103|BTC| 113| 1876| 833| 0.88|
SELECT |VBFA | |JOBRUN |/EUR/ODECSR_COD_PROCESS ->
SAPLV05C |RU_R3E_CS_R_0065295_SDBLRU3AIMSP|
|
|2017/02/15 12:01:00|saphana0_E9A_02| 103|BTC| 117| 22492| 283| 0.18|
| | |JOBRUN |SAPMV45A -> SAPLV69A
|IT_R3E_CS_R_0060246_ORDERS_E |
|
|2017/02/15 12:01:00|saphana0_E9A_02| 103|BTC| 119| 11503| 0| 0.00|
| |ABAP WAIT|NBNRA |/GLB/RGTFCR_INVOICE_JOB
|5200637291201720170215120040 |CMRCV / 77113581 / SYNC_CPIC
|
|2017/02/15 12:01:00|saphana1_E9A_02| 103|DIA| 8| 5335| 384| 0.57|
SELECT |LIKP | |BGMIHAYLAL1 |SAPMSSY1 -> SAPLV61B
| |
|
|2017/02/15 12:01:00|saphana1_E9A_02| 103|DIA| 22| 30973| 481| 0.64|
SELECT |/GLB/RGTNOSHPORD| |BGMIHAYLAL1 |SAPMSSY1 -> SAPLV61B
| |
|
|2017/02/15 12:01:00|saphana1_E9A_02| 103|DIA| 37| 30642| 0| 0.00|
SELECT |TRFCQOUT | |PUMAIZNEBA |SAPMSSY1 -> SAPLORFC
| |
|
|2017/02/15 12:01:00|saphana1_E9A_02| 103|DIA| 51| 5380| 0| 0.00|
| | |OSS_481396 |SAPMSSY1 ->
CL_SERVER_INFO================CP | |
|
|2017/02/15 12:01:00|saphana1_E9A_02| 103|DIA| 60| 30643| 1197| 0.92|
SELECT |EKBE | |DESERWEFL |RM06EL00 -> SAPLME07
| |
|
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
----------------------------
*/
START_TIME,
LPAD(NUM, 7) SAMPLES,
APP_SERVER,
LPAD(MANDT, 5) MANDT,
WP_TYPE TYP,
LPAD(WP_ID, 5) WP_ID,
LPAD(CPID, 6) CPID,
LPAD(DB_ROWS, 9) DB_ROWS,
LPAD(TO_DECIMAL(DB_TIME_MS / 1000, 10, 2), 10) DB_TIME_S,
ACTION,
TABLE_NAME,
STATE,
APP_USER,
APP_SOURCE,
REQUEST_TYPE,
BATCH_JOB,
WAITING_FOR
FROM
( SELECT
CASE
WHEN BI.AGGREGATE_BY = 'NONE' OR INSTR(BI.AGGREGATE_BY, 'TIME') != 0 THEN
CASE
WHEN BI.TIME_AGGREGATE_BY LIKE 'TS%' THEN
TO_VARCHAR(ADD_SECONDS(TO_TIMESTAMP('2014/01/01 00:00:00', 'YYYY/MM/DD
HH24:MI:SS'), FLOOR(SECONDS_BETWEEN(TO_TIMESTAMP('2014/01/01 00:00:00',
'YYYY/MM/DD HH24:MI:SS'), S.START_TIME) / SUBSTR(BI.TIME_AGGREGATE_BY,
3)) * SUBSTR(BI.TIME_AGGREGATE_BY, 3)), 'YYYY/MM/DD HH24:MI:SS')
ELSE TO_VARCHAR(S.START_TIME, BI.TIME_AGGREGATE_BY)
END
ELSE 'any'
END START_TIME,
CASE WHEN BI.AGGREGATE_BY = 'NONE' OR INSTR(BI.AGGREGATE_BY, 'SERVER') != 0
THEN S.SERVER ELSE MAP(BI.APP_SERVER, '%', 'any', BI.APP_SERVER)
END APP_SERVER,
CASE WHEN BI.AGGREGATE_BY = 'NONE' OR INSTR(BI.AGGREGATE_BY, 'MANDT') != 0
THEN S.TENANT ELSE MAP(BI.MANDT, '%', 'any', BI.MANDT)
END MANDT,
CASE WHEN BI.AGGREGATE_BY = 'NONE' OR INSTR(BI.AGGREGATE_BY, 'WP_ID') != 0
THEN TO_VARCHAR(S.WP_INDEX) ELSE MAP(BI.WP_ID, -1, 'any',
TO_VARCHAR(BI.WP_ID)) END WP_ID,
CASE WHEN BI.AGGREGATE_BY = 'NONE' OR INSTR(BI.AGGREGATE_BY, 'WP_TYPE') != 0
THEN S.WP_TYPE ELSE MAP(BI.WP_TYPE, '%', 'any', BI.WP_TYPE)
END WP_TYPE,
CASE WHEN BI.AGGREGATE_BY = 'NONE' OR INSTR(BI.AGGREGATE_BY, 'CPID') != 0
THEN TO_VARCHAR(S.PID) ELSE MAP(BI.CPID, -1, 'any',
TO_VARCHAR(BI.CPID)) END CPID,
CASE WHEN BI.AGGREGATE_BY = 'NONE' OR INSTR(BI.AGGREGATE_BY, 'ACTION') != 0
THEN S.ACTION ELSE MAP(BI.ACTION, '%', 'any', BI.ACTION)
END ACTION,
CASE WHEN BI.AGGREGATE_BY = 'NONE' OR INSTR(BI.AGGREGATE_BY, 'TABLE') != 0
THEN S.TABLE_NAME ELSE MAP(BI.TABLE_NAME, '%', 'any', BI.TABLE_NAME)
END TABLE_NAME,
CASE WHEN BI.AGGREGATE_BY = 'NONE' OR INSTR(BI.AGGREGATE_BY, 'STATE') != 0
THEN S.STATE ELSE MAP(BI.STATE, '%', 'any', BI.STATE )
END STATE,
CASE WHEN BI.AGGREGATE_BY = 'NONE' OR INSTR(BI.AGGREGATE_BY, 'WAITING') != 0
THEN S.WAITING_FOR ELSE MAP(BI.WAITING_FOR, '%', 'any', BI.WAITING_FOR)
END WAITING_FOR,
CASE WHEN BI.AGGREGATE_BY = 'NONE' OR INSTR(BI.AGGREGATE_BY, 'APP_USER') != 0
THEN S.USER_NAME ELSE MAP(BI.APP_USER, '%', 'any', BI.APP_USER)
END APP_USER,
CASE WHEN BI.AGGREGATE_BY = 'NONE' OR INSTR(BI.AGGREGATE_BY, 'APP_SOURCE') != 0
THEN S.APP_SOURCE ELSE MAP(BI.APP_SOURCE, '%', 'any', BI.APP_SOURCE)
END APP_SOURCE,
CASE WHEN BI.AGGREGATE_BY = 'NONE' OR INSTR(BI.AGGREGATE_BY, 'REQUEST') != 0
THEN S.REQUEST_TYPE ELSE MAP(BI.REQUEST_TYPE, '%', 'any', BI.REQUEST_TYPE)
END REQUEST_TYPE,
CASE WHEN BI.AGGREGATE_BY = 'NONE' OR INSTR(BI.AGGREGATE_BY, 'BATCH_JOB') != 0
THEN S.BTCJOBNAME ELSE MAP(BI.BATCH_JOB, '%', 'any', BI.BATCH_JOB)
END BATCH_JOB,
COUNT(*) NUM,
SUM(DB_ROWS) DB_ROWS,
SUM(DB_TIME_MS) DB_TIME_MS,
ORDER_BY
FROM
( SELECT
CASE
WHEN BEGIN_TIME = 'C' THEN CURRENT_TIMESTAMP
WHEN BEGIN_TIME LIKE 'C-S%' THEN
ADD_SECONDS(CURRENT_TIMESTAMP, -SUBSTR_AFTER(BEGIN_TIME, 'C-S'))
WHEN BEGIN_TIME LIKE 'C-M%' THEN
ADD_SECONDS(CURRENT_TIMESTAMP, -SUBSTR_AFTER(BEGIN_TIME, 'C-M') * 60)
WHEN BEGIN_TIME LIKE 'C-H%' THEN
ADD_SECONDS(CURRENT_TIMESTAMP, -SUBSTR_AFTER(BEGIN_TIME, 'C-H') * 3600)
WHEN BEGIN_TIME LIKE 'C-D%' THEN
ADD_SECONDS(CURRENT_TIMESTAMP, -SUBSTR_AFTER(BEGIN_TIME, 'C-D') * 86400)
WHEN BEGIN_TIME LIKE 'C-W%' THEN
ADD_SECONDS(CURRENT_TIMESTAMP, -SUBSTR_AFTER(BEGIN_TIME, 'C-W') * 86400 * 7)
WHEN BEGIN_TIME LIKE 'E-S%' THEN
ADD_SECONDS(TO_TIMESTAMP(END_TIME, 'YYYY/MM/DD HH24:MI:SS'),
-SUBSTR_AFTER(BEGIN_TIME, 'E-S'))
WHEN BEGIN_TIME LIKE 'E-M%' THEN
ADD_SECONDS(TO_TIMESTAMP(END_TIME, 'YYYY/MM/DD HH24:MI:SS'),
-SUBSTR_AFTER(BEGIN_TIME, 'E-M') * 60)
WHEN BEGIN_TIME LIKE 'E-H%' THEN
ADD_SECONDS(TO_TIMESTAMP(END_TIME, 'YYYY/MM/DD HH24:MI:SS'),
-SUBSTR_AFTER(BEGIN_TIME, 'E-H') * 3600)
WHEN BEGIN_TIME LIKE 'E-D%' THEN
ADD_SECONDS(TO_TIMESTAMP(END_TIME, 'YYYY/MM/DD HH24:MI:SS'),
-SUBSTR_AFTER(BEGIN_TIME, 'E-D') * 86400)
WHEN BEGIN_TIME LIKE 'E-W%' THEN
ADD_SECONDS(TO_TIMESTAMP(END_TIME, 'YYYY/MM/DD HH24:MI:SS'),
-SUBSTR_AFTER(BEGIN_TIME, 'E-W') * 86400 * 7)
WHEN BEGIN_TIME = 'MIN' THEN
TO_TIMESTAMP('1000/01/01 00:00:00', 'YYYY/MM/DD HH24:MI:SS')
WHEN SUBSTR(BEGIN_TIME, 1, 1) NOT IN ('C', 'E', 'M') THEN
TO_TIMESTAMP(BEGIN_TIME, 'YYYY/MM/DD HH24:MI:SS')
END BEGIN_TIME,
CASE
WHEN END_TIME = 'C' THEN CURRENT_TIMESTAMP
WHEN END_TIME LIKE 'C-S%' THEN
ADD_SECONDS(CURRENT_TIMESTAMP, -SUBSTR_AFTER(END_TIME, 'C-S'))
WHEN END_TIME LIKE 'C-M%' THEN
ADD_SECONDS(CURRENT_TIMESTAMP, -SUBSTR_AFTER(END_TIME, 'C-M') * 60)
WHEN END_TIME LIKE 'C-H%' THEN
ADD_SECONDS(CURRENT_TIMESTAMP, -SUBSTR_AFTER(END_TIME, 'C-H') * 3600)
WHEN END_TIME LIKE 'C-D%' THEN
ADD_SECONDS(CURRENT_TIMESTAMP, -SUBSTR_AFTER(END_TIME, 'C-D') * 86400)
WHEN END_TIME LIKE 'C-W%' THEN
ADD_SECONDS(CURRENT_TIMESTAMP, -SUBSTR_AFTER(END_TIME, 'C-W') * 86400 * 7)
WHEN END_TIME LIKE 'B+S%' THEN
ADD_SECONDS(TO_TIMESTAMP(BEGIN_TIME, 'YYYY/MM/DD HH24:MI:SS'),
SUBSTR_AFTER(END_TIME, 'B+S'))
WHEN END_TIME LIKE 'B+M%' THEN
ADD_SECONDS(TO_TIMESTAMP(BEGIN_TIME, 'YYYY/MM/DD HH24:MI:SS'),
SUBSTR_AFTER(END_TIME, 'B+M') * 60)
WHEN END_TIME LIKE 'B+H%' THEN
ADD_SECONDS(TO_TIMESTAMP(BEGIN_TIME, 'YYYY/MM/DD HH24:MI:SS'),
SUBSTR_AFTER(END_TIME, 'B+H') * 3600)
WHEN END_TIME LIKE 'B+D%' THEN
ADD_SECONDS(TO_TIMESTAMP(BEGIN_TIME, 'YYYY/MM/DD HH24:MI:SS'),
SUBSTR_AFTER(END_TIME, 'B+D') * 86400)
WHEN END_TIME LIKE 'B+W%' THEN
ADD_SECONDS(TO_TIMESTAMP(BEGIN_TIME, 'YYYY/MM/DD HH24:MI:SS'),
SUBSTR_AFTER(END_TIME, 'B+W') * 86400 * 7)
WHEN END_TIME = 'MAX' THEN
TO_TIMESTAMP('9999/12/31 00:00:00', 'YYYY/MM/DD HH24:MI:SS')
WHEN SUBSTR(END_TIME, 1, 1) NOT IN ('C', 'B', 'M') THEN
TO_TIMESTAMP(END_TIME, 'YYYY/MM/DD HH24:MI:SS')
END END_TIME,
APP_SERVER,
MANDT,
WP_TYPE,
WP_ID,
CPID,
ACTION,
TABLE_NAME,
STATE,
WAITING_FOR,
APP_USER,
APP_SOURCE,
REQUEST_TYPE,
BATCH_JOB,
AGGREGATE_BY,
MAP(TIME_AGGREGATE_BY,
'NONE', 'YYYY/MM/DD HH24:MI:SS',
'HOUR', 'YYYY/MM/DD HH24',
'DAY', 'YYYY/MM/DD (DY)',
'HOUR_OF_DAY', 'HH24',
TIME_AGGREGATE_BY ) TIME_AGGREGATE_BY,
ORDER_BY
FROM
( SELECT /* Modification section */
'1000/10/18 07:58:00' BEGIN_TIME, /* YYYY/MM/DD HH24:MI:SS
timestamp, C, C-S<seconds>, C-M<minutes>, C-H<hours>, C-D<days>, C-W<weeks>, E-
S<seconds>, E-M<minutes>, E-H<hours>, E-D<days>, E-W<weeks>, MIN */
'9999/10/18 08:05:00' END_TIME, /* YYYY/MM/DD HH24:MI:SS
timestamp, C, C-S<seconds>, C-M<minutes>, C-H<hours>, C-D<days>, C-W<weeks>,
B+S<seconds>, B+M<minutes>, B+H<hours>, B+D<days>, B+W<weeks>, MAX */
'%' APP_SERVER,
'%' MANDT,
'%' WP_TYPE,
-1 WP_ID,
-1 CPID,
'%' ACTION,
'%' TABLE_NAME,
'%' STATE,
'%' WAITING_FOR,
'%' APP_USER,
'%' APP_SOURCE,
'%' REQUEST_TYPE,
'%' BATCH_JOB,
'TIME, APP_USER, TABLE_NAME' AGGREGATE_BY, /* TIME, SERVER, MANDT,
WP_ID, WP_TYPE, CPID, ACTION, TABLE, WAITING, APP_USER, APP_SOURCE, REQUEST,
BATCH_JOB or comma separated combinations, NONE for no aggregation */
'TS60' TIME_AGGREGATE_BY, /* HOUR, DAY, HOUR_OF_DAY or database time
pattern, TS<seconds> for time slice, NONE for no aggregation */
'TIME' ORDER_BY /* TIME, SAMPLES */
FROM
DUMMY
)
) BI,
( SELECT
TO_TIMESTAMP(DATUM || TIME, 'YYYYMMDDHH24MISS') START_TIME,
SERVER,
TENANT,
WP_INDEX,
MAP(WP_TYPE, 1, 'DIA', 2, 'UPD', 3, 'ENQ', 4, 'BTC', 5, 'SPO', 6, 'UP2',
'UNDEF') WP_TYPE,
PID,
MAP(CURRENT_ACTION,
0, '',
1, 'ENQUEUE',
2, 'SAPGUI RESPONSE',
5, 'ROLL IN',
6, 'ROLL OUT',
10, 'SELECT (SINGLE)',
11, 'SELECT',
13, 'INSERT',
14, 'UPDATE',
15, 'DELETE',
16, 'COMMIT',
17, 'ABAP GENERATION',
18, 'ABAP LOAD',
19, 'CUA LOAD',
20, 'DYNPRO LOAD',
21, 'ROLLBACK',
22, 'OTHER DB ACTION',
45, 'ADMIN TASK',
'UNDEFINED (' || CURRENT_ACTION || ')'
) ACTION,
CASE WHEN CURRENT_ACTION BETWEEN 10 AND 15 THEN ACTION_INFO ELSE '' END
TABLE_NAME,
MAP(STATE_INFO,
0, '',
1, 'DEBUG',
2, 'SYNC RFC',
3, 'ENQUEUE',
4, 'UPDATE WAIT',
6, 'ADM WAIT',
7, 'NRRANGE WAIT',
8, 'SAPGUI WAIT',
9, 'PRIV MODE',
15, 'ABAP WAIT',
16, 'MSGSERVER',
19, 'ASYNC RFC',
'UNDEFINED (' || STATE_INFO || ')'
) STATE,
MAP(ROOTTYPE,
'R', 'RFC',
'U', 'HTTPS',
'S', 'Report',
'T', 'Transaction',
'B', 'Background',
ROOTTYPE) || MAP(ROOTNAME, '', '', CHAR(32) || '(' || ROOTNAME || ')')
REQUEST_TYPE,
WAIT_INFO ||
CASE WHEN WAIT_INFO != '' AND WAIT_FOR != '' THEN CHAR(32) || '/' ||
CHAR(32) ELSE '' END ||
WAIT_FOR WAITING_FOR,
USER_NAME,
MAIN_PROGRAM || MAP(WP_PROGRAM, MAIN_PROGRAM, '', CHAR(32) || '->' ||
CHAR(32) || WP_PROGRAM) APP_SOURCE,
BTCJOBNAME,
DBRECORDS + DBRECORDS_C DB_ROWS,
DBTIME + DBTIME_C DB_TIME_MS
FROM
"/SDF/SMON_WPINFO"
) S
WHERE
S.START_TIME BETWEEN BI.BEGIN_TIME AND BI.END_TIME AND
S.SERVER LIKE BI.APP_SERVER AND
S.TENANT LIKE BI.MANDT AND
( BI.WP_ID = -1 OR S.WP_INDEX = BI.WP_ID ) AND
S.WP_TYPE LIKE BI.WP_TYPE AND
( BI.CPID = -1 OR S.PID = BI.CPID ) AND
S.ACTION LIKE BI.ACTION AND
S.TABLE_NAME LIKE BI.TABLE_NAME AND
S.STATE LIKE BI.STATE AND
S.WAITING_FOR LIKE BI.WAITING_FOR AND
S.USER_NAME LIKE BI.APP_USER AND
S.APP_SOURCE LIKE BI.APP_SOURCE AND
S.REQUEST_TYPE LIKE BI.REQUEST_TYPE AND
S.BTCJOBNAME LIKE BI.BATCH_JOB
GROUP BY
CASE
WHEN BI.AGGREGATE_BY = 'NONE' OR INSTR(BI.AGGREGATE_BY, 'TIME') != 0 THEN
CASE
WHEN BI.TIME_AGGREGATE_BY LIKE 'TS%' THEN
TO_VARCHAR(ADD_SECONDS(TO_TIMESTAMP('2014/01/01 00:00:00', 'YYYY/MM/DD
HH24:MI:SS'), FLOOR(SECONDS_BETWEEN(TO_TIMESTAMP('2014/01/01 00:00:00',
'YYYY/MM/DD HH24:MI:SS'), S.START_TIME) / SUBSTR(BI.TIME_AGGREGATE_BY,
3)) * SUBSTR(BI.TIME_AGGREGATE_BY, 3)), 'YYYY/MM/DD HH24:MI:SS')
ELSE TO_VARCHAR(S.START_TIME, BI.TIME_AGGREGATE_BY)
END
ELSE 'any'
END,
CASE WHEN BI.AGGREGATE_BY = 'NONE' OR INSTR(BI.AGGREGATE_BY, 'SERVER') != 0
THEN S.SERVER ELSE MAP(BI.APP_SERVER, '%', 'any', BI.APP_SERVER)
END,
CASE WHEN BI.AGGREGATE_BY = 'NONE' OR INSTR(BI.AGGREGATE_BY, 'MANDT') != 0
THEN S.TENANT ELSE MAP(BI.MANDT, '%', 'any', BI.MANDT)
END,
CASE WHEN BI.AGGREGATE_BY = 'NONE' OR INSTR(BI.AGGREGATE_BY, 'WP_ID') != 0
THEN TO_VARCHAR(S.WP_INDEX) ELSE MAP(BI.WP_ID, -1, 'any',
TO_VARCHAR(BI.WP_ID)) END,
CASE WHEN BI.AGGREGATE_BY = 'NONE' OR INSTR(BI.AGGREGATE_BY, 'WP_TYPE') != 0
THEN S.WP_TYPE ELSE MAP(BI.WP_TYPE, '%', 'any', BI.WP_TYPE)
END,
CASE WHEN BI.AGGREGATE_BY = 'NONE' OR INSTR(BI.AGGREGATE_BY, 'CPID') != 0
THEN TO_VARCHAR(S.PID) ELSE MAP(BI.CPID, -1, 'any',
TO_VARCHAR(BI.CPID)) END,
CASE WHEN BI.AGGREGATE_BY = 'NONE' OR INSTR(BI.AGGREGATE_BY, 'ACTION') != 0
THEN S.ACTION ELSE MAP(BI.ACTION, '%', 'any', BI.ACTION)
END,
CASE WHEN BI.AGGREGATE_BY = 'NONE' OR INSTR(BI.AGGREGATE_BY, 'TABLE') != 0
THEN S.TABLE_NAME ELSE MAP(BI.TABLE_NAME, '%', 'any', BI.TABLE_NAME)
END,
CASE WHEN BI.AGGREGATE_BY = 'NONE' OR INSTR(BI.AGGREGATE_BY, 'STATE') != 0
THEN S.STATE ELSE MAP(BI.STATE, '%', 'any', BI.STATE)
END,
CASE WHEN BI.AGGREGATE_BY = 'NONE' OR INSTR(BI.AGGREGATE_BY, 'WAITING') != 0
THEN S.WAITING_FOR ELSE MAP(BI.WAITING_FOR, '%', 'any', BI.WAITING_FOR)
END,
CASE WHEN BI.AGGREGATE_BY = 'NONE' OR INSTR(BI.AGGREGATE_BY, 'APP_USER') != 0
THEN S.USER_NAME ELSE MAP(BI.APP_USER, '%', 'any', BI.APP_USER)
END,
CASE WHEN BI.AGGREGATE_BY = 'NONE' OR INSTR(BI.AGGREGATE_BY, 'APP_SOURCE') != 0
THEN S.APP_SOURCE ELSE MAP(BI.APP_SOURCE, '%', 'any', BI.APP_SOURCE)
END,
CASE WHEN BI.AGGREGATE_BY = 'NONE' OR INSTR(BI.AGGREGATE_BY, 'REQUEST') != 0
THEN S.REQUEST_TYPE ELSE MAP(BI.REQUEST_TYPE, '%', 'any', BI.REQUEST_TYPE)
END,
CASE WHEN BI.AGGREGATE_BY = 'NONE' OR INSTR(BI.AGGREGATE_BY, 'BATCH_JOB') != 0
THEN S.BTCJOBNAME ELSE MAP(BI.BATCH_JOB, '%', 'any', BI.BATCH_JOB)
END,
ORDER_BY
)
ORDER BY
MAP(ORDER_BY, 'SAMPLES', NUM) DESC,
MAP(ORDER_BY, 'TIME', START_TIME) DESC,
APP_SERVER,
WP_ID