You are on page 1of 82

*&---------------------------------------------------------------------*

*& Report ZTEST_VARUN_COMPARE_ST12_TRACE


*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
* Problem: Compare Runtimes of Two SE30-Traces
*
* Version: 3.50 Last Update: 2007.08.13
*
(Copy from GFP)
*
* Recent changes:
*
Length of Exec-field, Layout of Overview, Aggregation
*
*
*
* Short Description of Check for Nonlinearity Coding:
* ---------------------------------------------------* + Trace your program 2-times with different amount of data.
*
Always do a test run before you do the tracing
* + View hit list in SE30
* + Switch off filters
* + For internal tables add lines to layout
* + Order by net times descending
* + Save hit list as local file ( .txt to your PC)
*
* Start this program:
* ------------------* + Type in the path of the 2 local files or select them
*
from selection screen
*
* Step: 'Overview'
*
+ Overview
: Any contribution larger 10%
*
+ Event-Profile: Where is the time spent?
*
+ Compare
: How many percent can not be compared?
*
+ Nonlinearity : Is there anything nonlinear?
*
* Step: 'N_LINEAR'
*
Requires input of LIN_FACT, which is the factor
*
between the 2 amounts of data.
*
Classification only nonlinear contributions are shown
*
Lines with Net1 < 1000 are neglected
*
Check column 'Nonlinear', for example 'Net 2 - Exec 2' means
*
the nonlinearity is caused by the calling program!
*
* Step: 'D_CHECK'
*
All what is easily neglected
*
* Step: 'A_RATIO' and 'A_DIFF'
*
All with ratios or differences
*
*----------------------------------------------------------------------*
REPORT ztest_varun_compare_st12_trace
LINE-SIZE 300
.
TYPE-POOLS: slis.
* reuse types:

TYPES:
* longer than rlgrap-filename with test !!
typ_path(140)
TYPE c,
typ_numb
TYPE p DECIMALS 0,
typ_int
TYPE i,
typ_cline(300)
TYPE c.
* type definitions -----------------------------------------------* raw tracefile
TYPES: BEGIN OF st_file,
cline
TYPE typ_cline,
END OF st_file,
tab_file TYPE st_file OCCURS 0.
* overheads for conversion
TYPES: BEGIN OF st_offsets,
no(2)
TYPE n,
" number (external)
no_new(2)
TYPE n,
" number (internal)
fieldname(10) TYPE c,
" fieldname
text(40)
TYPE c,
" text
offset
TYPE i,
" offset
length
TYPE i,
" length
END OF st_offsets,
tab_offsets TYPE st_offsets OCCURS 0.
* offsets and length structure
TYPES: BEGIN OF st_off_len,
call
TYPE i,
exec
TYPE i,
net
TYPE i,
gross
TYPE i,
caller
TYPE i,
line
TYPE i,
call2
TYPE i,
called
TYPE i,
END OF st_off_len.
* converted trace as itab
TYPES: BEGIN OF st_trace,
code(2)
TYPE c,
maintype(10) TYPE c,
subtype(20) TYPE c,
id
TYPE c,
subid
TYPE c,
call(150)
TYPE c,
caller(32) TYPE c,
line(12)
TYPE n,
execs
TYPE p DECIMALS 0,
gross
TYPE p DECIMALS 0,
net
TYPE p DECIMALS 0,
netdexec
TYPE p DECIMALS 0,
mult
TYPE i,
END OF st_trace,
tab_trace TYPE st_trace OCCURS 0.
*
*
*

pr_g
pr_n
syst(4)

type p decimals 1,
type p decimals 1,
type c,

"
" functionality type
"
" Function
" calling function
" no of execuions
" gross time
" net time

" precentage gross time


" percentage net time
" system

db(20)

type c,

" db

* compare result of 2 traces


TYPES: BEGIN OF st_both,
maintype(10) TYPE c,
subtype(20) TYPE c,
id
TYPE c,
subid
TYPE c,
call(150)
TYPE c,
call2(150) TYPE c,
caller(32) TYPE c,
line(12)
TYPE n,
code(2)
scale(1)
text(30)
mult2
mult1

TYPE
TYPE
TYPE
TYPE
TYPE

" functionality type

" Function
" calling function

c,
c,
c,
i,
i,

gross2d1
TYPE p DECIMALS
gross2m1
TYPE p DECIMALS
grosss
TYPE c,
gross2
TYPE p DECIMALS
gross1
TYPE p DECIMALS
net2d1
TYPE p DECIMALS
net2m1
TYPE p DECIMALS
nets
TYPE c,
net2
TYPE p DECIMALS
net1
TYPE p DECIMALS
execs2d1
TYPE p DECIMALS
execs2m1
TYPE p DECIMALS
execss
TYPE c,
execs1
TYPE p DECIMALS
execs2
TYPE p DECIMALS
netdexec2
TYPE p DECIMALS
netdexec1
TYPE p DECIMALS
END OF st_both,
tab_both TYPE st_both OCCURS 0.
* trace header info
TYPES: BEGIN OF st_header,
*
locfile
path
filename
aggregate(4)
language(2)
line
events
itabs
sum_all
count_all
run_gross
max_gross
max_gross_type(20)
run_net
sum_load
count_load
sum_xyz
count_xyz
sum_class

" compare success

1,
0,
0,
0,
1,
0,
0,
0,
1,
0,
0,
0,
0,
0,

like rlgrap-filename,
LIKE rlgrap-filename,
LIKE rlgrap-filename,
TYPE c,
TYPE c,
TYPE c,
TYPE c,
TYPE c,
TYPE p DECIMALS 0,
TYPE i,
TYPE p DECIMALS 0,
TYPE p DECIMALS 0,
TYPE c,
TYPE p DECIMALS 0,
TYPE p DECIMALS 0,
TYPE i,
TYPE p DECIMALS 0,
TYPE i,
TYPE p DECIMALS 0,

count_class
count_noit_agg
count_itab_agg
sum_both
count_both
sum_one
count_one
END OF st_header.

TYPE
TYPE
TYPE
TYPE
TYPE
TYPE
TYPE

i,
i,
i,
p DECIMALS 0,
i,
p DECIMALS 0,
i,

* trace basic info


TYPES: BEGIN OF st_over,
text1(30)
TYPE c,
sum1
text2(30)
TYPE c,
sum2
text3(30)
TYPE c,
sum3
text4(30)
TYPE c,
sum4
text5(30)
TYPE c,
sum5
text6(30)
TYPE c,
sum6
text7(30)
TYPE c,
sum7
text8(30)
TYPE c,
sum8
text9(30)
TYPE c,
sum9
text10(30) TYPE c,
sum10
text11(30) TYPE c,
sum11
END OF st_over,
tab_over TYPE st_over OCCURS 0.

TYPE
TYPE
TYPE
TYPE
TYPE
TYPE
TYPE
TYPE
TYPE
TYPE
TYPE

p
p
p
p
p
p
p
p
p
p
p

DECIMALS
DECIMALS
DECIMALS
DECIMALS
DECIMALS
DECIMALS
DECIMALS
DECIMALS
DECIMALS
DECIMALS
DECIMALS

0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,

count1
count2
count3
count4
count5
count6
count7
count8
count9
count10
count11

* trace info texts


TYPES: BEGIN OF st_texts,
text(90)
TYPE c,
END OF st_texts,
tab_texts TYPE st_texts OCCURS 0.
* anoonymoous names:
TYPES: BEGIN OF st_names,
actual(150)
TYPE c,
numbered(11) TYPE c,
END OF st_names,
tab_names TYPE st_names OCCURS 0.
* ALV
TYPES: BEGIN OF st_textalv,
key_0(2) TYPE n,
key_1(2)
TYPE n,
key_2(2) TYPE n,
key_3(2)
TYPE n,
key_4(2)
TYPE n.
INCLUDE
TYPE slis_fieldcat_alv.
TYPES END OF st_textalv.
TYPES: tab_textalv
TYPE st_textalv OCCURS 0.
TYPES: BEGIN OF st_alv,
icon(46)
TYPE c.
INCLUDE
TYPE st_both.
TYPES END OF st_alv.
TYPES: tab_alv_both
TYPE st_alv OCCURS 0.
* trace count
TYPES: BEGIN OF st_count,
code(2)
TYPE c,
maintyp(10) TYPE c,

" compare success


" functionality type

TYPE
TYPE
TYPE
TYPE
TYPE
TYPE
TYPE
TYPE
TYPE
TYPE
TYPE

i,
i,
i,
i,
i,
i,
i,
i,
i,
i,
i,

subtype(20) TYPE c,
call(150)
TYPE c,
" Function
call2(150) TYPE c,
caller(32) TYPE c,
" calling function
call2m1
TYPE i,
count1m2
TYPE i,
count2
TYPE i,
count1
TYPE i,
END OF st_count,
tab_count TYPE st_count OCCURS 0.
* exceptions structure
TYPES: BEGIN OF st_except,
maintype(30) TYPE c,
subtype(30) TYPE c,
name1(100)
TYPE c,
name2(100)
TYPE c,
END OF st_except,
tab_except TYPE st_except OCCURS 0.
TYPES: BEGIN OF st_itab,
call TYPE st_trace-call,
exist TYPE i,
END OF st_itab,
tab_itab TYPE st_itab OCCURS 0.
*---------------------------------------------------------------------------DATA:
* Tables
x_textalv
TYPE tab_textalv,
file_tab1
TYPE tab_file,
file_tab2
TYPE tab_file,
file_tab3
TYPE tab_file,
trace1
TYPE tab_trace,
trace2
TYPE tab_trace,
in_both
TYPE tab_both,
itab1
TYPE tab_trace,
itab2
TYPE tab_trace,
out1
TYPE tab_trace,
out2
TYPE tab_trace,
out12
TYPE tab_both,
out_trace
TYPE tab_both,
head_texts
TYPE tab_texts,
event_texts
TYPE tab_texts,
agg_texts
TYPE tab_texts,
compare_texts
TYPE tab_texts,
scale_texts
TYPE tab_texts,
extra_texts
TYPE tab_texts,
alv_both
TYPE tab_alv_both,
gt_outtab
TYPE tab_alv_both,
gt_names_call
TYPE HASHED TABLE OF st_names WITH UNIQUE KEY actual,
gt_names_prog
TYPE HASHED TABLE OF st_names WITH UNIQUE KEY actual,
* Structures
off1
len1
off2
len2
header1

TYPE
TYPE
TYPE
TYPE
TYPE

st_off_len,
st_off_len,
st_off_len,
st_off_len,
st_header,

header2
pre_over_1
pre_over_2
scale1
scale2
extra1
extra2

st_header,
st_over,
st_over,
st_over,
st_over,
st_over,
st_over,

LIKE
LIKE
TYPE
TYPE
TYPE
TYPE
TYPE
TYPE
TYPE
TYPE
TYPE
TYPE
TYPE
TYPE
TYPE
TYPE
TYPE
TYPE
type
TYPE
TYPE
TYPE
TYPE
TYPE
TYPE
TYPE
TYPE

rlgrap-filename,
rlgrap-filename,
c,
c,
c,
i,
i,
i,
i,
c,
c,
c,
c,
c,
c,
c,
c,
c
VALUE
i
value
typ_numb
VALUE
i
VALUE
i
VALUE
c,
c,
c,
n,
n,

* Global Variables:
gv_locfile1
gv_locfile2
gv_alv
gv_funct(9)
gv_layout(9)
gv_factor
gv_n2
gv_n1
gv_limit
gv_line
gv_compare_full
gv_mult_1
gv_mult_2
gv_overflow(1)
gv_check
gv_check_alv
gv_check_itab
gv_itab
* gv_int_max
gv_int_max
gv_n_execs
gv_n_times
gv_error
gv_time_exec
gv_anonym
gv_numb_call(7)
gv_numb_prog(7)

TYPE
TYPE
TYPE
TYPE
TYPE
TYPE
TYPE

gv_text_extra0(125)
gv_text_extra1(125)
gv_text_extra2(125)
gv_text_extra3(125)
gv_text_extra4(125)

*
*
*
*
*
*

TYPE
TYPE
TYPE
TYPE
TYPE

'1',
'2147483647',
'1000000000000',
'1',
'1',

c,
c,
c,
c,
c,

gv_def_path
except_f
ilen
cline

TYPE
TYPE
TYPE
TYPE

typ_path,
typ_path,
i,
typ_cline.

OVERVIEW
N_LINEAR
D_CHECK
U_COMP
A_RATIO
A_DIFF

radiobutton
radiobutton
radiobutton
radiobutton
radiobutton
radiobutton

group
group
group
group
group
group

"Hilfsvariable fuer read dataset

A,
A,
A,
A,
A,
A,

*----------------------------------------------------------------------PARAMETERS:
hitlist1
TYPE typ_path
,
hitlist2
TYPE typ_path
,
n1(5)
TYPE n
,

n2(5)

TYPE n

a_ratio
a_diff
overview
u_comp

RADIOBUTTON
RADIOBUTTON
RADIOBUTTON
RADIOBUTTON

limit
full_agg
time_ex
anonym

TYPE i
DEFAULT'1000',
AS CHECKBOX,
AS CHECKBOX,
AS CHECKBOX.

*GET
*GET
*GET
*GET

PARAMETER
PARAMETER
PARAMETER
PARAMETER

id
id
id
id

'M_HIT1'
'M_HIT2'
'M_N1'
'M_N2'

,
GROUP
GROUP
GROUP
GROUP

a,
a,
a,
a,

field
field
field
field

Hitlist1.
Hitlist2.
N1.
N2.

*----------------------------------------------------------------------START-OF-SELECTION.
*
*
*
*
*
*
*
**
*
*
*
*
*
*
*
*
*
*
*
**
*
*
*

search Hitlist1 for ' '.


if sy-subrc eq 0.
ilen = sy-fdpos.
else.
ilen = '140'.
endif.
if ( ilen > '128' ).
write: / ' Length of Hitlist1 more than 128 characters'.
else.
gv_locfile1 = Hitlist1.
endif.
search Hitlist2 for ' '.
if sy-subrc eq 0.
ilen = sy-fdpos.
else.
ilen = '140'.
endif.
if ( ilen > '128' ).
write: / ' Length of Hitlist2 more than 128 characters'.
else.
gv_locfile2 = Hitlist2.
endif.

gv_locfile1 = hitlist1.
gv_locfile2 = hitlist2.
* Linearity factor:
gv_n2
= n2.
gv_n1
= n1.
gv_factor = gv_n2 / gv_n1.
IF ( gv_layout EQ 'NONLINEAR' ).
IF
( gv_factor = '0' ).
gv_error = 'X'.
WRITE: / 'Factor is missing, please insert'.
SKIP.
ENDIF.
ENDIF.

* Functions and Layouts:


IF
NOT ( overview IS INITIAL ).
CLEAR gv_alv.
* elseif not ( N_LINEAR is initial ).
*
gv_alv
= 'X'.
*
gv_funct = 'NONLINEAR'.
*
gv_layout = 'RATIO'.
*
gv_ratio = 'X'.
* elseif not ( D_CHECK is initial ).
*
gv_alv
= 'X'.
*
gv_funct = 'CHECK'.
*
gv_layout = 'RATIO'.
*
gv_ratio = 'X'.
*
gv_rest = '1'.
ELSEIF NOT ( u_comp IS INITIAL ).
gv_alv
= 'X'.
gv_funct = 'UNCOMP'.
gv_layout = 'UNCOMP'.
*
gv_rest = '2'.
ELSEIF NOT ( a_ratio IS INITIAL ).
gv_alv
= 'X'.
gv_funct = 'RATIO'.
gv_layout = 'RATIO'.
*
gv_ratio = 'X'.
ELSEIF NOT ( a_diff IS INITIAL ).
gv_alv
= 'X'.
gv_funct = 'DIFF'.
gv_layout = 'DIFF'.
*
clear gv_ratio.
ENDIF.
gv_limit
= limit.
IF NOT ( full_agg IS INITIAL ).
gv_compare_full = 'X'.
ENDIF.
IF NOT ( time_ex IS INITIAL ).
gv_time_exec = 'X'.
ENDIF.
IF NOT ( anonym IS INITIAL ).
gv_anonym = 'X'.
ENDIF.
END-OF-SELECTION.
*----------------------------------------------------------------------* Init: read file 1 and convert
*----------------------------------------------------------------------PERFORM check_filenames
USING
'1'
CHANGING gv_locfile1 header1-path header1-filename.
PERFORM check_filenames
USING
'2'
CHANGING gv_locfile2
PERFORM read_local_file
TABLES file_tab1
USING gv_locfile1

header2-path

'trace 1'.

IF ( gv_locfile1 EQ gv_locfile2 ).
gv_alv
= 'X'.

header2-filename.

gv_funct = 'ONE'.
gv_layout = 'ONE'.
file_tab2[] = file_tab1[].
ELSE.
PERFORM read_local_file
TABLES file_tab2
USING gv_locfile2 'trace 2'.
ENDIF.
*----------------------------------------------------------------------IF ( gv_error = 'X' ).
EXIT.
ENDIF.
* header1-locfile = gv_locfile1.
* header2-locfile = gv_locfile2.
*----------------------------------------------------------------------* Convert: Get layout and Convert
*----------------------------------------------------------------------PERFORM get_file_layout
TABLES
file_tab1
CHANGING len1 off1.
PERFORM get_file_layout
TABLES
file_tab2
CHANGING len2 off2.
PERFORM convert_file_loop
TABLES file_tab1
USING len1

trace1 itab1
head_texts event_texts
off1
pre_over_1 header1
'T1'.

PERFORM convert_file_loop
TABLES file_tab2
USING len2

trace2 itab2
head_texts event_texts
off2
pre_over_2 header2
'T2'.

* possible
IF NOT (
FORMAT
FORMAT
WRITE:
WRITE:

errorhandling:
gv_check IS INITIAL ).
INTENSIFIED ON.
COLOR OFF.
/ 'Trace 1 is empty (', gv_locfile1,')'.
/ 'Trace 2 is empty (', gv_locfile2,')'.

FORMAT RESET.
EXIT.
ENDIF.
*----------------------------------------------------------------------IF ( gv_error = 'X' ).
EXIT.
ENDIF.
*----------------------------------------------------------------------* handling of the trace, compare etc.
* internal tables separately
*---------------------------------------------------------------------PERFORM compare_events
TABLES trace1
trace2
itab1
itab2
in_both
USING header1
header2.
PERFORM filter_traces
TABLES in_both
out_trace
USING header2

trace1
scale_texts
scale2

trace2
scale1.

PERFORM extrapolate
TABLES extra_texts
USING scale2
extra2
extra1.
*----------------------------------------------------------------------IF ( gv_error = 'X' ).
EXIT.
ENDIF.
*---------------------------------------------------------------------* Output
*----------------------------------------------------------------------IF ( gv_alv IS INITIAL ).
PERFORM write_output
TABLES scale_texts extra_texts
USING header2 header1
pre_over_1 pre_over_2
scale1
scale2
extra1
extra2.
ELSE.
PERFORM fill_alv_text.
PERFORM write_details_alv
TABLES out_trace.
ENDIF.
hitlist1 = gv_locfile1.
hitlist2 = gv_locfile2.
************************************************************************
************************************************************************
* Block A: Uploadhandling
*
************************************************************************
*&---------------------------------------------------------------------*
*&
Form CHECK_FILENAMES
*&---------------------------------------------------------------------*
FORM check_filenames
USING
no
TYPE c
CHANGING p_locfile
TYPE rlgrap-filename
lv_path
TYPE rlgrap-filename
lv_filename TYPE rlgrap-filename.
DATA:
def_path
x_locfile
chkfile
l_exist
text
flag
le
file(300)
path(300)
p_filter
l_rc
l_up
l_file_tab
l_file_wa
l_file
l_user_action
p_path

TYPE
TYPE
TYPE
TYPE
TYPE
TYPE
TYPE
TYPE
TYPE
TYPE
TYPE
TYPE
TYPE
LIKE
TYPE
TYPE
TYPE

rlgrap-filename,
rlgrap-filename,
string,
c,
string,
c,
i,
c,
c,
string,
i,
i,
filetable,
LINE OF l_file_tab,
STANDARD TABLE OF string,
i,
string,

p_title

TYPE string

VALUE'Search'.

*----------------------------------------------------------------------* p_locfile is not initial


* try to get path path and/or p_file1 or p_file2
* try to create locfile1 and locfile2
*----------------------------------------------------------------------IF NOT ( p_locfile IS INITIAL ).
* split p_locfile into path and filename
IF ( p_locfile CS '\' ).
flag = 'X'.
WHILE ( flag EQ 'X' ).
file = p_locfile+le.
IF ( file CS '\' ).
le = le + sy-fdpos + 1.
ELSE.
CLEAR flag.
ENDIF.
ENDWHILE.
IF ( le > 0 ).
path = p_locfile(le).
ENDIF.
ENDIF.
* check file if p_locfile is more than a path
IF file IS NOT INITIAL.
text = p_locfile.
*-----add '.txt' to filename if necessary:
IF ( text CA '.txt' ).
chkfile = text.
ELSE.
CONCATENATE text '.txt' INTO chkfile.
ENDIF.
*-----check whether the file exists:
l_exist = cl_gui_frontend_services=>file_exist( file = chkfile ).
IF l_exist = 'X'.
p_locfile = chkfile.
ELSE.
CLEAR p_locfile.
ENDIF.
*---p_locfile is only a path
ELSE.
CLEAR p_locfile.
ENDIF.
ENDIF.
*----------------------------------------------------------------------* no or insufficient inputs to path and/or file
* get the file from selection
*----------------------------------------------------------------------IF ( p_locfile IS INITIAL ).
l_up = 1.
IF path IS NOT INITIAL.
p_path = path.
ELSE.

IF def_path IS NOT INITIAL.


p_path = def_path.
ENDIF.
ENDIF.
p_filter = cl_gui_frontend_services=>filetype_text.
WHILE ( l_rc < 1 OR l_rc > l_up ).
REFRESH l_file_tab[].

*
*

*
*
*
*
*
*
*
*
*

CALL METHOD cl_gui_frontend_services=>file_open_dialog


EXPORTING
window_title
= p_title
DEFAULT_EXTENSION
=
DEFAULT_FILENAME
=
file_filter
= p_filter
initial_directory
= p_path
multiselection
= 'X'
WITH_ENCODING
=
CHANGING
file_table
= l_file_tab
rc
= l_rc
user_action
= l_user_action
FILE_ENCODING
=
EXCEPTIONS
FILE_OPEN_DIALOG_FAILED = 1
CNTL_ERROR
= 2
ERROR_NO_GUI
= 3
NOT_SUPPORTED_BY_GUI
= 4
others
= 5
.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
IF l_user_action = cl_gui_frontend_services=>action_cancel.
LEAVE PROGRAM.
ENDIF.
ENDWHILE.
READ TABLE l_file_tab INTO l_file_wa INDEX 1.
IF ( sy-subrc EQ 0 ).

p_locfile = l_file_wa-filename.
* split p_locfile into path and filename
IF NOT ( p_locfile IS INITIAL ).
IF ( p_locfile CS '\' ).
flag = 'X'.
WHILE ( flag EQ 'X' ).
file = p_locfile+le.
IF ( file CS '\' ).
le = le + sy-fdpos + 1.
ELSE.
CLEAR flag.
ENDIF.
ENDWHILE.
IF ( le > 0 ).
def_path = p_locfile(le).
ENDIF.
ENDIF.

ENDIF.
ENDIF.
ENDIF.
lv_path
= def_path.
lv_filename = file.
* if
( no eq '1'
*
SET PARAMETER id
* elseif ( no eq '2'
*
SET PARAMETER id
* endif.

*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*

).
'M_HIT1' field p_locfile.
).
'M_HIT2' field p_locfile.

search Hitlist1 for ' '.


if sy-subrc eq 0.
ilen = sy-fdpos.
else.
ilen = '140'.
endif.
if ( ilen > '128' ).
write: / ' Length of Hitlist1 more than 128 characters'.
else.
gv_locfile1 = Hitlist1.
endif.
search Hitlist2 for ' '.
if sy-subrc eq 0.
ilen = sy-fdpos.
else.
ilen = '140'.
endif.
if ( ilen > '128' ).
write: / ' Length of Hitlist2 more than 128 characters'.
else.
gv_locfile2 = Hitlist2
endif.

ENDFORM.
"CHECK_FILENAMES
*&---------------------------------------------------------------------*
*&
Form READ_LOCAL_FILE
*&---------------------------------------------------------------------*
*
Read datafile from local PC file:
*
NOTE the function allows quite a few types in the interface
*
BUT only ASC ... is programed !!!!
*
*
Wkey_1: spreadsheet format !!
*----------------------------------------------------------------------*
FORM read_local_file
TABLES file_tab
TYPE tab_file
USING
p_locfile TYPE rlgrap-filename
c
TYPE c.
DATA: version(4)

TYPE c VALUE '6.20'.

*--------------------------------------------------------------* VERSION 4.6:


IF ( version EQ '4.6' ).

*
*
**
*
*
**
**
**
**
**
**
**
**
*
*
**
**
**
**
**
**
**
**
**
**
**

call function 'WS_UPLOAD'


exporting
CODEPAGE
filename
filetype
HEADLEN
LINE_EXIT
TRUNCLEN
USER_FORM
USER_PROG
DAT_D_FORMAT
IMPORTING
FILELENGTH
tables
data_tab
EXCEPTIONS
CONVERSION_ERROR
FILE_OPEN_ERROR
FILE_READ_ERROR
INVALID_TYPE
NO_BATCH
UNKNOWN_ERROR
INVALID_TABLE_WIDTH
GUI_REFUSE_FILETRANSFER
CUSTOMER_ERROR
OTHERS

=
=
=
=
=
=
=
=
=

' '
p_locfile
'ASC'
' '
' '
' '
' '
' '
' '

=
= file_tab
=
=
=
=
=
=
=
=
=
=

1
2
3
4
5
6
7
8
9
10.

*----------------------------------------------------------------------* Version 6.20


ELSE.
DATA: l_it_tab TYPE STANDARD TABLE OF string,
filename TYPE string,
transfer TYPE string,
l_wa_stfile TYPE st_file.
filename = p_locfile.

*
*
*
*
*
*
*
*
*
*

CALL METHOD cl_gui_frontend_services=>gui_upload


EXPORTING
filename
= filename
filetype
= 'ASC'
HAS_FIELD_SEPARATOR
= SPACE
HEADER_LENGTH
= 0
DAT_MODE
= SPACE
CODEPAGE
= SPACE
IGNORE_CERR
= ABAP_TRUE
REPLACEMENT
= '#'
READ_BY_LINE
= 'X'
IMPORTING
FILELENGTH
=
HEADER
=
CHANGING
data_tab
= l_it_tab
EXCEPTIONS
file_open_error
= 1
file_read_error
= 2
no_batch
= 3
gui_refuse_filetransfer = 4
invalid_type
= 5

no_authority
unknown_error
bad_data_format
header_not_allowed
separator_not_allowed
header_too_long
unknown_dp_error
access_denied
dp_out_of_memory
disk_full
dp_timeout
not_supported_by_gui
error_no_gui
OTHERS

=
=
=
=
=
=
=
=
=
=
=
=
=
=

6
7
8
9
10
11
12
13
14
15
16
17
18
19.

* no error:
IF sy-subrc EQ 0.
LOOP AT l_it_tab INTO transfer.
l_wa_stfile = transfer.
APPEND l_wa_stfile TO file_tab.
ENDLOOP.
ENDIF.
ENDIF.
* simple error-handling------------------IF sy-subrc NE 0.
gv_error = 'X'.
WRITE: / 'Error in method GUI-Upload of', c.
WRITE: / 'Exception Number:', sy-subrc.
SKIP.
ENDIF.
ENDFORM.
"read_local_file
************************************************************************
* Block B: Convert into internal format
*
************************************************************************
*&---------------------------------------------------------------------*
*&
Form GET_FILE_LAYOUT
*&---------------------------------------------------------------------*
*&---------------------------------------------------------------------*
FORM get_file_layout
TABLES
file
TYPE tab_file
CHANGING
off
TYPE st_off_len
len
TYPE st_off_len.
DATA:
pt_all_offsets

TYPE tab_offsets,

c_call(90)
c_caller(32)
c_execs(14)
c_gross(14)
c_net(14)
c_line(14)

TYPE
TYPE
TYPE
TYPE
TYPE
TYPE

c,
c,
c,
c,
c,
c,

nc_execs(9)
nc_gross(14)

TYPE c,
TYPE c,

nc_net(14)
nc_line(12)

TYPE c,
TYPE c,

numbers(35)
p
nc(6)
wa_names
count
count2

TYPE
TYPE
TYPE
TYPE
TYPE
TYPE

c,
p DECIMALS 4,
n,
st_names,
i,
i.

* Test Convert:------------------------------------------------LOOP AT file INTO cline.


* IF1: all lines not starting with '|' are ignored
IF ( cline(1) EQ '|' ).
* IF2: Summation line, ignore
IF ( cline(2) EQ '|*' ).
* Line with notes, ignore
ELSEIF ( cline(2) EQ '|&' ).
* Header line, determine layout, aggregation and language
ELSEIF ( cline+3(197) CS 'Net' ).
* IF3: 20061130: some traces can have several headers - only the first one is us
ed
IF ( count = '0' ).
*************************************************************
* search all offsets in cline with '|' and get names
PERFORM get_all_columns
TABLES pt_all_offsets
USING
cline.
* identify names
PERFORM identify_names
TABLES pt_all_offsets.
* identify names
PERFORM get_all_offsets
TABLES
pt_all_offsets
CHANGING off
len.
*************************************************************
count = 1.
ENDIF.
** Test one more line -------------------------ELSE.
count2 = count2 + 1.
IF ( count2 > 5 ).
EXIT.
ENDIF.
CLEAR c_call. CLEAR c_caller.
CLEAR c_execs. CLEAR c_gross. CLEAR c_net.
MOVE
MOVE
MOVE
MOVE
MOVE

cline+off-call(len-call)
cline+off-caller(len-caller)
cline+off-exec(len-exec)
cline+off-gross(len-gross)
cline+off-net(len-net)

* Line is optional:
c_line = '0'.

TO
TO
TO
TO
TO

c_call.
c_caller.
c_execs.
c_gross.
c_net.

IF ( len-line NE '0' ).
MOVE cline+off-line(len-line)
ENDIF.

TO c_line.

* replace and condense the fields containing number:


REPLACE ALL OCCURRENCES OF '.' IN c_execs WITH
REPLACE ALL OCCURRENCES OF '.' IN c_net WITH
REPLACE ALL OCCURRENCES OF '.' IN c_gross WITH
REPLACE ALL OCCURRENCES OF '.' IN c_line WITH
REPLACE
REPLACE
REPLACE
REPLACE

ALL
ALL
ALL
ALL

CONDENSE
CONDENSE
CONDENSE
CONDENSE

OCCURRENCES
OCCURRENCES
OCCURRENCES
OCCURRENCES

c_execs
c_gross
c_net
c_line

OF
OF
OF
OF

','
','
','
'.'

IN
IN
IN
IN

c_execs
c_net
c_gross
c_line

WITH
WITH
WITH
WITH

''.
''.
''.
''.
''.
''.
''.
''.

NO-GAPS.
NO-GAPS.
NO-GAPS.
NO-GAPS.

CONCATENATE c_execs c_gross c_net c_line


INTO numbers.
* tests:
IF ( numbers CO ' 0123456789.,' ).
ELSE.
gv_error = 'X'.
WRITE: / 'Only numbers allowed'.
SKIP.
ENDIF.
* 20061130 -some new traces set executions of 'Runtimes analysis'
IF ( c_call(7) EQ 'Runtime' AND c_execs = '0' ).
c_execs = '1'.
ENDIF.
ENDIF.
ENDIF.
ENDLOOP.
ENDFORM.
"PROCESS_OFFSETS
*&---------------------------------------------------------------------*
*&
Form 12111_GET_ALL_COLUMNS
*&---------------------------------------------------------------------*
*
Gets all offsets and text in header line
*----------------------------------------------------------------------*
FORM get_all_columns
TABLES pt_all_offsets TYPE tab_offsets
USING
cline
TYPE c.
*
*
*

DATA:
text(100)
int
off
wa
offset
length
count
cobj
c1

TYPE C,
TYPE i,
TYPE i,
TYPE st_offsets,
TYPE i,
TYPE i,
TYPE i,
TYPE typ_cline,
TYPE typ_cline.

* determine offset
offset = 1.

count = 1.
* search for the first offsets:
DO 30 TIMES.
*
offset = offset.
IF ( offset GE '400' ).
EXIT.
ENDIF.
cobj = cline+offset.
SEARCH cobj FOR '|'.
IF sy-subrc EQ 0.
length = sy-fdpos.
IF ( length GT '0' ).
c1
= cline+offset(length).
CONDENSE c1.
CLEAR wa.
wa-no = count.
wa-text = c1.
wa-offset = offset.
wa-length = length.
APPEND wa TO pt_all_offsets.
offset = offset + length + 1.
count = count + 1.
ENDIF.
ENDIF.
ENDDO.
ENDFORM.
"1211_GET_ALL_COLUMNS
*&---------------------------------------------------------------------*
*&
Form 1211_IDENTIFY_NAMES
*&---------------------------------------------------------------------*
* Typ A
NOT=Not aggregated:
*
8 Tabs/Offsets and 7 lengths of arbitrary size
*
*
1. N * Anz.
= No.
*
2. N * Brutto
= Gross
*
3. N * Netto
= Net
*
4. C * Aufruf
= Call
*
5. C
= In program
*
6. C * Typ
= Type
*
7. C
AnzFiltergruppe = Display filter group
*
*
* Typ B FULL= fully aggreagtate:
*
11 Tabs/Offsets and 10 Lengths of arbitrary size
*
*
1. C * Aufruf
= Call
*
2. N * Anz.
= No.
*
3. N * Brutto
= Gross
*
4.
=
*
5. N * Netto
= Net
*
6. N
Brut.%
= Gross(%)
*
7. N
Net.%
= Net(%)
*
8. C * Programmname
= Program Name
*
9. C * Typ
= Type
*
10. C
AnzFiltergruppe = Display filter group
*----------------------------------------------------------------------*

FORM identify_names
TABLES pt_all_offsets
DATA:
prod
wa
c1

TYPE tab_offsets.

TYPE f,
TYPE st_offsets,
TYPE typ_cline.

LOOP AT pt_all_offsets INTO wa.


c1
= wa-text.
* no used columns get 99 and 'xx'---------------------------* 99: %
IF
( c1 CS '%'
* 99: =
OR c1 CS '='
* 99: TYPE: Typ - Type.
OR c1 CS 'Typ'
OR c1 CS 'Type'
* 99 FILTER
OR c1 CS 'AnzFilter'
OR c1 CS 'No. Filter'
OR c1 CS 'Display Filter'
* 99 I and Subid
OR c1 = 'I'
OR c1 = 'S'
).
wa-fieldname = 'xx'.
wa-no_new
= '99'.
ELSE.
* Mandatory and optional fields------------------------------* PROG:
IF
( c1 CS 'Prog' ).
* 5 PROG: Rufendes - Calling - In Prog
IF
( c1 CS 'Rufendes'
OR c1 CS 'Calling'
OR c1 CS 'In Prog'
OR c1 CS 'Programmname'
OR c1 CS 'Program Name'
).
wa-fieldname = 'Caller'.
wa-no_new
= '5'.
* 9 CALLLED: geruf - Called
ELSEIF ( c1 CS 'Geruf'
OR c1 CS 'Source'
OR c1 CS 'Called'
OR c1 EQ 'Program' ).
wa-fieldname = 'Called'.
wa-no_new
= '9'.
ENDIF.
* 1 CALL - Aufruf
ELSEIF ( c1 CS 'Aufruf'
OR c1 CS 'Call'
OR c1 CS 'Statement'
OR c1 CS 'Hierarchy' ).
IF

( c1 CS '(cont.)' ).
wa-fieldname = 'CALL_2'.
wa-no_new
= '11'.

ELSE.
wa-fieldname = 'CALL'.
wa-no_new
= '1'.
ENDIF.
* 2 EXEC: Anz - No - Number
ELSEIF ( c1 CS 'Anz'
OR c1 CS 'No'
OR c1 CS 'Number'
OR c1 CS 'Hits' ).
wa-fieldname = 'Exec'.
wa-no_new
= '2'.
* 3 GROSS: Brutto - Gross
ELSEIF ( c1 CS 'Netto'
OR c1 CS 'Net' ).
wa-fieldname = 'Net'.
wa-no_new
= '3'.
* 4 GROSS: Brutto - Gross
ELSEIF ( c1 CS 'Brutto'
OR c1 CS 'Gross' ).
wa-fieldname = 'Gross'.
wa-no_new
= '4'.
* 6 LINE: Zeile - Line
ELSEIF ( c1 CS 'Zeile'
OR c1 CS 'Line'
OR c1 CS 'ContOff' ).
wa-fieldname = 'Line'.
wa-no_new
= '6'.
*--------------------------------------------------------* no original
ELSEIF ( c1(3) CS 'Bug'
).
wa-fieldname = 'Bug'.
wa-no_new
= '20'.
ENDIF.
ENDIF.
MODIFY pt_all_offsets FROM wa.
ENDLOOP.
* mandatory offsets:
SORT pt_all_offsets BY no_new.
LOOP AT pt_all_offsets INTO wa.
IF ( wa-fieldname IS INITIAL ).
BREAK-POINT.
ENDIF.
ENDLOOP.
ENDFORM.
"1211_IDENTIFY_NAMES
*&---------------------------------------------------------------------*
*&
Form GET_ALL_OFFSETS
*&---------------------------------------------------------------------*
*
*
1. CALL:
Aufruf, Call
*
2. EXEC:
Anz., No.
*
3. NET
Netto, Net*
*
4. GROSS
Brutto, Gross
*
5. CALLER Programmname, Programm, In program
*
6. LINE
*
7. CALL2
for ST12 longer Name
*
*&---------------------------------------------------------------------*
FORM get_all_offsets
TABLES

pt_all_offsets
CHANGING
off
len
DATA:
wa

TYPE tab_offsets
TYPE st_off_len
TYPE st_off_len.

TYPE st_offsets.

LOOP AT pt_all_offsets INTO wa.


IF

( wa-no_new EQ '01' ).
off-call
= wa-offset.
len-call
= wa-length.
ELSEIF ( wa-no_new EQ '02' ).
off-exec
= wa-offset.
len-exec
= wa-length.
ELSEIF ( wa-no_new EQ '03' ).
off-net
= wa-offset.
len-net
= wa-length.
ELSEIF ( wa-no_new EQ '04' ).
off-gross
= wa-offset.
len-gross
= wa-length.
ELSEIF ( wa-no_new EQ '05' ).
off-caller
= wa-offset.
len-caller
= wa-length.
ELSEIF ( wa-no_new EQ '06' ).
off-line
= wa-offset.
len-line
= wa-length.
ELSEIF ( wa-no_new EQ '07' ).
off-call2
= wa-offset.
len-call2
= wa-length.
ELSEIF ( wa-no_new EQ '09' ).
off-called
= wa-offset.
len-called
= wa-length.
ENDIF.
ENDLOOP.
ENDFORM.
"GET_ALL_OFFSETS
*&---------------------------------------------------------------------*
*&
Form DETERMINE_LANGUAGE_AGGREGATION
*&---------------------------------------------------------------------*
FORM determine_language_aggregation
USING
cline
TYPE c
CHANGING
aggregate
TYPE c
language
TYPE c.
DATA:
no_language

TYPE i.

* determine aggregate and language:


IF ( cline CS 'Anz'
OR cline CS 'Aufruf'
OR cline CS 'Brutto' ).
language = 'DE'.
no_language = 1.
ENDIF.
IF ( cline CS 'No'
OR cline CS 'Call'

OR cline CS 'Gross' ).
language = 'EN'.
no_language = no_language + 1.
ENDIF.
IF
( no_language = '1'
* everything o.k.
ELSEIF ( no_language = '0'
gv_error = 'X'.
WRITE: / 'E201: Language
SKIP.
ELSEIF ( no_language = '2'
gv_error = 'X'.
WRITE: / 'E201: Language
SKIP.
ENDIF.

).
).
can not be determined'.
).
can not be determined'.

* aggregation type
IF ( cline CS '=' ).
aggregate = 'NONE'.
ELSE.
aggregate = 'FULL'.
ENDIF.
ENDFORM.
"DETERMINE_LANGUAGE_AGGREGATION
*&---------------------------------------------------------------------*
*&
Form CONVERT_FILE_LOOP
*&---------------------------------------------------------------------*
*
Convert file to internal table
*
Release dependent file
*----------------------------------------------------------------------*
FORM convert_file_loop
TABLES file
TYPE tab_file
trace
TYPE tab_trace
trace_x
TYPE tab_trace
head_texts TYPE tab_texts
event_texts TYPE tab_texts
USING len
TYPE st_off_len
off
TYPE st_off_len
over
TYPE st_over
header
TYPE st_header
code
TYPE c.
DO 10 TIMES.
CLEAR gv_overflow.
PERFORM convert_file
TABLES file

trace

USING len
off over
IF ( gv_overflow = 'X' ).
ELSE.
EXIT.
ENDIF.
ENDDO.

trace_x
header

head_texts event_texts
code.

ENDFORM.
" CONVERT_FILE_LOOP
*&---------------------------------------------------------------------*
*&
Form CONVERT_FILE
*&---------------------------------------------------------------------*
*
Convert file to internal table

*
Release dependent file
*----------------------------------------------------------------------*
FORM convert_file
TABLES file
TYPE tab_file
trace
TYPE tab_trace
trace_x
TYPE tab_trace
head_texts
TYPE tab_texts
event_texts TYPE tab_texts
USING off
TYPE st_off_len
len
TYPE st_off_len
event
TYPE st_over
header
TYPE st_header
code
TYPE c.
DATA:
* event classes
type_a(2)
type_b(2)
type_c(2)
type_d(2)
type_e(2)
type_x(2)
type_z1(2)
type_z2(2)
type_z3(2)

TYPE
TYPE
TYPE
TYPE
TYPE
TYPE
TYPE
TYPE
TYPE

c
c
c
c
c
c
c
c
c

VALUE
VALUE
VALUE
VALUE
VALUE
VALUE
VALUE
VALUE
VALUE

'A',
'B',
'C',
'D',
'E',
'X',
'Z1',
'Z2',
'Z3',

text_abap(25)
text_rfc(25)
text_itab(25)
text_buf(25)
text_db(25)
text_x(25)
text_z(12)

TYPE
TYPE
TYPE
TYPE
TYPE
TYPE
TYPE

c
c
c
c
c
c
c

VALUE
VALUE
VALUE
VALUE
VALUE
VALUE
VALUE

'A
'B
'C
'D
'E
'X
'Z

abap_trace
rfc_trace
itab_trace
buf_trace
db_trace
x_trace
x_trace_x
z_trace
xyz_trace

TYPE
TYPE
TYPE
TYPE
TYPE
TYPE
TYPE
TYPE
TYPE

tab_trace,
tab_trace,
tab_trace,
tab_trace,
tab_trace,
tab_trace,
tab_trace,
tab_trace,
tab_trace,

sum_abap
sum_rfc
sum_it
sum_buf
sum_db
sum_x
sum_z

TYPE
TYPE
TYPE
TYPE
TYPE
TYPE
TYPE

p
p
p
p
p
p
p

count_abap
count_rfc
count_it
count_buf
count_db
count_x
count_z

TYPE
TYPE
TYPE
TYPE
TYPE
TYPE
TYPE

i,
i,
i,
i,
i,
i,
i,

DECIMALS
DECIMALS
DECIMALS
DECIMALS
DECIMALS
DECIMALS
DECIMALS

Modul Int
',
Modul Ext
',
Interal Tables
',
Data Access Internal',
Data Access External ',
Others
',
Special',

0,
0,
0,
0,
0,
0,
0,

sum_load
sum_xyz
sum_all
sum_class

TYPE
TYPE
TYPE
TYPE

p
p
p
p

count_runtime
count_load
count_xyz
count_all
count_class
no_rows

TYPE
TYPE
TYPE
TYPE
TYPE
TYPE

i,
i,
i,
i,
i,
i,

gross_runtime
gross_max
max_gross_type
net_runtime

TYPE
TYPE
LIKE
TYPE

p DECIMALS 0,
p DECIMALS 0,
trace-subtype,
p DECIMALS 0,

TYPE
TYPE
TYPE
TYPE
TYPE
TYPE
type
TYPE
TYPE
TYPE
TYPE
TYPE
TYPE
TYPE
TYPE
TYPE
TYPE
TYPE
TYPE
TYPE

p DECIMALS 4,
i,
n,
c,
c,
c,
c,
c,
c,
c,
c,
c,
c,
c,
c,
c,
c,
c,
st_names,
i.

* Itab numbers
p
offset
nc(6)
c_call(90)
c_caller(32)
c_called(32)
*
x_syst(4)
c_execs(14)
c_gross(14)
c_net(14)
c_id
c_subid
c_line(14)
nc_execs(9)
nc_gross(14)
nc_net(14)
nc_line(12)
numbers(35)
wa_names
count

DECIMALS
DECIMALS
DECIMALS
DECIMALS

0,
0,
0,
0,

*----------------------------------------------------------------------DESCRIBE TABLE file LINES no_rows.


no_rows = no_rows - 4.
* Convert:--------------------------------------------------CLEAR count.
LOOP AT file INTO cline.
* only lines with '|'
IF ( cline(1) EQ '|' ).
* No Summation line, ignore
IF
( cline(2) EQ '|*' ).
* Line with notes, ignore
ELSEIF ( cline(2) EQ '|&' ).
* Header line, determine layout, aggregation and language
ELSEIF ( cline CS 'Net' ).
* process if aggregation type is known:-------------------ELSE.
CLEAR c_call. CLEAR c_caller.
CLEAR c_execs. CLEAR c_gross. CLEAR c_net.

MOVE cline+off-call(len-call)
TO c_call.
MOVE cline+off-caller(len-caller) TO c_caller.
IF ( off-called <> 0 AND len-called <> 0 ).
MOVE cline+off-called(len-called) TO c_called.
ELSE.
c_called = ''.
ENDIF.
MOVE cline+off-exec(len-exec)
MOVE cline+off-gross(len-gross)
MOVE cline+off-net(len-net)

TO c_execs.
TO c_gross.
TO c_net.

* Line is optional
IF ( len-line NE '0' ).
MOVE cline+off-line(len-line)
ELSE.
c_line = '0'.
ENDIF.

TO c_line.

** ID and SUBID optional


*
if ( len_id ne '0' and len_subid ne '0' ).
*
move cline+off_id(len_id)
to c_id.
*
move cline+off_subid(len_subid) to c_subid.
*
endif.
* replace and condense the fields containing number:
REPLACE ALL OCCURRENCES OF '.' IN c_execs WITH
REPLACE ALL OCCURRENCES OF '.' IN c_net WITH
REPLACE ALL OCCURRENCES OF '.' IN c_gross WITH
REPLACE ALL OCCURRENCES OF '.' IN c_line WITH
REPLACE
REPLACE
REPLACE
REPLACE
CONDENSE
CONDENSE
CONDENSE
CONDENSE

ALL
ALL
ALL
ALL

OCCURRENCES
OCCURRENCES
OCCURRENCES
OCCURRENCES

c_execs
c_gross
c_net
c_line

OF
OF
OF
OF

','
','
','
'.'

IN
IN
IN
IN

c_execs
c_net
c_gross
c_line

WITH
WITH
WITH
WITH

''.
''.
''.
''.
''.
''.
''.
''.

NO-GAPS.
NO-GAPS.
NO-GAPS.
NO-GAPS.

CONCATENATE c_execs c_gross c_net c_line


INTO numbers.
* tests:
IF ( numbers CO ' 0123456789.,' ).
ELSE.
gv_error = 'X'.
WRITE: / 'Only numbers allowed'.
SKIP.
ENDIF.
* 20061130 -some new traces set executions of 'Runtimes analysis'
* - corrected
IF ( c_call(7) EQ 'Runtime' AND c_execs = '0' ).
c_execs = '1'.
ENDIF.
*
*

if ( c_execs = '0' ).
gv_error = 'X'.

*
*
*

write: / 'Number of executions zero should not appear'.


skip.
endif.

*-------------------------------------------------------------* Conversion and check for overflow


CLEAR trace.
trace-code = code.
trace-call = c_call.
trace-caller = c_caller.
IF ( c_caller IS INITIAL ).
trace-caller = c_called.
ENDIF.
trace-id
= c_id.
trace-subid = c_subid.
trace-line = c_line.
* values
nc_execs = c_execs.
nc_execs = nc_execs / gv_n_execs.
IF ( nc_execs < gv_int_max ).
trace-execs = nc_execs.
ELSE.
gv_n_execs = gv_n_execs * 10.
gv_overflow = 'X'.
ENDIF.
nc_gross = c_gross.
nc_gross = c_gross / gv_n_times.
nc_net
nc_net

= c_net.
= nc_net / gv_n_times.

IF ( nc_gross < gv_int_max


AND nc_net < gv_int_max ).
trace-gross = nc_gross.
trace-net = nc_net.
ELSE.
gv_n_times = gv_n_times * 10.
gv_overflow = 'X'.
ENDIF.
p
= trace-net / trace-execs.
trace-netdexec = p.
* Overflow:
IF ( gv_overflow = 'X' ).
gv_error = 'X'.
WRITE: / 'E111: Overflow'.
SKIP.
ENDIF.
*----------------------------------------------------------------------* types and subtypes:------------------------------------------------sum_all
= sum_all + trace-net.
count_all
= count_all + 1.
*---------------------------------------------------------------------* Start of classification:

* Type A: Modularisation
*
* functions---------------------------:
IF
( trace-call(10) EQ 'Call Func.'
).
trace-subtype = 'Call Function'.
trace-call
= trace-call+11.
trace-maintype = type_a.
ELSEIF ( trace-call(8) EQ 'Function' ).
trace-subtype = 'Call Function'.
trace-call
= trace-call+9.
trace-maintype = type_a.
* forms----------------------------------------------:
ELSEIF ( trace-call(7) EQ 'Perform' OR
trace-call(7) EQ 'PERFORM' ).
IF ( trace-call+8(3) EQ 'Ext' OR
trace-call+8(3) EQ 'EXT' ).
trace-subtype = 'Ext. Perform'.
trace-call
= trace-call+13.
ELSE.
trace-subtype = 'Perform'.
trace-call
= trace-call+8.
ENDIF.
trace-maintype = type_a.
* methods-------------------------------------------:
ELSEIF ( trace-call(7) EQ 'Call M.' ).
trace-subtype = 'Call Method'.
trace-call
= trace-call+8.
trace-maintype = type_a.
ELSEIF ( trace-call(11) EQ 'Call method' ).
trace-subtype = 'Call Method'.
trace-call
= trace-call+12.
trace-maintype = type_a.
*---------------------------------------------------------------------* B: remote function calls
ELSEIF ( trace-call(12) EQ 'Wait for RFC' ).
trace-subtype = 'Wait for RFC'.
trace-call
= trace-call+13.
trace-maintype = type_b.
ELSEIF ( trace-call(3) EQ 'Rfc'
OR trace-call(3) EQ 'RFC' ).
trace-subtype = 'RFC:'.
trace-call
= trace-call+4.
trace-maintype = type_b.
*---------------------------------------------------------------------* C: Internal tables:
ELSEIF ( trace-call(6) EQ 'Append'
).
trace-subtype = 'Append'.
trace-maintype = type_c.
*
nc
= trace-call+10.
*
trace-call
= nc.
trace-call
= trace-call+7.
ELSEIF ( trace-call(7) EQ 'Collect'
).
trace-subtype = 'Collect'.
trace-maintype = type_c.
*
nc
= trace-call+11.
*
trace-call
= nc.

*
*

*
*

*
*

trace-call
= trace-call+8.
ELSEIF ( trace-call(6) EQ 'Modify'
trace-subtype = 'Modify'.
trace-maintype = type_c.
nc
= trace-call+10.
trace-call
= nc.
trace-call
= trace-call+7.
ELSEIF ( trace-call(7) EQ 'Loop at'
trace-subtype = 'Loop at'.
trace-maintype = type_c.
nc
= trace-call+11.
trace-call
= nc.
trace-call
= trace-call+8.
ELSEIF ( trace-call(4) EQ 'Sort'
trace-subtype = 'Sort'.
trace-maintype = type_c.
nc
= trace-call+8.
trace-call
= nc.
trace-call
= trace-call+5.

).

).

).

** Very similar events can appear on buffered tables


** Read Table, Delete, Insert
ELSEIF ( trace-call(10) EQ 'Read Table' ).
trace-subtype = 'Read Table'.
trace-maintype = type_c.
*
nc
= trace-call+14.
*
trace-call
= nc.
trace-call
= trace-call+11.
ELSEIF ( trace-call(6) EQ 'Delete'
).
trace-subtype = 'Delete'.
trace-maintype = type_c.
*
nc
= trace-call+10.
*
trace-call
= nc.
trace-call
= trace-call+7.
ELSEIF ( trace-call(6) EQ 'Insert'
).
trace-subtype = 'Insert'.
trace-maintype = type_c.
*
nc
= trace-call+10.
*
trace-call
= nc.
trace-call
= trace-call+7.
*---------------------------------------------------------------------* D: Buffer
ELSEIF ( trace-call(10) EQ 'DB-Buffer:'
OR trace-call(10) EQ 'DB Buffer:' ).
trace-maintype = type_d.
IF
( trace-call+11(5) EQ 'Close' ).
trace-subtype = 'DB-Buffer: Close'.
trace-call
= trace-call+17.
ELSEIF ( trace-call+11(4) EQ 'Open' ).
trace-subtype = 'DB-Buffer: Open'.
trace-call
= trace-call+16.
ELSEIF ( trace-call+11(5) EQ 'Fetch' ).
trace-subtype = 'DB-Buffer: Fetch'.
trace-call
= trace-call+17.
ELSEIF ( trace-call+11(3) EQ 'Get' ).
trace-subtype = 'DB-Buffer: Get'.
trace-call
= trace-call+15.
ELSEIF ( trace-call+11(4) EQ 'Load' ).

trace-subtype = 'DB-Buffer: Load'.


trace-call
= trace-call+16.
ELSEIF ( trace-call+11(6) EQ 'Modify' ).
trace-subtype = 'DB-Buffer: Modify'.
trace-call
= trace-call+18.
ELSE.
trace-maintype = type_z3.
ENDIF.
* Data Buffer:
ELSEIF ( trace-call(23) EQ 'Import FROM DATA BUFFER'
OR trace-call(23) EQ 'Import From Data Buffer' ).
trace-subtype = 'Import from Data buffer'.
trace-call
= trace-call+24.
trace-maintype = type_d.
ELSEIF ( trace-call(21) EQ 'Export TO DATA BUFFER'
OR trace-call(21) EQ 'Export To Data Buffer' ).
trace-subtype = 'Export to Data buffer'.
trace-call
= trace-call+22.
trace-maintype = type_d.
* Memory
ELSEIF ( trace-call(16) EQ 'Export to Memory'
OR trace-call(16) EQ 'Export To Memory' ).
trace-subtype = 'Export to Memory'.
trace-call
= trace-call+17.
trace-maintype = type_d.
ELSEIF ( trace-call(18) EQ 'Import from Memory'
OR trace-call(18) EQ 'Import From Memory' ).
trace-subtype = 'Import from Memory'.
trace-call
= trace-call+19.
trace-maintype = type_d.
ELSEIF ( trace-call(23) EQ 'Export to Shared Buffer'
OR trace-call(23) EQ 'Export To Shared Buffer' ).
trace-subtype = 'Export to Shared Buffer'.
trace-call
= trace-call+24.
trace-maintype = type_d.
ELSEIF ( trace-call(25) EQ 'Import from Shared Buffer'
OR trace-call(25) EQ 'Import From Shared Buffer' ).
trace-subtype = 'Import from Shared Buffer'.
trace-call
= trace-call+26.
trace-maintype = type_d.
ELSEIF ( trace-call(23) EQ 'Export to Shared Memory'
OR trace-call(23) EQ 'Export To Shared Memory' ).
trace-subtype = 'Export to Shared Memory'.
trace-call
= trace-call+24.
trace-maintype = type_d.
ELSEIF ( trace-call(25) EQ 'Import from Shared Memory'
OR trace-call(25) EQ 'Import From Shared Memory' ).
trace-subtype = 'Import from Shared Memory'.
trace-call
= trace-call+26.
trace-maintype = type_d.
ELSEIF ( trace-call(21) EQ 'Export internal table').
trace-subtype = 'Export to internal table'.
trace-call
= trace-call+24.
trace-maintype = type_d.
ELSEIF ( trace-call(24) EQ 'Export To Internal Table').
trace-subtype = 'Export to internal table'.
trace-call
= trace-call+26.
trace-maintype = type_d.

ELSEIF ( trace-call(21) EQ 'Import internal table').


trace-subtype = 'Import internal table'.
trace-call
= trace-call+22.
trace-maintype = type_d.
ELSEIF ( trace-call(26) EQ 'Import From Internal Table').
trace-subtype = 'Import from internal table'.
trace-call
= trace-call+27.
trace-maintype = type_d.
* DBMS Part of the DB Statement!
ELSEIF ( trace-call(11) EQ 'Open Cursor' ).
trace-subtype = 'Open Cursor'.
trace-call
= trace-call+12.
trace-maintype = type_d.
ELSEIF ( trace-call(12) EQ 'Close Cursor' ).
trace-subtype = 'DB: Close Cursor'.
trace-call
= trace-call+13.
trace-maintype = type_d.
ELSEIF ( trace-call(5) EQ 'Fetch' ).
trace-subtype = 'DB: Fetch'.
trace-call
= trace-call+6.
trace-maintype = type_d.
*----------------------------------------------------------------------* E: Database operations external:
* DB Op.
ELSEIF ( trace-call(6) EQ 'DB-Op.'
OR trace-call(3) EQ 'DB:'
).
trace-maintype = type_e.
IF
( trace-call(17) EQ 'DB-Op. OpenCursor' ).
trace-subtype = 'DB: Open Cursor'.
trace-call
= trace-call+18.
ELSEIF ( trace-call(18) EQ 'DB-Op. CloseCursor' ).
trace-subtype = 'DB: Close Cursor'.
trace-call
= trace-call+19.
ELSEIF ( trace-call(18) EQ 'DB-Op. FetchCursor' ).
trace-subtype = 'DB: Fetch Cursor'.
trace-call
= trace-call+19.
ELSEIF ( trace-call(17) EQ 'DB-Op. ExecStatic' ).
trace-subtype = 'DB: Exec Static'.
trace-call
= trace-call+18.
ELSEIF ( trace-call(11) EQ 'DB-Op. Exec'
).
trace-subtype = 'DB: Exec'.
trace-call
= trace-call+12.
ELSEIF ( trace-call(8) EQ 'DB: Exec'
).
trace-subtype = 'DB: Exec'.
trace-call
= trace-call+9.
ELSEIF ( trace-call(12) EQ 'DB-Op. Fetch'
).
trace-subtype = 'DB: Fetch'.
trace-call
= trace-call+13.
ELSEIF ( trace-call(12) EQ 'DB-Op. Close'
).
trace-subtype = 'DB: Close'.
trace-call
= trace-call+13.
ELSEIF ( trace-call(9) EQ 'DB: Fetch'
).
trace-subtype = 'DB: Fetch'.
trace-call
= trace-call+10.
ELSEIF ( trace-call(11) EQ 'DB-Op. Open'
).
trace-subtype = 'DB: Open Cursor'.
trace-call
= trace-call+12.
ELSEIF ( trace-call(8) EQ 'DB: Open'
).

trace-subtype = 'DB: Open Cursor'.


trace-call
= trace-call+9.
ELSEIF ( trace-call(15) EQ 'DB-Op. PrepStmt'
trace-subtype = 'DB: Prep Stmt.'.
trace-call
= trace-call+16.
ELSEIF ( trace-call(11) EQ 'DB-Op. Prep'
trace-subtype = 'DB: Prepare'.
trace-call
= trace-call+12.
ELSEIF ( trace-call(11) EQ 'DB: Prepare'
trace-subtype = 'DB: Prepare'.
trace-call
= trace-call+12.
* unrecognized
ELSE.
trace-maintype = type_z3.
ENDIF.

).
).
).

*-----ELSEIF ( trace-call(13) EQ 'Select Single' ).


trace-subtype = 'Select Single'.
trace-call
= trace-call+14.
trace-maintype = type_e.
* Special in ST12: SELECT
ELSEIF ( trace-call(6) EQ 'Select' ).
trace-subtype = 'Select'.
trace-call
= trace-call+7.
trace-maintype = type_e.
ELSEIF ( trace-call(15) EQ 'Select Count(*)' ).
trace-subtype = 'Select Count(*)'.
trace-call
= trace-call+16.
trace-maintype = type_e.
ELSEIF ( trace-call(11) EQ 'Commit Work' ).
trace-subtype = 'Commit Work'.
trace-call
= trace-call+12.
trace-maintype = type_e.
ELSEIF ( trace-call(13) EQ 'NatSQL Commit' ).
trace-subtype = 'NatSQL Commit'.
trace-call
= trace-call+14.
trace-maintype = type_e.
ELSEIF ( trace-call(19) EQ 'NatSQL SelectSingle' ).
trace-subtype = 'NatSQL Sel Single'.
trace-call
= trace-call+20.
trace-maintype = type_e.
ELSEIF ( trace-call(24) EQ 'NatSQL Execute Procedure' ).
trace-subtype = 'NatSQL Exec Procedure'.
trace-call
= trace-call+25.
trace-maintype = type_e.
* Native SQL
ELSEIF ( trace-call(11) EQ 'Native SQL:' ).
trace-maintype = type_e.
IF
( trace-call+12(16) EQ 'Execute Procedure' ).
trace-subtype = 'Native SQL: Exec Procedure'.
trace-call
= trace-call+30.
ELSEIF ( trace-call+12(14) EQ 'Set Connection' ).
trace-subtype = 'Native SQL: Set Connection'.
trace-call
= trace-call+28.
ELSEIF ( trace-call+12(12) EQ 'SelectSingle' ).
trace-subtype = 'Native SQL: Select Single'.
trace-call
= trace-call+26.
ELSEIF ( trace-call+12(6) EQ 'Conect' ).

trace-subtype = 'Native SQL: Connect'.


trace-call
= trace-call+19.
ELSEIF ( trace-call+12(6) EQ 'Commit' ).
trace-subtype = 'Native SQL: Commit'.
trace-call
= trace-call+19.
ENDIF.
ELSEIF ( trace-call(6) EQ 'Update'
trace-subtype = 'Update'.
trace-call
= trace-call+7.
trace-maintype = type_e.
ELSEIF ( trace-call(6) EQ 'Insert'
trace-subtype = 'Insert'.
trace-call
= trace-call+7.
trace-maintype = type_e.
ELSEIF ( trace-call(12) EQ 'Array Insert'
trace-subtype = 'Array Insert'.
trace-call
= trace-call+13.
trace-maintype = type_e.
ELSEIF ( trace-call(12) EQ 'Array Update'
trace-subtype = 'Array Update'.
trace-call
= trace-call+13.
trace-maintype = type_e.
ELSEIF ( trace-call(12) EQ 'Array Delete'
trace-subtype = 'Array Delete'.
trace-call
= trace-call+13.
trace-maintype = type_e.
ELSEIF ( trace-call(12) EQ 'Array Modify'
trace-subtype = 'Array Modify'.
trace-call
= trace-call+13.
trace-maintype = type_e.
ELSEIF ( trace-call(6) EQ 'Delete'
trace-subtype = 'Delete'.
trace-call
= trace-call+7.
trace-maintype = type_e.

).

).

).

).

).

).

).

* Nametab, Textpool, Export, Import


ELSEIF ( trace-call(20) EQ 'Import from Database'
OR trace-call(20) EQ 'Import From Database' ).
trace-subtype = 'Import from Database'.
trace-call
= trace-call+21.
trace-maintype = type_e.
ELSEIF ( trace-call(18) EQ 'Export to Database'
OR trace-call(18) EQ 'Export To Database' ).
trace-subtype = 'Export to Database'.
trace-call
= trace-call+18.
trace-maintype = type_e.
ELSEIF ( trace-call(14) EQ 'Import Nametab' ).
trace-subtype = 'Import Namtab'.
trace-call
= trace-call+15.
trace-maintype = type_e.
ELSEIF ( trace-call(14) EQ 'Export Nametab' ).
trace-subtype = 'Export FROM DB'.
trace-call
= trace-call+15.
trace-maintype = type_e.
ELSEIF ( trace-call(13) EQ 'Read Textpool' ).
trace-subtype = 'Read Textpool'.
trace-call
= trace-call+14.
trace-maintype = type_e.
ELSEIF ( trace-call(11) EQ 'Read Report' ).

trace-subtype = 'Read Report'.


trace-call
= trace-call+12.
trace-maintype = type_e.
*----------------------------------------------------------------------* X: System:
* elseif ( x_syst(4) eq 'Syst' or x_syst(4) eq 'Sys.' ).
ELSEIF ( trace-call(11) EQ 'Storage Get').
trace-subtype = 'Storage Get'.
trace-call
= trace-call+12.
trace-maintype = type_x.
ELSEIF ( trace-call(12) EQ 'Storage Free').
trace-subtype = 'Storage Free'.
trace-call
= trace-call+13.
trace-maintype = type_x.
ELSEIF ( trace-call(16) EQ 'Pgm-Globals Init').
trace-subtype = 'Pgm-Globals Init'.
trace-call
= trace-call+17.
trace-maintype = type_x.
ELSEIF ( trace-call(10) EQ 'PXA-Search').
trace-subtype = 'PXA-Search'.
trace-call
= trace-call+11.
trace-maintype = type_x.
ELSEIF ( trace-call(19) EQ 'Export, Import, ...').
trace-subtype = 'Export, Import, ...'.
trace-call
= trace-call+20.
trace-maintype = type_x.
* Dynpro Screen .....
ELSEIF ( trace-call(10) EQ 'DCI Dynpro'
trace-subtype = 'DCI Dynpro'.
trace-call
= trace-call+11.
trace-maintype = type_x.
ELSEIF ( trace-call(10) EQ 'DCI Screen'
trace-subtype = 'DCI Screen'.
trace-call
= trace-call+11.
trace-maintype = type_x.
ELSEIF ( trace-call(10) EQ 'DCO Dynpro'
trace-subtype = 'DCO Dynpro'.
trace-call
= trace-call+11.
trace-maintype = type_x.
ELSEIF ( trace-call(10) EQ 'DCO Screen'
trace-subtype = 'DCO Screen'.
trace-call
= trace-call+11.
trace-maintype = type_x.
ELSEIF ( trace-call(10) EQ 'EOD Dynpro'
trace-subtype = 'EOD Dynpro'.
trace-call
= trace-call+11.
trace-maintype = type_x.
ELSEIF ( trace-call(10) EQ 'EOD Screen'
trace-subtype = 'EOD Screen'.
trace-call
= trace-call+11.
trace-maintype = type_x.
ELSEIF ( trace-call(10) EQ 'PAI Dynpro'
trace-subtype = 'PAI Dynpro'.
trace-call
= trace-call+11.
trace-maintype = type_x.
ELSEIF ( trace-call(10) EQ 'PAI screen'
trace-subtype = 'PAI Screen'.
trace-call
= trace-call+11.

).

).

).

).

).

).

).

).

trace-maintype = type_x.
ELSEIF ( trace-call(10) EQ 'PBO Dynpro' ).
trace-subtype = 'PBO Dynpro'.
trace-call
= trace-call+11.
trace-maintype = type_x.
ELSEIF ( trace-call(10) EQ 'PBO screen' ).
trace-subtype = 'PBO Screen'.
trace-call
= trace-call+11.
trace-maintype = type_x.
ELSEIF ( trace-call(12) EQ 'Dynpro Entry').
trace-subtype = 'Dynpro Entry'.
trace-call
= trace-call+13.
trace-maintype = type_x.
ELSEIF ( trace-call(10) EQ 'Set Screen'
OR trace-call(10) EQ 'Set screen' ).
trace-subtype = 'Set Screen'.
trace-call
= trace-call+11.
trace-maintype = type_x.
ELSEIF ( trace-call(11) EQ 'Call screen' ).
trace-subtype = 'Call Screen'.
trace-call
= trace-call+12.
trace-maintype = type_x.
ELSEIF ( trace-call(12) EQ 'Screen entry' ).
trace-subtype = 'Screen Entry'.
trace-call
= trace-call+13.
trace-maintype = type_x.
* Message ....
ELSEIF ( trace-call(15) EQ 'Diag Message In' ).
trace-subtype = 'Diag Message In'.
trace-call
= trace-call+16.
trace-maintype = type_x.
ELSEIF ( trace-call(16) EQ 'Diag Message Out' ).
trace-subtype = 'Diag Message Out'.
trace-call
= trace-call+17.
trace-maintype = type_x.
ELSEIF ( trace-call(7) EQ 'Message' ).
trace-subtype = 'Message'.
trace-call
= trace-call+8.
trace-maintype = type_x.
ELSEIF ( trace-call(23) EQ 'Dyn. Assign Dyn. Assign' ).
trace-subtype = 'Dyn. Assign'.
trace-call
= trace-call+24.
trace-maintype = type_x.
ELSEIF ( trace-call(11) EQ 'Dyn. Assign' ).
trace-subtype = 'Dyn. Assign'.
trace-call
= trace-call+12.
trace-maintype = type_x.
ELSEIF ( trace-call(12) EQ 'ASSIGN (dyn)' ).
trace-subtype = 'Dyn. Assign'.
trace-call
= trace-call+13.
trace-maintype = type_x.
ELSEIF ( trace-call(16) EQ 'Call Transaction'
OR trace-call(16) EQ 'Call transaction' ).
trace-subtype = 'Call Transaction'.
trace-call
= trace-call+17.
trace-maintype = type_x.
ELSEIF ( trace-call(13) EQ 'Submit report'
OR trace-call(13) EQ 'Submit Report' ).

trace-subtype = 'Submit Report'.


trace-call
= trace-call+14.
trace-maintype = type_x.
ELSEIF ( trace-call(6) EQ 'Demand'
).
trace-subtype = 'Demand'.
trace-call
= trace-call+7.
trace-maintype = type_x.
ELSEIF ( trace-call(15) EQ 'Generate Report'
OR trace-call(15) EQ 'Generate report' ).
trace-subtype = 'Generate Report'.
trace-call
= trace-call+16.
trace-maintype = type_x.
ELSEIF ( trace-call(8) EQ 'Raise E.' ).
trace-subtype = 'Raise Event'.
trace-call
= trace-call+9.
trace-maintype = type_x.
ELSEIF ( trace-call(11) EQ 'Raise event' ).
trace-subtype = 'Raise Event'.
trace-call
= trace-call+12.
trace-maintype = type_x.
ELSEIF ( trace-call(12) EQ 'Event Module'
OR trace-call(12) EQ 'Event module' ).
trace-subtype = 'Event Module'.
trace-call
= trace-call+13.
trace-maintype = type_x.
ELSEIF ( trace-call(7) EQ 'Program' ).
trace-subtype = 'Program'.
trace-call
= trace-call+8.
trace-maintype = type_x.
ELSEIF ( trace-call(6) EQ 'Supply' ).
trace-subtype = 'Supply'.
trace-call
= trace-call+7.
trace-maintype = type_x.
ELSEIF ( trace-call(12) EQ 'Set Titlebar' ).
trace-subtype = 'Event'.
trace-call
= trace-call+13.
trace-maintype = type_x.
ELSEIF ( trace-call(10) EQ 'Set locale' ).
trace-subtype = 'Event'.
trace-call
= trace-call+11.
trace-maintype = type_x.
ELSEIF ( trace-call(13) EQ 'Set PF-Status' ).
trace-subtype = 'Set PF-Status'.
trace-call
= trace-call+14.
trace-maintype = type_x.
ELSEIF ( trace-call(16) EQ 'Syn-Check for IT'
OR trace-call(16) EQ 'Syn-check for IT').
trace-subtype = 'Syn-Check forf IT'.
nc
= trace-call+17.
trace-call
= nc.
trace-maintype = type_x.
ELSEIF ( trace-call(11) EQ 'Module(PAI)' ).
trace-subtype = 'Module PAI'.
trace-call
= trace-call+12.
trace-maintype = type_x.
ELSEIF ( trace-call(10) EQ 'Module PAI' ).
trace-subtype = 'Module PAI'.
trace-call
= trace-call+11.
trace-maintype = type_x.
ELSEIF ( trace-call(11) EQ 'Module(PBO)' ).

trace-subtype = 'Module PBO'.


trace-call
= trace-call+12.
trace-maintype = type_x.
ELSEIF ( trace-call(10) EQ 'Module PBO' ).
trace-subtype = 'Module PBO'.
trace-call
= trace-call+11.
trace-maintype = type_x.
ELSEIF ( trace-call(4) EQ 'Call'
OR trace-call(4) EQ 'CALL' ).
trace-subtype = 'Call'.
trace-call
= trace-call+5.
trace-maintype = type_x.
ELSEIF ( trace-call(5) EQ 'Event' ).
trace-subtype = 'Event'.
trace-call
= trace-call+6.
trace-maintype = type_x.
ELSEIF ( trace-call(12) EQ 'System Event' ).
trace-subtype = 'System Event'.
trace-call
= trace-call+12.
trace-maintype = type_x.
ELSEIF ( trace-call(11) EQ 'ENHANCEMENT' ).
trace-subtype = 'Enhancement'.
trace-call
= trace-call+12.
trace-maintype = type_x.
*----------------------------------------------------------------------* type Z: Runtime, Load, not classified
* Runtimes analysis:
ELSEIF ( trace-call(16) EQ 'Runtime analysis'
OR trace-call(16) EQ 'Runtime Analysis').
trace-subtype = 'Runtime Analysis'.
trace-call
= trace-call+17.
trace-maintype = type_z1.
* Load:
ELSEIF ( trace-call(11) EQ 'Load Dynpro' ).
trace-subtype = 'Load Dynpro'.
trace-call
= trace-call+12.
trace-maintype = type_z2.
ELSEIF ( trace-call(15) EQ 'Generate Dynpro' ).
trace-subtype = 'Generate Dynpro'.
trace-call
= trace-call+16.
trace-maintype = type_z2.
ELSEIF ( trace-call(11) EQ 'Load Report'
OR trace-call(11) EQ 'Load report' ).
trace-subtype = 'Load Report'.
trace-call
= trace-call+12.
trace-maintype = type_z2.
ELSEIF ( trace-call(11) EQ 'Load screen' ).
trace-subtype = 'Load Screen'.
trace-call
= trace-call+12.
trace-maintype = type_z2.
ELSEIF ( trace-call(16) EQ 'Load CUA Objects').
trace-subtype = 'Load CUA Objects'.
trace-call
= trace-call+17.
trace-maintype = type_z2.
ELSEIF ( trace-call(19) EQ 'Impl. generation of'

OR trace-call(19) EQ 'Impl. Generation of' ).


trace-subtype = 'Impl. Generation'.
trace-call
= trace-call+20.
trace-maintype = type_z2.
* no classified
ELSE.
trace-maintype = type_z3.
ENDIF.
ENDIF.
*-------------------------end of classification-------------------------------------------* Postprocess Methods-------------------------------------------:
IF ( trace-subtype = 'Call Method' ).
* newer version:
IF
( trace-call CS '{' ).
c_call = trace-call.
REPLACE ALL OCCURRENCES OF '{' IN c_call WITH ''.
REPLACE ALL OCCURRENCES OF '}' IN c_call WITH ''.
SEARCH c_call FOR 'CL'.
IF sy-subrc EQ 0.
offset = sy-fdpos.
c_call = c_call+offset.
ENDIF.
trace-call = c_call.
ELSEIF ( trace-call CS '<' ).
c_call = trace-call.
SEARCH c_call FOR 'CL_'.
IF sy-subrc EQ 0.
offset = sy-fdpos.
c_call = c_call+offset.
ENDIF.
SEARCH c_call FOR 'CX_'.
IF sy-subrc EQ 0.
offset = sy-fdpos.
c_call = c_call+offset.
ENDIF.
REPLACE ALL OCCURRENCES OF '>-' IN c_call WITH '-'.
REPLACE ALL OCCURRENCES OF '}' IN c_call WITH ''.
trace-call = c_call.
ENDIF.
ENDIF.
* calls must be changed, but only for non-itabs
IF ( gv_anonym EQ 'X' ).
IF ( trace-maintype NE type_c ).
READ TABLE gt_names_call
INTO wa_names
WITH TABLE KEY actual = trace-call.
IF ( sy-subrc NE '0' ).
gv_numb_call = gv_numb_call + 1.
CONCATENATE 'NAME' gv_numb_call INTO wa_names-numbered.
wa_names-actual = trace-call.
INSERT wa_names INTO TABLE gt_names_call.
*
with key actual = wa_names-actual.
ENDIF.

trace-call = wa_names-numbered.
ENDIF.
* programs
READ TABLE gt_names_prog
INTO wa_names
WITH TABLE KEY actual = trace-caller.
IF ( sy-subrc NE '0' ).
gv_numb_prog = gv_numb_prog + 1.
CONCATENATE 'PROG' gv_numb_prog INTO wa_names-numbered.
wa_names-actual = trace-caller.
INSERT wa_names INTO TABLE gt_names_prog.
*
with key actual = wa_names-actual.
ENDIF.
trace-caller = wa_names-numbered.
ENDIF.
*-----------------------------------------------------------------------------------------IF
( trace-maintype EQ type_a ).
trace-maintype = 'A Mod. Int'.
APPEND trace TO abap_trace.
sum_abap = sum_abap + trace-net.
count_abap = count_abap + 1.
ELSEIF ( trace-maintype EQ type_b ).
trace-maintype = 'B Mod. Ext'.
sum_rfc
= sum_rfc + trace-net.
count_rfc
= count_rfc + 1.
APPEND trace TO rfc_trace.
ELSEIF ( trace-maintype EQ type_c ).
IF ( header-line EQ 'X' ).
trace-call
= 'IT'.
ENDIF.
trace-maintype = 'C ITabs'.
APPEND trace TO itab_trace.
sum_it
= sum_it + trace-net.
count_it
= count_it + 1.
ELSEIF ( trace-maintype EQ type_d ).
trace-maintype = 'D Data Int'.
sum_buf
= sum_buf + trace-net.
count_buf
= count_buf + 1.
APPEND trace TO buf_trace.
ELSEIF ( trace-maintype EQ type_e ).
trace-maintype = 'E Data Ext'.
sum_db
= sum_db + trace-net.
count_db
= count_db + 1.
APPEND trace TO db_trace.
ELSEIF ( trace-maintype EQ type_x ).
trace-maintype = 'X Others '.
sum_x
= sum_x + trace-net.
count_x
= count_x + 1.
IF ( trace-subtype = 'Export to Memory'
OR trace-subtype = 'Import from Memory' ).
APPEND trace TO x_trace_x.
ELSE.
APPEND trace TO x_trace.
ENDIF.
ELSEIF ( trace-maintype EQ type_z1 ).

trace-maintype = 'Z Special '.


APPEND trace TO z_trace.
gross_runtime = trace-gross.
net_runtime
= trace-net.
count_runtime = count_runtime + 1.
ELSEIF ( trace-maintype EQ type_z2 ).
trace-maintype = 'Z Special '.
sum_load
= sum_load + trace-net.
count_load
= count_load + 1.
APPEND trace TO z_trace.
ELSEIF ( trace-maintype EQ type_z3 ).
trace-maintype = 'Z Special '.
trace-subtype = 'XYZ'.
APPEND trace TO z_trace.
sum_xyz
= sum_xyz + trace-net.
count_xyz
= count_xyz + 1.
ENDIF.
ENDIF.
* max gross time for call ne 'Runtime Analysis'
IF ( trace-gross > gross_max
AND trace-subtype NE 'Runtime Analysis' ).
gross_max
= trace-gross.
max_gross_type = trace-subtype.
ENDIF.
CLEAR trace.
ENDLOOP.
* possiblity to separate different trace types, but no used------------APPEND LINES OF abap_trace TO trace[].
APPEND LINES OF rfc_trace TO trace[].
* itab see below
APPEND LINES OF buf_trace TO trace[].
APPEND LINES OF db_trace TO trace[].
APPEND LINES OF x_trace
TO trace[].
APPEND LINES OF z_trace
TO trace[].
* itab entries are always handled separately
APPEND LINES OF itab_trace TO trace_x[].
APPEND LINES OF x_trace_x TO trace_x[].
* Sums: ------------------------------------------------------------* Test:
sum_z
count_z
sum_class

=
=
=
+
count_class =
+
+

net_runtime + sum_load + sum_xyz.


count_runtime + count_load + count_xyz.
sum_abap + sum_rfc + sum_it
sum_buf + sum_db + sum_x + sum_z.
count_abap + count_rfc + count_it
count_buf + count_db + count_x
count_z.

IF ( sum_class NE sum_all
OR count_class NE count_all ).
WRITE: / 'Bug in Conversion'.
BREAK-POINT.
ENDIF.
header-itabs = 'N'.

IF ( sum_it > '0' ).


header-itabs = 'Y'.
ENDIF.
header-line = 'N'.
IF ( len-line NE '0' ).
header-line = 'Y'.
ENDIF.
* header-events = 'N'.
* if ( len_id ne '0' and len_subid ne '0' ).
*
header-events = 'Y'.
* endif.
header-sum_all
header-count_class
header-sum_xyz
header-run_gross
header-max_gross
header-max_gross_type
header-run_net
header-sum_load
header-sum_xyz
header-count_load
header-count_xyz

=
=
=
=
=
=
=
=
=
=
=

sum_all.
count_all.
sum_xyz.
gross_runtime - sum_all.
gross_max
- sum_all.
max_gross_type.
net_runtime.
sum_load.
sum_xyz.
count_load.
count_xyz.

* Check on header:----------------------------------p = sum_load / sum_class * 100.


IF ( p GT 5 ).
head_texts-text = ' Loads > 5%, it might be better to repeat measurement'.
APPEND head_texts.
ENDIF.
p = header-run_gross / sum_class * 100.
IF ( p GT 5 ).
head_texts-text = ' Deviation of Gross Time > 5%, please repeat'.
APPEND head_texts.
ENDIF.
*
*
*
*
*
*
*
*
*
*
*
*

Event Overview:-----------------------------------sum1 = 'ABAP1 = Functions'.


sum2 = 'ABAP2 = Forms
'.
sum3 = 'ABAP4 = Methods '.
sum4 = 'ABAP5 = Internal Tables'.
sum5 = 'DB
= Database Op. '.
sum6 = 'SYS = System
'.
sum7 = 'RFC = Remote Func. Calls'.
sum8 = 'XYZ = '
sum9 = all net times !!
sum10 = all sums.
sum11 = gross time of Runtime Analysis
CLEAR event.
event-text1 = text_abap.
event-sum1
= sum_abap.
event-count1 = count_abap.
event-text2 = text_rfc.
event-sum2
= sum_rfc.
event-count2 = count_rfc.
event-text3 = text_itab.

event-sum3
event-count3
event-text4
event-sum4
event-count4
event-text5
event-sum5
event-count5
event-text6
event-sum6
event-count6
event-text7
event-sum7
event-count7
event-text8
event-sum8
event-count8
event-text9
event-sum9
event-count9
event-text10
event-sum10
event-count10

=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=

sum_it.
count_it.
text_buf.
sum_buf.
count_buf.
text_db.
sum_db.
count_db.
text_x.
sum_x.
count_x.
text_z.
sum_z.
count_z.
''.
0.
0.
''.
0.
0.
'SUM = Total'.
sum_class.
count_class.

* Checks on Events:---------------------------p = sum_rfc / sum_class * 100.


IF ( p GT 10 ).
event_texts-text = ' RFC Contributions > 10%, please check RFCs'.
APPEND event_texts.
ENDIF.
p = sum_buf / sum_class * 100.
IF ( p GT 5 ).
event_texts-text = ' Internal Access Contributions > 5%, please check!'.
APPEND event_texts.
ENDIF.
p = sum_db / sum_class * 100.
IF ( p GT 30 ).
event_texts-text = ' DB Contributions > 30%, please check ST05!'.
APPEND event_texts.
ENDIF.
p = sum_x / sum_class * 100.
IF ( p GT 5 ).
event_texts-text = ' Other Contributions > 5%, please check!'.
APPEND event_texts.
ENDIF.
p = sum_z / sum_class * 100.
IF ( p GT 5 ).
event_texts-text = ' Special Contributions > 5%, please check!'.
APPEND event_texts.
ENDIF.
ENDFORM.
"CONVERT_FILE
************************************************************************
* Block C: Compare Traces
*
************************************************************************

*&---------------------------------------------------------------------*
*&
Form Compare_events
*
*
Tries to identify itab pairs
*----------------------------------------------------------------------*
FORM compare_events
TABLES trace1
TYPE tab_trace
trace2
TYPE tab_trace
itab1
TYPE tab_trace
itab2
TYPE tab_trace
in_both
TYPE tab_both
USING header1
TYPE st_header
header2
TYPE st_header.
IF ( header1-line EQ 'Y'
AND header2-line EQ 'Y' ).
gv_line = 'X'.
ELSE.
CLEAR gv_line.
ENDIF.
*---------------------------------------------* without line numbers
IF ( gv_line NE 'X' OR gv_compare_full EQ 'X' ).
PERFORM compare_full
TABLES trace1 trace2
USING header1 header2
*
*
*

perform compare_all
tables itab1
itab2
using header1 header2

in_both
'NO' 'C0'.
in_both
'ITAB' 'I0'.

*---------------------------------------------------* including line numbers


ELSE.
PERFORM compare_line
TABLES trace1 trace2
in_both
USING header1 header2
'NO' 'CL'.
PERFORM compare_line
TABLES itab1
itab2
USING header1 header2
ENDIF.

in_both
'ITAB' 'IL'.

APPEND LINES OF itab1 TO trace1.


APPEND LINES OF itab2 TO trace2.
ENDFORM.
"COMPARE_EVENTS
*&---------------------------------------------------------------------*
*
Form compare_line
*
Compares with calling position
*----------------------------------------------------------------------*
FORM compare_line
TABLES trace1 TYPE tab_trace
trace2 TYPE tab_trace
in_both TYPE tab_both
USING header1 TYPE st_header
header2 TYPE st_header
type
TYPE c

comp
DATA:
new_trace1

TYPE c.

wa1
wa2
tabix1
tabix2
fdummy1
fdummy
nc(4)
name(9)
execs
x1
x2
y1
y2

TYPE HASHED TABLE OF st_trace


WITH UNIQUE KEY maintype subtype caller line call
WITH HEADER LINE,
TYPE HASHED TABLE OF st_trace
WITH UNIQUE KEY maintype subtype caller line call
WITH HEADER LINE,
TYPE st_trace,
TYPE st_trace,
LIKE sy-tabix,
LIKE sy-tabix,
TYPE f,
TYPE f,
TYPE n,
TYPE c,
TYPE i,
TYPE i,
TYPE i,
TYPE i,
TYPE i,

sum1_all
sum1_both
sum1_one
sum2_all
sum2_both
sum2_one
count1_prio
count1_post
count1_both
count1_one
count2_prio
count2_post
count2_both
count2_one

TYPE
TYPE
TYPE
TYPE
TYPE
TYPE
TYPE
TYPE
TYPE
TYPE
TYPE
TYPE
TYPE
TYPE

new_trace2

typ_numb,
typ_numb,
typ_numb,
typ_numb,
typ_numb,
typ_numb,
i,
i,
i,
i,
i,
i,
i,
i.

* Preparation:------------------------------------------* Collect of duplicates is necessary!!


LOOP AT trace1 INTO wa1.
count1_prio = count1_prio + 1.
READ TABLE new_trace1
INTO new_trace1
WITH TABLE KEY maintype = wa1-maintype
subtype = wa1-subtype
caller = wa1-caller
line
= wa1-line
call
= wa1-call.
IF ( sy-subrc EQ 0 ).
new_trace1-net = new_trace1-net + wa1-net.
new_trace1-execs = new_trace1-execs + wa1-execs.
new_trace1-gross = new_trace1-gross + wa1-gross.
new_trace1-mult = new_trace1-mult + 1.
MODIFY TABLE new_trace1 FROM new_trace1.
ELSE.
new_trace1
= wa1.
new_trace1-mult = 1.
INSERT new_trace1 INTO TABLE new_trace1.

count1_post = count1_post + 1.
ENDIF.
ENDLOOP.
LOOP AT trace2 INTO wa2.
count2_prio = count2_prio + 1.
READ TABLE new_trace2
INTO new_trace2
WITH TABLE KEY maintype =
subtype =
caller =
line
=
call
=

wa2-maintype
wa2-subtype
wa2-caller
wa2-line
wa2-call.

IF ( sy-subrc EQ 0 ).
new_trace2-net = new_trace2-net + wa2-net.
new_trace2-execs = new_trace2-execs + wa2-execs.
new_trace2-gross = new_trace2-gross + wa2-gross.
new_trace2-mult = new_trace2-mult + 1.
MODIFY TABLE new_trace2 FROM new_trace2.
ELSE.
new_trace2
= wa2.
new_trace2-mult = 1.
INSERT new_trace2 INTO TABLE new_trace2.
count2_post = count2_post + 1.
ENDIF.
ENDLOOP.
IF ( 1 = 1 ).
CLEAR: x1,y1.
LOOP AT trace1 INTO wa1.
x1 = x1 + wa1-net.
ENDLOOP.
LOOP AT new_trace1 INTO new_trace1.
y1 = y1 + new_trace1-net.
ENDLOOP.
CLEAR: x2, y2.
LOOP AT trace2 INTO wa2.
x2 = x2 + wa2-net.
ENDLOOP.
LOOP AT new_trace2 INTO new_trace2.
y2 = y2 + new_trace2-net.
ENDLOOP.
IF NOT ( x1 = y1 AND x2 = y2 ).
BREAK-POINT.
ENDIF.
ENDIF.
REFRESH trace1[].
REFRESH trace2[].
* Compare: --------------------------------------------* sort new_trace1 by maintype subtype caller line.
* sort new_trace2 by maintype subtype caller line.
LOOP AT new_trace1 INTO wa1.
tabix1 = sy-tabix.

sum1_all = sum1_all + wa1-net.


* binary search read,
* no hashed, because there is later a delete with index
READ TABLE new_trace2
INTO wa2
WITH TABLE KEY
maintype = wa1-maintype
subtype = wa1-subtype
caller = wa1-caller
line
= wa1-line
call
= wa1-call.
* Identical Call in both traces found
IF sy-subrc EQ 0.
tabix2 = sy-tabix.
DELETE TABLE new_trace2
WITH TABLE KEY
maintype = wa1-maintype
subtype = wa1-subtype
caller = wa1-caller
line
= wa1-line
call
= wa1-call.
* write in table in both
sum1_both = sum1_both + wa1-net.
count1_both = count1_both + 1.
sum2_both = sum2_both + wa2-net.
count2_both = count2_both + 1.
* write in table in both
* maintype, subtype, ..., caller, line, id, subid
MOVE-CORRESPONDING wa1 TO in_both.
in_both-code
in_both-mult2
in_both-mult1

= comp.
= wa2-mult.
= wa1-mult.

* net time
in_both-net1
= wa1-net.
in_both-net2
= wa2-net.
IF ( wa1-net GT '0' ).
fdummy1
= wa2-net / wa1-net.
in_both-net2d1 = fdummy1.
ELSE.
in_both-net2d1 = 0.
ENDIF.
IF
( wa2-net > wa1-net ).
in_both-nets = '+'.
in_both-net2m1 = wa2-net - wa1-net.
ELSEIF ( wa2-net < wa1-net ).
in_both-nets = '-'.
in_both-net2m1 = wa1-net - wa2-net.
ELSE.
in_both-nets = ''.
in_both-net2m1 = wa2-net - wa1-net.
ENDIF.
* executions
in_both-execs1

= wa1-execs.

in_both-execs2
= wa2-execs.
IF ( wa1-execs GT '0' ).
fdummy
= wa2-execs / wa1-execs.
in_both-execs2d1 = fdummy.
ELSE.
in_both-execs2d1 = 0.
ENDIF.
IF
( wa2-execs > wa1-execs ).
in_both-execss = '+'.
in_both-execs2m1 = wa2-execs - wa1-execs.
ELSEIF ( wa2-execs < wa1-execs ).
in_both-execss = '-'.
in_both-execs2m1 = wa1-execs - wa2-execs.
ELSE.
in_both-execss = ''.
in_both-execs2m1 = wa2-execs - wa1-execs.
ENDIF.
* gross time
in_both-gross1
= wa1-gross.
in_both-gross2
= wa2-gross.
IF ( wa1-gross GT '0' ).
fdummy
= wa2-gross / wa1-gross.
in_both-gross2d1 = fdummy.
ELSE.
in_both-gross2d1 = 0.
ENDIF.
IF
( wa2-gross > wa1-gross ).
in_both-grosss = '+'.
in_both-gross2m1 = wa2-gross - wa1-gross.
ELSEIF ( wa2-gross < wa1-gross ).
in_both-grosss = '-'.
in_both-gross2m1 = wa1-gross - wa2-gross.
ELSE.
in_both-grosss = ''.
in_both-gross2m1 = wa2-gross - wa1-gross.
ENDIF.
in_both-netdexec1 = wa1-netdexec.
in_both-netdexec2 = wa2-netdexec.
* append to in_both and delete from new_trace2
APPEND in_both.
* no entry in col_trace2
ELSE.
sum1_one = sum1_one + wa1-net.
count1_one = count1_one + 1.
APPEND wa1 TO trace1.
ENDIF.
ENDLOOP.
* the left-over in col_trace2 was never read-----------------LOOP AT new_trace2 INTO wa2.
sum2_one = sum2_one + wa2-net.
count2_one = count2_one + 1.
APPEND wa2 TO trace2.
ENDLOOP.
* for output:

IF ( type EQ 'ITAB' ).
header1-count_itab_agg
header2-count_itab_agg
ELSE.
header1-count_noit_agg
header2-count_noit_agg
ENDIF.

= count1_post - count1_prio.
= count2_post - count2_prio.
= count1_post - count1_prio.
= count2_post - count2_prio.

header1-sum_both
header1-count_both
header1-sum_one
header1-count_one

=
=
=
=

header1-sum_both
header1-count_both
header1-sum_one
header1-count_one

+
+
+
+

sum1_both.
count1_both.
sum1_one.
count1_one.

header2-sum_both
header2-count_both
header2-sum_one
header2-count_one

=
=
=
=

header2-sum_both
header2-count_both
header2-sum_one
header2-count_one

+
+
+
+

sum2_both.
count2_both.
sum2_one.
count2_one.

ENDFORM.
"COMPARE_LINE
*&---------------------------------------------------------------------*
*
Form compare_full
*
Compare without calling position
*----------------------------------------------------------------------*
FORM compare_full
TABLES trace1 TYPE tab_trace
trace2 TYPE tab_trace
in_both TYPE tab_both
USING header1 TYPE st_header
header2 TYPE st_header
type
TYPE c
comp
TYPE c.
DATA:
new_trace1

wa1
wa2
tabix1
tabix2
fdummy1
fdummy
nc(4)
name(9)
execs
x1
x2
y1
y2

TYPE HASHED TABLE OF st_trace


WITH UNIQUE KEY maintype subtype caller call
WITH HEADER LINE,
TYPE HASHED TABLE OF st_trace
WITH UNIQUE KEY maintype subtype caller call
WITH HEADER LINE,
TYPE st_trace,
TYPE st_trace,
LIKE sy-tabix,
LIKE sy-tabix,
TYPE f,
TYPE f,
TYPE n,
TYPE c,
TYPE i,
TYPE i,
TYPE i,
TYPE i,
TYPE i,

sum1_all
sum1_both
sum1_one
sum2_all
sum2_both
sum2_one

TYPE
TYPE
TYPE
TYPE
TYPE
TYPE

new_trace2

typ_numb,
typ_numb,
typ_numb,
typ_numb,
typ_numb,
typ_numb,

count1_prio
count1_post
count1_both
count1_one
count2_prio
count2_post
count2_both
count2_one

TYPE
TYPE
TYPE
TYPE
TYPE
TYPE
TYPE
TYPE

i,
i,
i,
i,
i,
i,
i,
i.

* Preparation:------------------------------------------* Collect of duplicates is necessary!!


LOOP AT trace1 INTO wa1.
count1_prio = count1_prio + 1.
READ TABLE new_trace1
INTO new_trace1
WITH TABLE KEY maintype = wa1-maintype
subtype = wa1-subtype
caller = wa1-caller
call
= wa1-call.
IF ( sy-subrc EQ 0 ).
gv_mult_1
= 'X'.
new_trace1-net = new_trace1-net + wa1-net.
new_trace1-execs = new_trace1-execs + wa1-execs.
new_trace1-gross = new_trace1-gross + wa1-gross.
new_trace1-mult = new_trace1-mult + 1.
MODIFY TABLE new_trace1 FROM new_trace1.
ELSE.
new_trace1
= wa1.
new_trace1-mult = 1.
INSERT new_trace1 INTO TABLE new_trace1.
count1_post = count1_post + 1.
ENDIF.
ENDLOOP.
LOOP AT trace2 INTO wa2.
count2_prio = count2_prio + 1.
READ TABLE new_trace2
INTO new_trace2
WITH TABLE KEY maintype =
subtype =
caller =
call
=

wa2-maintype
wa2-subtype
wa2-caller
wa2-call.

IF ( sy-subrc EQ 0 ).
gv_mult_2
= '2'.
new_trace2-net = new_trace2-net + wa2-net.
new_trace2-execs = new_trace2-execs + wa2-execs.
new_trace2-gross = new_trace2-gross + wa2-gross.
new_trace2-mult = new_trace2-mult + 1.
MODIFY TABLE new_trace2 FROM new_trace2.
ELSE.
new_trace2
= wa2.
new_trace2-mult = 1.
INSERT new_trace2 INTO TABLE new_trace2.
count2_post = count2_post + 1.
ENDIF.
ENDLOOP.

IF ( 1 = 1 ).
CLEAR: x1,y1.
LOOP AT trace1 INTO wa1.
x1 = x1 + wa1-net.
ENDLOOP.
LOOP AT new_trace1 INTO new_trace1.
y1 = y1 + new_trace1-net.
ENDLOOP.
CLEAR: x2, y2.
LOOP AT trace2 INTO wa2.
x2 = x2 + wa2-net.
ENDLOOP.
LOOP AT new_trace2 INTO new_trace2.
y2 = y2 + new_trace2-net.
ENDLOOP.
IF NOT ( x1 = y1 AND x2 = y2 ).
BREAK-POINT.
ENDIF.
ENDIF.
REFRESH trace1[].
REFRESH trace2[].
* Compare: --------------------------------------------* sort new_trace1 by maintype subtype caller line.
* sort new_trace2 by maintype subtype caller line.
LOOP AT new_trace1 INTO wa1.
tabix1 = sy-tabix.
sum1_all = sum1_all + wa1-net.
* binary search read,
* no hashed, because there is later a delete with index
READ TABLE new_trace2
INTO wa2
WITH TABLE KEY
maintype = wa1-maintype
subtype = wa1-subtype
caller = wa1-caller
call
= wa1-call.
* Identical Call in both traces found
IF sy-subrc EQ 0.
tabix2 = sy-tabix.
DELETE TABLE new_trace2
WITH TABLE KEY
maintype = wa1-maintype
subtype = wa1-subtype
caller = wa1-caller
call
= wa1-call.
* write in table in both
sum1_both = sum1_both + wa1-net.
count1_both = count1_both + 1.
sum2_both = sum2_both + wa2-net.
count2_both = count2_both + 1.
* write in table in both
* maintype, subtype, ..., caller, line, id, subid
MOVE-CORRESPONDING wa1 TO in_both.

in_both-code
in_both-mult2
in_both-mult1

= comp.
= wa2-mult.
= wa1-mult.

* net time
in_both-net1
= wa1-net.
in_both-net2
= wa2-net.
IF ( wa1-net GT '0' ).
fdummy1
= wa2-net / wa1-net.
in_both-net2d1 = fdummy1.
ELSEIF ( wa1-net EQ '0' AND wa2-net EQ '0' ).
in_both-net2d1 = '1'.
ELSE.
in_both-net2d1 = 0.
ENDIF.
IF
( wa2-net > wa1-net ).
in_both-nets = '+'.
in_both-net2m1 = wa2-net - wa1-net.
ELSEIF ( wa2-net < wa1-net ).
in_both-nets = '-'.
in_both-net2m1 = wa1-net - wa2-net.
ELSE.
in_both-nets = ''.
in_both-net2m1 = wa2-net - wa1-net.
ENDIF.
* executions
in_both-execs1
in_both-execs2
IF
( wa1-execs
fdummy
in_both-execs2d1
ELSEIF ( wa1-execs
in_both-execs2d1
ELSE.
in_both-execs2d1
ENDIF.
IF

( wa2-execs
in_both-execss
in_both-execs2m1
ELSEIF ( wa2-execs
in_both-execss
in_both-execs2m1
ELSE.
in_both-execss
in_both-execs2m1
ENDIF.

= wa1-execs.
= wa2-execs.
GT '0' ).
= wa2-execs / wa1-execs.
= fdummy.
= '0' AND wa2-execs = '0' ).
= '1'.
= 0.
>
=
=
<
=
=

wa1-execs
'+'.
wa2-execs
wa1-execs
'-'.
wa1-execs

).
- wa1-execs.
).
- wa2-execs.

= ''.
= wa2-execs - wa1-execs.

* gross time
in_both-gross1
= wa1-gross.
in_both-gross2
= wa2-gross.
IF ( wa1-gross GT '0' ).
fdummy
= wa2-gross / wa1-gross.
in_both-gross2d1 = fdummy.
ELSEIF ( wa1-gross = '0' AND wa2-gross = '0' ).
in_both-gross2d1 = '1'.
ELSE.
in_both-gross2d1 = 0.

ENDIF.
IF

( wa2-gross
in_both-grosss
in_both-gross2m1
ELSEIF ( wa2-gross
in_both-grosss
in_both-gross2m1
ELSE.
in_both-grosss
in_both-gross2m1
ENDIF.

>
=
=
<
=
=

wa1-gross
'+'.
wa2-gross
wa1-gross
'-'.
wa1-gross

).
- wa1-gross.
).
- wa2-gross.

= ''.
= wa2-gross - wa1-gross.

in_both-netdexec1 = wa1-netdexec.
in_both-netdexec2 = wa2-netdexec.
* append to in_both and delete from new_trace2
APPEND in_both.
* no entry in col_trace2
ELSE.
sum1_one = sum1_one + wa1-net.
count1_one = count1_one + 1.
APPEND wa1 TO trace1.
ENDIF.
ENDLOOP.
* the left-over in col_trace2 was never read-----------------LOOP AT new_trace2 INTO wa2.
sum2_one = sum2_one + wa2-net.
count2_one = count2_one + 1.
APPEND wa2 TO trace2.
ENDLOOP.
* for output:
IF ( type EQ 'ITAB' ).
header1-count_itab_agg
header2-count_itab_agg
ELSE.
header1-count_noit_agg
header2-count_noit_agg
ENDIF.

= count1_post - count1_prio.
= count2_post - count2_prio.
= count1_post - count1_prio.
= count2_post - count2_prio.

header1-sum_both
header1-count_both
header1-sum_one
header1-count_one

=
=
=
=

header1-sum_both
header1-count_both
header1-sum_one
header1-count_one

+
+
+
+

sum1_both.
count1_both.
sum1_one.
count1_one.

header2-sum_both
header2-count_both
header2-sum_one
header2-count_one

=
=
=
=

header2-sum_both
header2-count_both
header2-sum_one
header2-count_one

+
+
+
+

sum2_both.
count2_both.
sum2_one.
count2_one.

ENDFORM.
"COMPARE_FULL
*&---------------------------------------------------------------------*
*&
Form FILTER_TRACE
*&
*&
Filter trace before output
*&---------------------------------------------------------------------*

FORM filter_traces
TABLES in_both
trace1
trace2
out0
scale_texts
USING header2
scale2
scale1
DATA:
text1(25)
text2(25)
text3(25)
text4(25)
text5(25)
text6(25)
text7(25)
text8(25)
text9(25)
text10(25)
wa
out_4
out_3
out_2
out_1
out_0
out_r
out_l
out_u1
out_u2
wa1
wa2
net_ex
exec_ex
fdummy
four
cubic
quad
lin
const
sum2_all
sum1_all
sum2_4
sum1_4
sum2_3
sum1_3
sum2_2
sum1_2
sum2_1
sum1_1
sum2_0
sum1_0
sum2_r
sum1_r
sum2_n
sum1_n
sum2_l
sum1_l

TYPE
TYPE
TYPE
TYPE
TYPE
TYPE
TYPE
TYPE
TYPE
TYPE
TYPE
TYPE
TYPE
TYPE
TYPE
TYPE
TYPE
TYPE
TYPE
TYPE
TYPE
TYPE
TYPE
TYPE
TYPE
TYPE
TYPE
TYPE
TYPE
TYPE
TYPE
TYPE
TYPE
TYPE
TYPE
TYPE
TYPE
TYPE
TYPE
TYPE
TYPE
TYPE
TYPE
TYPE
TYPE
TYPE
TYPE
TYPE

TYPE
TYPE
TYPE
TYPE
TYPE
TYPE
TYPE
TYPE

c,
c,
c,
c,
c,
c,
c,
c,
c,
c,
st_both,
tab_both,
tab_both,
tab_both,
tab_both,
tab_both,
tab_both,
tab_both,
tab_both,
tab_both,
st_trace,
st_trace,
i,
i,
f,
f,
f,
f,
f,
f,
i,
i,
i,
i,
i,
i,
i,
i,
i,
i,
i,
i,
i,
i,
i,
i,
i,
i,

tab_both
tab_trace
tab_trace
tab_both
tab_texts
st_header
st_over
st_over.

count2_all
count1_all
count2_4
count1_4
count2_3
count1_3
count2_2
count1_2
count2_1
count1_1
count2_0
count1_0
count2_r
count1_r
count2_n
count1_n
count2_l
count1_l
* check
four
cubic
quad
lin
const

TYPE
TYPE
TYPE
TYPE
TYPE
TYPE
TYPE
TYPE
TYPE
TYPE
TYPE
TYPE
TYPE
TYPE
TYPE
TYPE
TYPE
TYPE

i,
i,
i,
i,
i,
i,
i,
i,
i,
i,
i,
i,
i,
i,
i,
i,
i,
i.

whether compare has result, if yes write output


= 2 * gv_factor * gv_factor * gv_factor.
= 2 * gv_factor * gv_factor.
= 2 * gv_factor.
= 2.
= 48 / 100.

* check whether compare has result, if yes write output


READ TABLE in_both INDEX 1.
IF ( sy-subrc EQ 0 ).
*------------------------------------------------------------* filter the entries which in both traces:
LOOP AT in_both INTO wa.
* classification of ratios of LIN_FACT given-------------------IF NOT ( gv_factor IS INITIAL ).
IF
( wa-net2d1 > four ).
wa-text = 'Net 4'.
wa-scale = 'N'.
ELSEIF ( wa-net2d1 > cubic ).
wa-text = 'Net 3'.
wa-scale = 'N'.
ELSEIF ( wa-net2d1 > quad ).
wa-text = 'Net 2'.
wa-scale = 'N'.
ELSEIF ( wa-net2d1 > lin ).
wa-text = 'Net 1'.
wa-scale = 'L'.
ELSEIF ( wa-net2d1 > const ).
wa-text = 'Net 0'.
wa-scale = 'C'.
ELSE.
wa-text = 'Net 0'.
wa-scale = 'R'.
ENDIF.
IF

( wa-execs2d1 > four ).


wa-text+5 = ' - Exec 4'.
ELSEIF
( wa-execs2d1 > cubic ).
wa-text+5 = ' - Exec 3'.

ELSEIF ( wa-execs2d1 >


wa-text+5 = ' - Exec
ELSEIF ( wa-execs2d1 >
wa-text+5 = ' - Exec
ELSEIF ( wa-execs2d1 >
wa-text+5 = ' - Exec
ELSE.
wa-text+5 = ' - Exec
ENDIF.

quad ).
2'.
lin ).
1'.
const ).
0'.
9'.

* split in different groups and sum up.


net_ex = wa-text+4(1).
exec_ex = wa-text+13(1).
* order 4:
IF
( net_ex EQ '4' ).
IF ( wa-net1 LT gv_limit AND exec_ex NE'2' ).
sum2_l = sum2_l + wa-net2.
sum1_l = sum1_l + wa-net1.
count2_l = count2_l + 1.
count1_l = count1_l + 1.
APPEND wa TO out_l.
ELSE.
sum2_4 = sum2_4 + wa-net2.
sum1_4 = sum1_4 + wa-net1.
count2_4 = count2_4 + 1.
count1_4 = count1_4 + 1.
APPEND wa TO out_4.
ENDIF.
* order 3: cubic
ELSEIF ( net_ex EQ '3' ).
IF ( wa-net1 LT gv_limit AND exec_ex NE'2' ).
sum2_l = sum2_l + wa-net2.
sum1_l = sum1_l + wa-net1.
count2_l = count2_l + 1.
count1_l = count1_l + 1.
APPEND wa TO out_l.
ELSE.
sum2_3 = sum2_3 + wa-net2.
sum1_3 = sum1_3 + wa-net1.
count2_3 = count2_3 + 1.
count1_3 = count1_3 + 1.
APPEND wa TO out_3.
ENDIF.
* order 2: quadratic
ELSEIF ( net_ex EQ '2' ).
IF ( wa-net1 LT gv_limit AND exec_ex NE'2' ).
sum2_l = sum2_l + wa-net2.
sum1_l = sum1_l + wa-net1.
count2_l = count2_l + 1.
count1_l = count1_l + 1.
APPEND wa TO out_l.
ELSE.
sum2_2 = sum2_2 + wa-net2.
sum1_2 = sum1_2 + wa-net1.
count2_2 = count2_2 + 1.
count1_2 = count1_2 + 1.
APPEND wa TO out_2.
ENDIF.
* order 1: linear
ELSEIF ( net_ex EQ '1' ).

sum2_1 = sum2_1 + wa-net2.


sum1_1 = sum1_1 + wa-net1.
count2_1 = count2_1 + 1.
count1_1 = count1_1 + 1.
APPEND wa TO out_1.
* order 0: constant
ELSEIF ( net_ex EQ '0' ).
sum2_0 = sum2_0 + wa-net2.
sum1_0 = sum1_0 + wa-net1.
count2_0 = count2_0 + 1.
count1_0 = count1_0 + 1.
APPEND wa TO out_0.
* order 9: reduced
ELSEIF ( net_ex EQ '9' ).
wa-text+4(1) = 'r'.
IF ( wa-net2 LT gv_limit ).
sum2_l = sum2_l + wa-net2.
sum1_l = sum1_l + wa-net1.
count2_l = count2_l + 1.
count1_l = count1_l + 1.
APPEND wa TO out_l.
ELSE.
sum2_r = sum2_r + wa-net2.
sum1_r = sum1_r + wa-net1.
count2_r = count2_r + 1.
count1_r = count1_r + 1.
APPEND wa TO out_r.
ENDIF.
* else:
ELSE.
APPEND wa TO out0.
ENDIF.
*---------------------------ELSE.
APPEND wa TO out0.
ENDIF.
ENDLOOP.
ENDIF.
*------------------------------------------------------------* filter the entries which are only in trace 1:
READ TABLE trace1 INDEX 1.
IF ( sy-subrc EQ 0 ).
LOOP AT trace1 INTO wa1.
CLEAR wa.
MOVE-CORRESPONDING wa1 TO wa.
wa-gross1
= wa1-gross.
wa-execs1
= wa1-execs.
wa-net1
= wa1-net.
wa-netdexec1 = wa1-netdexec.
wa-mult1
wa-nets
wa-net2m1
wa-execss
wa-execs2m1
wa-grosss
wa-gross2m1

= wa1-mult.
=
=
=
=
=
=

'-'.
wa1-net.
'-'.
wa1-execs.
'-'.
wa1-gross.

wa-scale

= 'U'.

sum1_n = sum1_n + wa1-net.


count1_n = count1_n + 1.
APPEND wa TO out_u1.
ENDLOOP.
ENDIF.
*------------------------------------------------------------* filter the entries which are only in trace 1:
READ TABLE trace2 INDEX 1.
IF ( sy-subrc EQ 0 ).
LOOP AT trace2 INTO wa2.
CLEAR wa.
MOVE-CORRESPONDING wa2 TO wa.
wa-gross2
= wa2-gross.
wa-execs2
= wa2-execs.
wa-net2
= wa2-net.
wa-netdexec2 = wa2-netdexec.
wa-mult2
= wa2-mult.
wa-nets
wa-net2m1
wa-execss
wa-execs2m1
wa-grosss
wa-gross2m1

=
=
=
=
=
=

'+'.
wa2-net.
'+'.
wa2-execs.
'+'.
wa2-gross.

wa-scale

= 'U'.

sum2_n = sum2_n + wa2-net.


count2_n = count2_n + 1.
APPEND wa TO out_u2.
ENDLOOP.
ENDIF.
*
*
*
*

Sums
sum2_4 sum1_4 sum2_3 sum1_3 sum2_2 sum1_2
sum2_1 sum1_1 sum2_0 sum1_0
sum2_9 sum1_9 sum2_n sum1_n
sum2_all = sum2_4 + sum2_3 + sum2_2
+ sum2_1 + sum2_0
+ sum2_r + sum2_n + sum2_l.
sum1_all

= sum1_4 + sum1_3 + sum1_2


+ sum1_1 + sum1_0
+ sum1_r + sum1_n + sum1_l.

count2_all = count2_4 + count2_3 + count2_2


+ count2_1 + count2_0
+ count2_r + count2_n + count2_l.
count1_all = count1_4 + count1_3 + count1_2
+ count1_1 + count1_0
+ count1_r + count1_n + count1_l.
* Scale
text1
text2
text3

Overview: ------------------------------------------------------------= '4: Order 4


'.
= '3: Order 3 = Cubic
'.
= '2: Order 2 = Quadratic
'.

text4
text5
text6
text7
text8
text9
text10

=
=
=
=
=
=
=

'1: Order 1 = Linear


'0: Order 0 = Constant
'x: Reduced
'N: Not comparable
'L: 4 + 3 + 2 + x < Limit
'
'Sum = Total

scale2-text1 =
scale2-text2 =
scale2-text3 =
scale2-text4 =
scale2-text5 =
scale2-text6 =
scale2-text7 =
scale2-text8 =
scale2-text9 =
scale2-text10 =
scale1 = scale2.

text1.
text2.
text3.
text4.
text5.
text6.
text7.
text8.
text9.
text10.

scale2-sum1
scale2-count1
scale2-sum2
scale2-count2
scale2-sum3
scale2-count3
scale2-sum4
scale2-count4
scale2-sum5
scale2-count5
scale2-sum6
scale2-count6
scale2-sum7
scale2-count7
scale2-sum8
scale2-count8
scale2-sum9
scale2-count9
scale2-sum10
scale2-count10

=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=

scale2-sum1
scale2-count1
scale2-sum2
scale2-count2
scale2-sum3
scale2-count3
scale2-sum4
scale2-count4
scale2-sum5
scale2-count5
scale2-sum6
scale2-count6
scale2-sum7
scale2-count7
scale2-sum8
scale2-count8
'0'.
'0'.
scale2-sum10
scale2-count10

+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

scale1-sum1
scale1-count1
scale1-sum2
scale1-count2
scale1-sum3
scale1-count3
scale1-sum4
scale1-count4
scale1-sum5
scale1-count5
scale1-sum6
scale1-count6
scale1-sum7
scale1-count7
scale1-sum8
scale1-count8
scale1-sum9
scale1-count9

=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=

scale1-sum1
scale1-count1
scale1-sum2
scale1-count2
scale1-sum3
scale1-count3
scale1-sum4
scale1-count4
scale1-sum5
scale1-count5
scale1-sum6
scale1-count6
scale1-sum7
scale1-count7
scale1-sum8
scale1-count8
'0'.
'0'.

+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

'.
'.
'.
'.
'.
'.
'.

sum2_4.
count2_4.
sum2_3.
count2_3.
sum2_2.
count2_2.
sum2_1.
count2_1.
sum2_0.
count2_0.
sum2_r.
count2_r.
sum2_n.
count2_n.
sum2_l.
count2_l.

+ sum2_all.
+ count2_all.
sum1_4.
count1_4.
sum1_3.
count1_3.
sum1_2.
count1_2.
sum1_1.
count1_1.
sum1_0.
count1_0.
sum1_r.
count1_r.
sum1_n.
count1_n.
sum1_l.
count1_l.

scale1-sum10 = scale1-sum10 + sum1_all.


scale1-count10 = scale1-count10 + count1_all.
* Scale Texts:
IF ( scale2-sum1 > 0 ).
scale_texts-text = ' Trace contains nonlinearites of order 4 or higher'.
APPEND scale_texts.
ENDIF.
IF ( scale2-sum2 > 0 ).
scale_texts-text = ' Trace contains cubic nonlinearites'.
APPEND scale_texts.
ENDIF.
IF ( scale2-sum3 > 0 ).
scale_texts-text = ' Trace contains quadratic nonlinearites'.
APPEND scale_texts.
ENDIF.
IF ( scale2-sum1 = 0 AND scale2-sum2 = 0 AND scale2-sum3 = 0 ).
scale_texts-text = ' Trace contains no nonlinearites !! :) !!'.
APPEND scale_texts.
ENDIF.
*
*
*
*
*
*
*
*
*
*

Sort :-------------------------------------------------------------out_4 : order 4


out 3 : order 3
out_2 : order 2
out_1 : order 1
out_0 : order 0
out_r : reduced order
out_l : below limit
out_u2: uncompared trace 2
out_u1: uncompared trace 1

* refresh out0.
* nonlinear
IF
( gv_funct
APPEND LINES OF
APPEND LINES OF
APPEND LINES OF
SORT out0 BY

EQ 'NONLINEAR' ).
out_4 TO out0.
out_3 TO out0.
out_2 TO out0.
text DESCENDING
net2 DESCENDING.

* double_check
ELSEIF ( gv_funct
APPEND LINES OF
APPEND LINES OF
SORT out0 BY

EQ 'CHECK' ).
out_l TO out0.
out_r TO out0.
net2 DESCENDING.

* uncompared
ELSEIF ( gv_funct
APPEND LINES OF
APPEND LINES OF
SORT out0 BY

EQ 'UNCOMP' ).
out_u2 TO out0.
out_u1 TO out0.
maintype subtype caller line code ASCENDING.

* a_ratio and a_diff all


ELSE.
APPEND LINES OF out_4 TO out0.
APPEND LINES OF out_3 TO out0.
APPEND LINES OF out_2 TO out0.

APPEND
APPEND
APPEND
APPEND
APPEND
APPEND
SORT
ENDIF.

LINES
LINES
LINES
LINES
LINES
LINES
out0

OF
OF
OF
OF
OF
OF
BY

out_1 TO out0.
out_0 TO out0.
out_r TO out0.
out_l TO out0.
out_u2 TO out0.
out_u1 TO out0.
net2 DESCENDING.

ENDFORM.
"FILTER_TRACE
*&---------------------------------------------------------------------*
*&
Form EXTRAPOLATE
*&
*&
Filter trace before output
*&---------------------------------------------------------------------*
FORM extrapolate
TABLES extra_texts TYPE tab_texts
USING scale2
TYPE st_over
extra2
TYPE st_over
extra1
TYPE st_over.
DATA:
text1(25)
text2(25)
text3(25)
text4(25)
text5(25)
text6(25)
text7(25)
text8(25)
text9(25)
text10(25)
text(5)
norm
c0(22)
c1(22)
c2(22)
c3(22)
c4(22)
a0
a1
a2
a3
a4

TYPE
TYPE
TYPE
TYPE
TYPE
TYPE
TYPE
TYPE
TYPE
TYPE
TYPE

c,
c,
c,
c,
c,
c,
c,
c,
c,
c,
c,

TYPE
TYPE
TYPE
TYPE
TYPE
TYPE
TYPE
TYPE
TYPE
TYPE
TYPE

i VALUE '1000',
c,
c,
c,
c,
c,
f,
f,
f,
f,
f.

* Sums: ------------------------------------------------------------* text1 = '4: Order 4


'.
a4 = scale2-sum1 / ( gv_n2 * gv_n2 * gv_n2 * gv_n2 ).
* text2 = '3: Order 3 = Cubic
'.
a3 = scale2-sum2 / ( gv_n2 * gv_n2 * gv_n2 ).
* text3 = '2: Order 2 = Quadratic
'.
a2 = scale2-sum3 / ( gv_n2 * gv_n2 ).
* text4 = '1: Order 1 = Linear
'.
a1 = scale2-sum4 / ( gv_n2 ).
* text5 = '0: Order 0 = Constant
'.
a0 = scale2-sum5.
* text6 = 'x: Reduced
'.
* text7 = 'N: Not comparable
'.
* text8 = 'L: 4 + 3 + 2 + x < Limit '.

* text9 = '
* text10 = 'Sum = Total
c0 = a0 / 1000000.
c1 = a1 / 1000000.
c2 = a2 / 1000000.
c3 = a3 / 1000000.
c4 = a4 / 1000000.

'

* Texts:
CONCATENATE ' Constant Offset
APPEND extra_texts.
CONCATENATE ' Linear Slope
APPEND extra_texts.
CONCATENATE ' Quadratic
APPEND extra_texts.
CONCATENATE ' Cubic
APPEND extra_texts.
CONCATENATE ' Higher Nonlin
APPEND extra_texts.

a0 =' c0 INTO extra_texts-text.


a1 =' c1 INTO extra_texts-text.
a2 =' c2 INTO extra_texts-text.
a3 =' c3 INTO extra_texts-text.
a4 =' c4 INTO extra_texts-text.

text1 = ' N =
0'.
text2 = ' N =
1'.
text3 = ' N =
10'.
text4 = ' N =
100 == 100%'.
text5 = ' N =
1.000'.
text6 = ' N = 10.0000'.
* text7 = '
'.
text = gv_n1.
CONCATENATE ' N1 =' text ' (Test)' INTO text8.
text = gv_n2.
CONCATENATE ' N2 =' text ' (Test)' INTO text9.
* text10 = ' N = 100 = 100% '.
* Extrapolation
extra2-text1
extra2-text2
extra2-text3
extra2-text4
extra2-text5
extra2-text6
extra2-text7
extra2-text8
extra2-text9
extra2-text10

Numbers:
= text1.
= text2.
= text3.
= text4.
= text5.
= text6.
= text7.
= text8.
= text9.
= text10.

extra1 = extra2.
* Extra1: Linear
extra1-sum1
extra1-sum2
extra1-sum3
extra1-sum4
extra1-sum5
extra1-sum6
extra1-sum7
extra1-sum8
extra1-sum9
extra1-sum10

Extrapolation
= a0
= ( a0 + a1 *
= ( a0 + a1 *
= ( a0 + a1 *
= ( a0 + a1 *
= ( a0 + a1 *
= 0.
= ( a0 + a1 *
= ( a0 + a1 *
= 0.

(smaller)
/
1
) /
10
) /
100 ) /
1000 ) /
10000 ) /

norm.
norm.
norm.
norm.
norm.
norm.

gv_n1 ) / norm.
gv_n2 ) / norm.

* Extra2: Nonlinear Extrapolation

extra2-sum1
extra2-sum2
extra2-sum3
extra2-sum4
extra2-sum5
extra2-sum6
extra2-sum7
extra2-sum8
extra2-sum9
extra2-sum10

= a0 / norm.
= ( a0 + a1 * 1 + a2 + a3 + a4 ) / norm.
= ( a0 + a1 * 10 + a2 * 10 * 10
+ a3 * 10 * 10 * 10
+ a4 * 10 * 10 * 10 * 10 ) / norm.
= ( a0 + a1 * 100 + a2 * 100 * 100
+ a3 * 100 * 100 * 100
+ a4 * 100 * 100 * 100 * 100 ) / norm.
= ( a0 + a1 * 1000 + a2 * 1000 * 1000
+ a3 * 1000 * 1000 * 1000
+ a4 * 1000 * 1000 * 1000 * 1000 ) / norm.
= ( a0 + a1 * 10000 + a2 * 10000 * 10000
+ a3 * 10000 * 10000 * 10000
+ a4 * 10000 * 10000 * 10000 * 10000 ) / norm.
= 0.
= ( a0 + a1 * gv_n1 + a2 * gv_n1 * gv_n1
+ a3 * gv_n1 * gv_n1 * gv_n1
+ a4 * gv_n1 * gv_n1 * gv_n1 * gv_n1 ) / norm.
= ( a0 + a1 * gv_n2 + a2 * gv_n2 * gv_n2
+ a3 * gv_n2 * gv_n2 * gv_n2
+ a4 * gv_n2 * gv_n2 * gv_n2 * gv_n2 ) / norm.
= 0.

ENDFORM.
"EXTRAPOLATE
************************************************************************
* Block D: Output
*
************************************************************************
*&---------------------------------------------------------------------*
*&
Form WRITE_OUTPUT
*&
*&
Overview for both traces
*&
this is called twice
*&---------------------------------------------------------------------*
FORM write_output
TABLES scale_texts TYPE tab_texts
extra_texts TYPE tab_texts
USING header2
TYPE st_header
header1
TYPE st_header
event1
TYPE st_over
event2
TYPE st_over
dist1
TYPE st_over
dist2
TYPE st_over
extra1
TYPE st_over
extra2
TYPE st_over.
DATA:
head1
TYPE st_over,
head2
TYPE st_over,
agg1
TYPE st_over,
agg2
TYPE st_over,
comp1
TYPE st_over,
comp2
TYPE st_over.
*&---------------------------------------------------------------------*
PERFORM fill_overview
TABLES
compare_texts
USING
header1
head1
agg1 comp1 '1'.
PERFORM fill_overview
TABLES
compare_texts
USING
header2
head2
agg2 comp2 '2'.

*---Output------------------------------------------------------PERFORM write_header
USING header2 header1.
SKIP.
* Overview:-----------------------------------------------------PERFORM write_overview
TABLES head_texts
USING header1 header2
head1
head2
'2. Basic Checks'.
SKIP.
* Overview:-----------------------------------------------------PERFORM write_overview
TABLES event_texts
USING header1 header2
event1
event2
'3. Event-Profile'.
SKIP.
* Aggregation:-----------------------------------------------------PERFORM write_overview
TABLES agg_texts
USING header1 header2
agg1
agg2
'4. Aggregation'.
SKIP.
* Overview:-----------------------------------------------------PERFORM write_overview
TABLES compare_texts
USING header1 header2
comp1
comp2
'5. Compare-Status'.
SKIP.
* Distribution:-----------------------------------------------------IF NOT ( gv_factor IS INITIAL ).
PERFORM write_overview
TABLES scale_texts
USING header1 header2
scale1
scale2
'6. Scaling Behavior'.
PERFORM write_overview
TABLES extra_texts
USING header1 header2
extra1
extra2
'7. Fit & Extrapolation'.
ENDIF.
FORMAT RESET.
ENDFORM.
"WRITE_CHECK_OUTPUT
*&---------------------------------------------------------------------*
*&
Form FILL_OVERVIEW
*&
*&
Overview for both traces
*&
this is called twice
*&---------------------------------------------------------------------*
FORM fill_overview
TABLES compare_texts TYPE tab_texts
USING header
TYPE st_header
head
TYPE st_over
aggreg
TYPE st_over
compare
TYPE st_over
code
TYPE c.
DATA:
p

TYPE p DECIMALS 2.

head-text1
head-sum1
head-count1
head-text2
head-sum2
head-count2
head-text3
head-sum3
head-count3
head-text4
head-sum4
head-count4
head-text5
head-sum5
head-count5
head-text6
head-sum6
head-text7
head-sum7
head-text8
head-sum8
head-text9
head-sum9
head-text10
head-sum10
head-count10

=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=

'Dev. of Gross Runtime


'.
header-run_gross.
'1'.
'Dev. of other Max. Gross '.
header-max_gross .
'1'.
'Net Time Runtime analysis'.
header-run_net.
'1'.
'Net Time Load + Generate '.
header-sum_load.
header-count_load.
'Net Time Not Classified '.
header-sum_xyz.
header-count_xyz.
' '.
0.
''.
0.
''.
0.
''.
'0'.
'Sum of all net times
'.
header-sum_all.
header-count_class.

* header_texts-text = ' No Header Warnings'.


* append header_texts.
CLEAR aggreg.
aggreg-text1
aggreg-sum1
aggreg-count1
aggreg-text2
aggreg-sum2
aggreg-count2
aggreg-text3
aggreg-sum3
aggreg-count3
* ...
aggreg-text10
aggreg-sum10
aggreg-count10

=
=
=
=
=
=
=
=
=

'Before Aggregation'.
header-sum_both + header-sum_one.
header-count_class.
'Aggregated Non-Itab'.
0.
header-count_noit_agg.
'Aggregated Itab'.
0.
header-count_itab_agg.

CLEAR compare.
compare-text1
compare-sum1
compare-count1
compare-text2
compare-sum2
compare-count2
* ...
compare-text10
compare-sum10
compare-count10

= 'Sum = Total'.
= header-sum_both + header-sum_one.
= header-count_both + header-count_one.
=
=
=
=
=
=

'Compare successful
header-sum_both.
header-count_both.
'Compare impossible
header-sum_one.
header-count_one.

'.
'.

= 'Sum = Total'.
= header-sum_both + header-sum_one.
= header-count_both + header-count_one.

* Checks on Compare:---------------------------p = header-sum_one / compare-sum10 * 100.

IF ( p GT 10 ).
IF ( code EQ '1' ).
compare_texts-text = ' Trace 1: Uncomparable > 10%, please check'.
ELSE.
compare_texts-text = ' Trace 2: Uncomparable > 10%, please check'.
ENDIF.
ENDIF.
ENDFORM.
"FILL_OVERVIEW
*&---------------------------------------------------------------------*
*&
Form WRITE_HEADER
*&
*&
Overview for both traces
*&
this is called twice
*&---------------------------------------------------------------------*
FORM write_header
USING header2
TYPE st_header
header1
TYPE st_header.
DATA:
le
info_text(129)
text_0(30)
text_1(102)
text_21(15)
text_22(15)
text_23(66)

TYPE
TYPE
TYPE
TYPE
TYPE
TYPE
TYPE

i VALUE '139',
c,
c,
c,
c,
c,
c.

TYPES:
BEGIN OF st_head_top,
t0
LIKE text_0,
t1
LIKE text_1,
END OF st_head_top,
tab_head_top TYPE st_head_top OCCURS 0.
TYPES:
BEGIN OF st_head_bot,
t0
LIKE text_0,
t21
LIKE text_21,
t22
LIKE text_22,
t23
LIKE text_23,
END OF st_head_bot,
tab_head_bot TYPE st_head_bot OCCURS 0.
DATA:
lt_head_topout
lt_head_botout

TYPE tab_head_top WITH HEADER LINE,


TYPE tab_head_bot WITH HEADER LINE.

* Top Part of Header Output:---------------------------lt_head_topout-t0 = 'General Information'.


lt_head_topout-t1 = ' '.
APPEND lt_head_topout.
lt_head_topout-t0 = ' Path Trace 2'.
lt_head_topout-t1 = header2-path.
APPEND lt_head_topout.
lt_head_topout-t0 = ' Path Trace 1'.
IF ( header2-path NE header1-path ).

lt_head_topout-t1 = header1-path.
ELSE.
lt_head_topout-t1 = 'same as Trace 2'.
ENDIF.
APPEND lt_head_topout.
lt_head_topout-t0 = ' Filename Trace 2'.
lt_head_topout-t1 = header2-filename.
APPEND lt_head_topout.
lt_head_topout-t0 = ' Filename Trace 1'.
lt_head_topout-t1 = header1-filename.
APPEND lt_head_topout.
* Write Output:-------------------------------------------------------SKIP.
ULINE AT /1(le).
FORMAT COLOR COL_KEY.
READ TABLE lt_head_topout INDEX 1.
FORMAT INTENSIFIED ON.
WRITE: / '|', lt_head_topout-t0.
WRITE: '|', lt_head_topout-t1,
'|'.
ULINE AT /1(le).
LOOP AT lt_head_topout FROM 2.
FORMAT INTENSIFIED ON.
WRITE: AT /1 '|', lt_head_topout-t0, '|'.
FORMAT INTENSIFIED OFF.
WRITE:
lt_head_topout-t1, '|'.
ENDLOOP.
ULINE AT /1(le).
* Top Part of Header Output:---------------------------lt_head_botout-t0 = ' '.
lt_head_botout-t21 = ' Trace 2'.
lt_head_botout-t22 = ' Trace 1'.
lt_head_botout-t23 = ' Comment'.
APPEND lt_head_botout.
lt_head_botout-t0 = ' Language'.
lt_head_botout-t21 = header2-language.
lt_head_botout-t22 = header1-language.
lt_head_botout-t23 = ' '.
APPEND lt_head_botout.
lt_head_botout-t0 = ' Aggregation'.
lt_head_botout-t21 = header2-aggregate.
lt_head_botout-t22 = header1-aggregate.
lt_head_botout-t23 = ' '.
APPEND lt_head_botout.
lt_head_botout-t0 = ' Internal Tables'.
lt_head_botout-t21 = header2-itabs.
lt_head_botout-t22 = header1-itabs.
lt_head_botout-t23 = ' '.
APPEND lt_head_botout.
lt_head_botout-t0

= ' Trace with Contoffs'.

lt_head_botout-t21 = header2-line.
lt_head_botout-t22 = header1-line.
lt_head_botout-t23 = ' '.
APPEND lt_head_botout.
lt_head_botout-t0 = ' Trace with Events'.
lt_head_botout-t21 = header2-events.
lt_head_botout-t22 = header1-events.
lt_head_botout-t23 = ' '.
APPEND lt_head_botout.
* Write Output:-------------------------------------------------------FORMAT COLOR COL_KEY.
READ TABLE lt_head_botout INDEX 1.
FORMAT INTENSIFIED ON.
WRITE: / '|', lt_head_botout-t0.
WRITE: '|', lt_head_botout-t21,
'|', lt_head_botout-t22,
'|', lt_head_botout-t23,
'|'.
ULINE AT /1(le).
LOOP AT lt_head_botout FROM 2.
FORMAT INTENSIFIED ON.
WRITE: / '|', lt_head_botout-t0, '|'.
FORMAT INTENSIFIED OFF.
WRITE:
lt_head_botout-t21,
'|', lt_head_botout-t22,
'|', lt_head_botout-t23,
'|'.
ENDLOOP.
ULINE AT /1(le).
FORMAT RESET.
SKIP.
WRITE AT /1 ''.
ENDFORM.
"WRITE_CHECK_OUTPUT
*&---------------------------------------------------------------------*
*&
Form WRITE_OVERVIEW
*&
*&
Overview for both traces
*&
this is called twice
*&---------------------------------------------------------------------*
FORM write_overview
TABLES table_texts TYPE tab_texts
USING header_1
TYPE st_header
header_2
TYPE st_header
over1
TYPE st_over
over2
TYPE st_over
title
TYPE c.
FIELD-SYMBOLS:
DATA:
le
info_text(135)
text_00(30)
text_10(29)
text_11(16)
text_12(10)

<fs>.
TYPE
TYPE
TYPE
TYPE
TYPE
TYPE

i VALUE '139',
c,
c,
c,
c,
c,

text_20(29)
text_21(16)
text_22(10)
text_30(9)
text_41(11)
text_42(11)

TYPE
TYPE
TYPE
TYPE
TYPE
TYPE

c,
c,
c,
c,
c,
c.

TYPES:
BEGIN OF st_over_out,
t00
LIKE text_00,
t11
LIKE text_11,
t12
LIKE text_12,
t21
LIKE text_21,
t22
LIKE text_22,
t30
LIKE text_30,
t41
LIKE text_41,
t42
LIKE text_42,
END OF st_over_out,
tab_over_out TYPE st_over_out OCCURS 0.
DATA:
lt_over_out
DATA:
wa_texts
flag
norm
ptype1
ptype2
round2
lv_neg
i
c2(2)
name(13)
tot1
tot2
sum1
sum2
text(25)
csum1
perc1(10)
csum2
perc2(10)
perc12(9)
ccount1
ccount2

TYPE tab_over_out WITH HEADER LINE.

TYPE
TYPE
TYPE
TYPE
TYPE
TYPE
TYPE
TYPE
TYPE
TYPE
TYPE
TYPE
TYPE
TYPE

st_texts,
c,
p DECIMALS
p DECIMALS
p DECIMALS
p DECIMALS
c,
i,
c,
c,
p DECIMALS
p DECIMALS
p DECIMALS
p DECIMALS

TYPE
TYPE
TYPE
TYPE
TYPE
TYPE
TYPE
TYPE

c,
typ_numb,
c,
typ_numb,
c,
c,
i,
i.

2,
1,
2,
2,

0,
0,
0,
0,

*------------------------------------* 1. Line:
*
= '12345678901234567890123456789'
text_00
= title.
text_10
= '
Trace2
'.
text_20
= '
Trace1
'.
text_30
= ''.
*
= '12345678901
text_41
= ' Trace2 '.
text_42
= ' Trace1 '.
* 2. Line:

lt_over_out-t00 = '
'.
= '1234567890123456
lt_over_out-t11 = '
Net time '.
lt_over_out-t12 = ' Net % '.
lt_over_out-t21 = '
Net time '.
lt_over_out-t22 = ' Net % '.
lt_over_out-t30 = 'Ratio 2/1'.
lt_over_out-t41 = ' Lines '.
lt_over_out-t42 = ' Lines '.
APPEND lt_over_out.

* ---------------------------------------------------------CLEAR lv_neg.
norm
= 100.
round2 = 50 / 100000.
tot1 = header_1-sum_all.
tot2 = header_2-sum_all.
IF ( title EQ 'Extrapolation' ).
tot1
= over1-sum4.
tot2
= over2-sum4.
text_10 = ' Nonlinear Extrapolation
text_20 = ' Linear Extrapolation
ENDIF.

'.
'.

i = 0.
DO 11 TIMES.
i = i + 1.
c2 = i.
CONCATENATE 'over1-text' c2 INTO name.
ASSIGN (name) TO <fs>.
text = <fs>.
CONCATENATE 'over1-sum' c2 INTO name.
ASSIGN (name) TO <fs>.
sum1 = <fs>.
CONCATENATE 'over2-sum' c2 INTO name.
ASSIGN (name) TO <fs>.
sum2 = <fs>.
CONCATENATE 'over1-count' c2 INTO name.
ASSIGN (name) TO <fs>.
ccount1 = <fs>.
CONCATENATE 'over2-count' c2 INTO name.
ASSIGN (name) TO <fs>.
ccount2 = <fs>.
* calculations:
IF ( tot1 > 0 ).
ptype1 = ( sum1 / tot1 + round2 ) * norm.
ELSE.
ptype1 = 0.
ENDIF.
perc1 = ptype1.
IF ( tot2 > 0 ).
ptype1 = ( sum2 / tot2 + round2 ) * norm.

ELSE.
ptype1 = 0.
ENDIF.
perc2 = ptype1.
IF ( sum1 > 0 ).
ptype2 = ( sum2 / sum1 + round2 ).
ELSE.
ptype2 = 0.
ENDIF.
perc12 = ptype2.
* characterlike
csum1 = sum1.
csum2 = sum2.
REPLACE '.' WITH ',' INTO perc2.
REPLACE '.' WITH ',' INTO perc1.
REPLACE '.' WITH ',' INTO perc12.
lt_over_out-t00 = text.
WRITE csum2 TO lt_over_out-t11.
lt_over_out-t12 = perc2.
WRITE csum1 TO lt_over_out-t21 .
lt_over_out-t22 = perc1.
lt_over_out-t30 = perc12.
WRITE ccount2 TO lt_over_out-t41.
WRITE ccount1 TO lt_over_out-t42.
APPEND lt_over_out.
ENDDO.
* Write Output:-------------------------------------------------------ULINE AT /1(le).
FORMAT COLOR COL_KEY.
FORMAT INTENSIFIED ON.
WRITE: / '|', text_00.
WRITE: '|', text_10,
'|', text_20,
'|', text_30,
'||', text_41,
'|', text_42,
'|'.
READ TABLE lt_over_out INDEX 1.
WRITE: / '|', lt_over_out-t00.
WRITE: '|', lt_over_out-t11,
'|', lt_over_out-t12,
'|', lt_over_out-t21,
'|', lt_over_out-t22,
'|', lt_over_out-t30,
'||', lt_over_out-t41,
'|', lt_over_out-t42,
'|'.
ULINE AT /1(le).
LOOP AT lt_over_out FROM 2.
* of lines which have not-zero textfields
IF ( lt_over_out-t00 IS NOT INITIAL ).
* general layout

IF ( sy-tabix NE '11' ).
FORMAT INTENSIFIED ON.
WRITE: / '|', lt_over_out-t00, '|'.
FORMAT INTENSIFIED OFF.
WRITE:
lt_over_out-t11,
'|', lt_over_out-t12,
'|', lt_over_out-t21,
'|', lt_over_out-t22,
'|'.
FORMAT COLOR COL_NORMAL.
WRITE:
lt_over_out-t30, '||'.
FORMAT COLOR COL_KEY.
WRITE:
lt_over_out-t41,
'|', lt_over_out-t42,
'|'.
* summary line layout: yellow color
ELSE.
ULINE AT /1(le).
FORMAT COLOR COL_TOTAL.
FORMAT INTENSIFIED ON.
WRITE: / '|', lt_over_out-t00, '|'.
FORMAT INTENSIFIED OFF.
WRITE:
lt_over_out-t11,
'|', lt_over_out-t12,
'|', lt_over_out-t21,
'|', lt_over_out-t22.
WRITE: '|', lt_over_out-t30.
WRITE: '||', lt_over_out-t41,
'|', lt_over_out-t42,
'|'.
ENDIF.
ENDIF.
ENDLOOP.
ULINE AT /1(le).
FORMAT RESET.
* Compare Overview, if there have been negatives
*
if
( lv_neg = 'X' and i = 3 ).
*
uline at /1(le).
*
if ( ccount1 < '0' ).
*
format color col_negative.
*
lv_neg = 'X'.
* Comments
READ TABLE table_texts INDEX 1.
IF ( sy-subrc EQ 0 ).
FORMAT COLOR COL_KEY.
info_text = 'Comments and Checks:'.
WRITE : / '|', info_text, '|'.
LOOP AT table_texts INTO wa_texts.
IF NOT ( wa_texts IS INITIAL ).
info_text = wa_texts-text.
WRITE : / '|', info_text, '|'.
ENDIF.
ENDLOOP.
ULINE AT /1(le).
ENDIF.
FORMAT RESET.

SKIP.
WRITE AT /1 ''.
ENDFORM.
"WRITE_OVERVIEW
*----------------------------------------------------------------------*
* ALV ALV ALV ALV ALV ALV ALV ALV ALV ALV ALV ALV ALV ALV ALV ALV ALV
*----------------------------------------------------------------------*
*&---------------------------------------------------------------------*
*&
Form write_details_alv
*&
*&
*&---------------------------------------------------------------------*
FORM write_details_alv
TABLES out_trace TYPE tab_both.
DATA:
l_st_alv

TYPE st_alv.

* L_ST_ALV-ICON = '@AG@'. "icon: alert


* L_ST_ALV-ICON = '@04@'. "icon: positive
LOOP AT out_trace.
MOVE-CORRESPONDING out_trace TO l_st_alv.
APPEND l_st_alv TO alv_both.
ENDLOOP.
PERFORM display_alv.
ENDFORM.
" write_details_alv
*&---------------------------------------------------------------------*
*&
Form sort_alv
*&---------------------------------------------------------------------*
FORM sort_alv USING
u_tab_sort TYPE slis_t_sortinfo_alv
u_outtab TYPE tab_alv_both.
DATA:
l_tab_sort_lvc TYPE lvc_t_sort,
l_wrk_sort
TYPE slis_sortinfo_alv,
l_wrk_sort_lvc TYPE lvc_s_sort.
* Transfer sort infos into the other table for call with function
LOOP AT u_tab_sort INTO l_wrk_sort.
MOVE-CORRESPONDING l_wrk_sort TO l_wrk_sort_lvc.
APPEND l_wrk_sort_lvc TO l_tab_sort_lvc.
ENDLOOP.
* Sort like ALV - Listviewer
IF NOT u_tab_sort IS INITIAL.
CALL FUNCTION 'LVC_SORT_APPLY'
EXPORTING
it_sort = l_tab_sort_lvc
*
i_as_text = 'X'
*
i_stable = 'X'
TABLES
ct_data = u_outtab.
ENDIF.
ENDFORM.
" sort_alv
*&---------------------------------------------------------------------*
*&
Form get_layout_info
*&---------------------------------------------------------------------*

FORM get_layout_info USING u_tab_sort TYPE slis_t_sortinfo_alv.


* First get sort info
CALL FUNCTION 'REUSE_ALV_GRID_LAYOUT_INFO_GET'
IMPORTING
*
ES_LAYOUT
=
*
ET_FIELDCAT
=
et_sort
= u_tab_sort
*
ET_FILTER
=
*
ES_GRID_SCROLL
=
*
ES_VARIANT
=
*
ET_MARKED_COLUMNS =
*
ET_FILTERED_ENTRIES =
*
ET_FIELDCAT_BACKEND =
*
ES_PRINT
=
EXCEPTIONS
no_infos
= 1
program_error
= 2
OTHERS
= 3.
IF sy-subrc <> 0.
ENDIF.
ENDFORM.
" get_layout_info
*&---------------------------------------------------------------------*
*&
Form alv_dclick
*&---------------------------------------------------------------------*
*
handles double click in ALV list
*----------------------------------------------------------------------*
*FORM ALV_DCLICK USING RF_UCOMM LIKE SY-UCOMM
"#EC CALLED
*
RS_SELFIELD TYPE SLIS_SELFIELD.
*
* DATA:
**
L_OUTTAB
TYPE ST_BOTH,
*
L_TAB_SORT
TYPE SLIS_T_SORTINFO_ALV,
*
L_BOTH
TYPE ST_ALV.
**
L_RC
TYPE SYSUBRC.
*
* CASE RF_UCOMM.
*
WHEN 'SHOW'.
"doubleclick
**
First get sort info
*
PERFORM GET_LAYOUT_INFO USING L_TAB_SORT.
*
**
Then sort like ALV - list viewer
*
PERFORM SORT_ALV USING L_TAB_SORT
*
GT_OUTTAB.
*
*
READ TABLE GT_OUTTAB INTO L_BOTH INDEX RS_SELFIELD-TABINDEX.
*
IF SY-SUBRC = 0.
*
ENDIF.
*
CLEAR RF_UCOMM.
* ENDCASE.
*ENDFORM.
FORM alv_dclick USING
DATA:

" alv_dclick
rf_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.

"#EC CALLED

l_outtab
LIKE LINE OF gt_outtab, "TYPE ST_BOTH,
l_tab_sort
TYPE slis_t_sortinfo_alv,
l_prog TYPE sy-repid,
l_contoffs TYPE i,
l_both
TYPE st_alv.
L_RC
TYPE SYSUBRC.

CASE rf_ucomm.
WHEN 'SHOW'.
"doubleclick
*
First get sort info
PERFORM get_layout_info USING l_tab_sort.
*

*
*
*

Then sort like ALV - list viewer


PERFORM sort_alv USING l_tab_sort
gt_outtab.
READ TABLE gt_outtab INTO l_outtab INDEX rs_selfield-tabindex.
IF sy-subrc = 0.
MOVE l_outtab-caller TO l_prog.
MOVE l_outtab-line TO l_contoffs.
try.
CALL FUNCTION 'ATRA_SHOW_PROG_AT_CONTOFFS'
EXPORTING
prog
= l_prog
contoffs = l_contoffs
atra_date = '20991231'
atra_time = '235959'.
catch CX_ROOT into OREF.
TEXT = OREF->GET_TEXT( ).
endtry.
ENDIF.
CLEAR rf_ucomm.
ENDCASE.

ENDFORM.
" alv_dclick
*&---------------------------------------------------------------------*
*&
Form display_alv
*&---------------------------------------------------------------------*
FORM display_alv.
DATA:
wa
lt_textalv
count(2)
l_str_layout
l_tab_fieldcat
wb
l_grid_title
l_variant
l_wrk_display
l_tab_display

TYPE
TYPE
TYPE
TYPE
TYPE
TYPE
TYPE
LIKE
TYPE
TYPE

st_textalv,
tab_textalv,
n,
slis_layout_alv,
slis_t_fieldcat_alv,
slis_fieldcat_alv,
lvc_title,
disvariant,
st_alv,
tab_alv_both.

* Put data into table to be displayed


LOOP AT alv_both INTO l_wrk_display.
APPEND l_wrk_display TO l_tab_display.
ENDLOOP.
gt_outtab[] = l_tab_display[].
* Display data in ALV list:

l_str_layout-colwidth_optimize = 'X'.
* Double click function: show caller
l_str_layout-f2code = 'SHOW'.
l_variant-report = sy-repid.
l_variant-handle = 'BPAC'.
* Title determined by function:-------------------------------------------IF
( gv_funct EQ 'NONLINEAR' ).
l_grid_title = 'SE30-Comparison: Only Nonlinear Results'.
ELSEIF ( gv_funct EQ 'CHECK' ).
l_grid_title = 'SE30-Comparison: Double Check'.
ELSEIF ( gv_funct EQ 'UNCOMP' ).
l_grid_title = 'SE30-Comparison: Uncomparable Lines'.
ELSEIF ( gv_funct EQ 'RATIO' ).
l_grid_title = 'SE30-Comparison: All Details with Ratios'.
ELSEIF ( gv_funct = 'DIFF' ).
l_grid_title = 'SE30-Comparison: All Details with Differences'.
ELSEIF ( gv_funct = 'ONE' ).
l_grid_title = 'SE30-Comparison: Analysis of 1 Trace'.
ELSE.
l_grid_title = 'SE30-Comparison: ???'.
ENDIF.
* Different Layouts:------------------------------------------------------* ratios
IF
( gv_layout EQ 'RATIO' ).
LOOP AT x_textalv INTO wa WHERE key_1 > 0.
APPEND wa TO lt_textalv.
ENDLOOP.
SORT lt_textalv BY key_1 ASCENDING.
* differences
ELSEIF ( gv_layout EQ 'DIFF' ).
LOOP AT x_textalv INTO wa WHERE key_2 > 0.
APPEND wa TO lt_textalv.
ENDLOOP.
SORT lt_textalv BY key_2 ASCENDING.
* uncompared
ELSEIF ( gv_layout EQ 'UNCOMP' ).
LOOP AT x_textalv INTO wa WHERE key_3 > 0.
APPEND wa TO lt_textalv.
ENDLOOP.
SORT lt_textalv BY key_3 ASCENDING.
* only 1 trace
ELSEIF ( gv_layout EQ 'ONE' ).
LOOP AT x_textalv INTO wa WHERE key_4 > 0.
APPEND wa TO lt_textalv.
ENDLOOP.
SORT lt_textalv BY key_4 ASCENDING.
* else: Check
ELSE.
LOOP AT x_textalv INTO wa WHERE key_0 > 0.
APPEND wa TO lt_textalv.
ENDLOOP.
SORT lt_textalv BY key_0 ASCENDING.
ENDIF.

* -------------------------------------------------------------------REFRESH l_tab_fieldcat.
CLEAR count.
LOOP AT lt_textalv INTO wa.
CLEAR wb.
wb-fieldname
= wa-fieldname.
wb-seltext_l
= wa-seltext_l.
wb-reptext_ddic = wa-reptext_ddic.
wb-key
= wa-key.
wb-emphasize
= wa-emphasize.
wb-outputlen
= wa-outputlen.
wb-no_zero
= wa-no_zero.
wb-col_pos
= count + 1.
APPEND wb TO l_tab_fieldcat.
ENDLOOP.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program
= 'Z_SE30_COMPARE_WORK'
i_callback_user_command = 'ALV_DCLICK'
*
i_structure_name
= ''
is_layout
= l_str_layout
it_fieldcat
= l_tab_fieldcat
i_grid_title
= l_grid_title
i_save
= 'A' "Standard and user saving
is_variant
= l_variant
TABLES
t_outtab
= l_tab_display
EXCEPTIONS
program_error
= 1
OTHERS
= 2.
IF sy-subrc <> 0.
ENDIF.
ENDFORM.
" display_alv
*&---------------------------------------------------------------------*
*&
Form FILL_ALV_TEXT
*&---------------------------------------------------------------------*
*
key_0 key_1 key_2
key_3
*
check ratio
diff uncomp
*
* 2. Maintype
2
2
2
2
* 4. Subtype
4
4
4
4
* 6. Name
6
6
6
8
*
* 12. Code
12
12
12
7
* 14. Scale
14
14
0
0
* 16. Nonlinear
16
16
0
0
* 17. Mult2
17
17
17
17
* 18. Mult1
18
18
18
18
*
* 21. Net 2/1
21
21
0
0
* 22. Net 2-1 sign
22
0
22
0
* 22. Net 2-1
23
0
23
0
* 24. Net 2
24
24
24
24
* 25. Net 1
25
25
25
25
*
* 31. Exec 2/1
31
31
0
0

* 32. Exec 2-1 sign


32
0
32
0
* 33. Exec 2-1
33
0
33
0
* 34. Exec 2
34
34
34
34
* 35. Exec 1
35
35
35
35
*
* 41. Gross 2/1
41
41
0
0
* 42. GROSS 2-1 sign
42
0
42
0
* 43. Gross 2-1
43
0
43
0
* 44. Gross 2
44
44
44
44
* 45. Gross 1
45
45
45
45
*
* 81. Caller
81
81
81
5
* 82. Calling line
82
82
82
6
*------------------------------------------------------------* c000: brownish
* c100: blue
* c200: blue
very light
* c300: yellow
* c400: blue
light
* c500: green
* c600: red
* c700: orange
* c800: white
* c900: white
*----------------------------------------------------------------------FORM fill_alv_text.
DATA:
wa
f_caller(10)
s_caller(30)
* decimals_out(6)

TYPE st_textalv,
TYPE c,
TYPE c.
type c,

" decimals in write statement

* MAINTYPE:
CLEAR wa.
wa-fieldname
= 'MAINTYPE'.
wa-seltext_l
= 'Cat of Call'.
wa-reptext_ddic = 'Cat of Call'.
wa-emphasize
= 'C100'.
wa-key_0
= '2'.
wa-key_1
= '2'.
wa-key_2
= '2'.
wa-key_3
= '2'.
wa-key_4
= '2'.
APPEND wa TO x_textalv.
* SUBTYPE:
CLEAR wa.
wa-fieldname
= 'SUBTYPE'.
wa-seltext_l
= 'Type of Call'.
wa-reptext_ddic = 'Type of Call'.
wa-emphasize
= 'C100'.
wa-key_0
= '4'.
wa-key_1
= '4'.
wa-key_2
= '4'.
wa-key_3
= '4'.
wa-key_4
= '4'.
APPEND wa TO x_textalv.

* NAME/CALL:
CLEAR wa.
wa-fieldname
= 'CALL'.
wa-seltext_l
= 'Name of Call'.
wa-reptext_ddic = 'Name of Call'.
wa-emphasize
= 'C100'.
wa-outputlen
= '6'.
wa-key_0
= '6'.
wa-key_1
= '6'.
wa-key_2
= '6'.
wa-key_3
= '8'.
wa-key_4
= '6'.
APPEND wa TO x_textalv.
*-----------------------------------------------------------* CODE:
CLEAR wa.
wa-fieldname
= 'CODE'.
wa-seltext_l
= 'Code of compare program'.
wa-reptext_ddic = 'Code'.
wa-emphasize
= 'C500'.
wa-key_0
= '12'.
wa-key_1
= '12'.
wa-key_2
= '12'.
wa-key_3
= '7'.
wa-key_4
= '0'.
APPEND wa TO x_textalv.
* SCALE:
CLEAR wa.
wa-fieldname
= 'SCALE'.
wa-seltext_l
= 'Code of compare program'.
wa-reptext_ddic = 'S'.
wa-emphasize
= 'C500'.
wa-key_0
= '14'.
wa-key_1
= '14'.
wa-key_2
= '14'.
wa-key_3
= '0'.
wa-key_4
= '0'.
APPEND wa TO x_textalv.
* Nonlinear:
IF NOT ( gv_factor IS INITIAL ).
CLEAR wa.
wa-fieldname
= 'TEXT'.
wa-seltext_l
= 'Nonlinear'.
wa-reptext_ddic = 'Nonlinear'.
wa-no_zero
= 'X'.
wa-decimals_out = '5'.
wa-emphasize
= 'C500'.
wa-key_0
= '16'.
wa-key_1
= '16'.
wa-key_2
= '0'.
wa-key_3
= '0'.
wa-key_4
= '0'.
APPEND wa TO x_textalv.
ENDIF.
* MULT 2:
IF ( gv_mult_1 EQ 'X' OR gv_mult_2 EQ 'X' ).

CLEAR wa.
wa-fieldname
= 'MULT2'.
wa-seltext_l
= 'Multiplicity 2'.
wa-reptext_ddic = 'Mult 2'.
wa-no_zero
= 'X'.
wa-emphasize
= 'C500'.
wa-key_0
= '17'.
wa-key_1
= '17'.
wa-key_2
= '0'.
wa-key_3
= '0'.
wa-key_4
= '0'.
APPEND wa TO x_textalv.
* GROSS 1:
CLEAR wa.
wa-fieldname
= 'MULT1'.
wa-seltext_l
= 'Multiplicity 1'.
wa-reptext_ddic = 'Mult 1'.
wa-no_zero
= 'X'.
wa-emphasize
= 'C500'.
wa-key_0
= '18'.
wa-key_1
= '18'.
wa-key_2
= '0'.
wa-key_3
= '0'.
wa-key_4
= '0'.
APPEND wa TO x_textalv.
ENDIF.
*---------------------------------------------------------------------* NET 2/1:
CLEAR wa.
wa-fieldname
= 'NET2D1'.
wa-seltext_l
= 'Ratio of net times 2/1'.
wa-reptext_ddic = 'Net 2/1'.
wa-no_zero
= 'X'.
wa-emphasize
= 'C300'.
wa-key_0
= '21'.
wa-key_1
= '21'.
wa-key_2
= '0'.
wa-key_3
= '0'.
wa-key_4
= '0'.
APPEND wa TO x_textalv.
* NET 2-1: Sign and Value
CLEAR wa.
wa-fieldname
= 'NETS'.
wa-seltext_l
= 'Signum 2-1'.
wa-reptext_ddic = 'S'.
wa-no_zero
= 'X'.
wa-emphasize
= 'C300'.
wa-key_0
= '22'.
wa-key_1
= '0'.
wa-key_2
= '22'.
wa-key_3
= '0'.
wa-key_4
= '0'.
APPEND wa TO x_textalv.
* Net
CLEAR wa.

wa-fieldname
= 'NET2M1'.
wa-seltext_l
= 'Difference of net times 2-1'.
wa-reptext_ddic = 'Net 2-1'.
wa-no_zero
= 'X'.
wa-emphasize
= 'C300'.
wa-key_0
= '23'.
wa-key_1
= '0'.
wa-key_2
= '23'.
wa-key_3
= '0'.
wa-key_4
= '0'.
APPEND wa TO x_textalv.
* NET 2:
CLEAR wa.
wa-fieldname
= 'NET2'.
wa-seltext_l
= 'Net time file2'.
wa-reptext_ddic = 'Net 2'.
wa-no_zero
= 'X'.
wa-emphasize
= 'C300'.
wa-key_0
= '24'.
wa-key_1
= '24'.
wa-key_2
= '24'.
wa-key_3
= '24'.
wa-key_4
= '0'.
APPEND wa TO x_textalv.
* NET 1:
CLEAR wa.
wa-fieldname
= 'NET1'.
wa-seltext_l
= 'Net time file1'.
wa-reptext_ddic = 'Net 1'.
wa-no_zero
= 'X'.
wa-emphasize
= 'C300'.
wa-key_0
= '25'.
wa-key_1
= '25'.
wa-key_2
= '25'.
wa-key_3
= '25'.
wa-key_4
= '25'.
APPEND wa TO x_textalv.
* EXEC 2/1:
CLEAR wa.
wa-fieldname
= 'EXECS2D1'.
wa-seltext_l
= 'Ratio of executions file 2/file1'.
wa-reptext_ddic = 'Execs 2/1'.
wa-no_zero
= 'X'.
wa-key_0
= '31'.
wa-key_1
= '31'.
wa-key_2
= '0'.
wa-key_3
= '0'.
wa-key_4
= '0'.
APPEND wa TO x_textalv.
* Sign EXEC 2-1:
CLEAR wa.
wa-fieldname
wa-seltext_l
wa-reptext_ddic
wa-no_zero

=
=
=
=

'EXECSS'.
'Signum file2/file1'.
'S'.
'X'.

wa-key_0
= '32'.
wa-key_1
= '0'.
wa-key_2
= '32'.
wa-key_3
= '0'.
wa-key_4
= '0'.
APPEND wa TO x_textalv.
* Amount EXEC 2-1:
CLEAR wa.
wa-fieldname
= 'EXECS2M1'.
wa-seltext_l
= 'Difference of executions file 2/file1'.
wa-reptext_ddic = 'Execs 2-1'.
wa-no_zero
= 'X'.
wa-key_0
= '33'.
wa-key_1
= '0'.
wa-key_2
= '33'.
wa-key_3
= '0'.
wa-key_4
= '0'.
APPEND wa TO x_textalv.
* EXEC 2:
CLEAR wa.
wa-fieldname
= 'EXECS2'.
wa-seltext_l
= 'No. of executions file2'.
wa-reptext_ddic = 'Execs 2'.
wa-no_zero
= 'X'.
wa-key_0
= '34'.
wa-key_1
= '34'.
wa-key_2
= '34'.
wa-key_3
= '34'.
wa-key_4
= '0'.
APPEND wa TO x_textalv.
* EXEC 1:
CLEAR wa.
wa-fieldname
= 'EXECS1'.
wa-seltext_l
= 'No. of executions file1'.
wa-reptext_ddic = 'Execs 1'.
wa-no_zero
= 'X'.
wa-key_0
= '35'.
wa-key_1
= '35'.
wa-key_2
= '35'.
wa-key_3
= '35'.
wa-key_4
= '35'.
APPEND wa TO x_textalv.
* GROSS 2/1:
CLEAR wa.
wa-fieldname
= 'GROSS2D1'.
wa-seltext_l
= 'Ratio of gross times file2/file1'.
wa-reptext_ddic = 'Gross 2/1'.
wa-no_zero
= 'X'.
wa-emphasize
= 'C700'.
wa-key_0
= '41'.
wa-key_1
= '41'.
wa-key_2
= '0'.
wa-key_3
= '0'.
wa-key_4
= '0'.
APPEND wa TO x_textalv.

* Sign GROSS 2-1:


CLEAR wa.
wa-fieldname
= 'GROSSS'.
wa-seltext_l
= 'Signum file2/file1'.
wa-reptext_ddic = 'S'.
wa-no_zero
= 'X'.
wa-emphasize
= 'C700'.
wa-key_0
= '42'.
wa-key_1
= '0'.
wa-key_2
= '42'.
wa-key_3
= '0'.
wa-key_4
= '0'.
APPEND wa TO x_textalv.
* Sign GROSS 2-1:
CLEAR wa.
wa-fieldname
= 'GROSS2M1'.
wa-seltext_l
= 'Difference of gross times file2/file1'.
wa-reptext_ddic = 'Gross 2-1'.
wa-no_zero
= 'X'.
wa-emphasize
= 'C700'.
wa-key_0
= '43'.
wa-key_1
= '0'.
wa-key_2
= '43'.
wa-key_3
= '0'.
wa-key_4
= '0'.
APPEND wa TO x_textalv.
* GROSS 2:
CLEAR wa.
wa-fieldname
= 'GROSS2'.
wa-seltext_l
= 'Gross time file2'.
wa-reptext_ddic = 'Gross 2'.
wa-no_zero
= 'X'.
wa-emphasize
= 'C700'.
wa-key_0
= '44'.
wa-key_1
= '44'.
wa-key_2
= '44'.
wa-key_3
= '44'.
wa-key_4
= '0'.
APPEND wa TO x_textalv.
* GROSS 1:
CLEAR wa.
wa-fieldname
= 'GROSS1'.
wa-seltext_l
= 'Gross time file1'.
wa-reptext_ddic = 'Gross 1'.
wa-no_zero
= 'X'.
wa-emphasize
= 'C700'.
wa-key_0
= '45'.
wa-key_1
= '45'.
wa-key_2
= '45'.
wa-key_3
= '45'.
wa-key_4
= '45'.
APPEND wa TO x_textalv.
* NET per EXEC 1:
CLEAR wa.
wa-fieldname
= 'NETDEXEC1'.
wa-seltext_l
= 'Gross time file1'.

wa-reptext_ddic = 'Net/Exec 1'.


wa-no_zero
= 'X'.
wa-emphasize
= 'C600'.
wa-key_0
= '49'.
wa-key_1
= '0'.
wa-key_2
= '0'.
wa-key_3
= '0'.
wa-key_4
= '49'.
APPEND wa TO x_textalv.
*------------------------------------------------------* CALLER:
CLEAR wa.
wa-fieldname
= 'CALLER'.
wa-seltext_l
= s_caller.
wa-reptext_ddic = 'Calling Program'.
wa-emphasize
= 'C100'.
wa-key_0
= '81'.
wa-key_1
= '81'.
wa-key_2
= '81'.
wa-key_3
= '5'.
wa-key_4
= '81'.
APPEND wa TO x_textalv.
* CALLING LINE/OFFSET:
CLEAR wa.
wa-fieldname
= 'LINE'.
wa-seltext_l
= s_caller.
wa-reptext_ddic = 'Offset'.
wa-emphasize
= 'C100'.
wa-key_0
= '82'.
wa-key_1
= '82'.
wa-key_2
= '82'.
wa-key_3
= '6'.
wa-key_4
= '82'.
APPEND wa TO x_textalv.
ENDFORM.
"FILL_ALV_TEXT
*----------------------------------------------------------------------*-----------------------------------------------------------------------