Technology Blogs by SAP
Learn how to extend and personalize SAP applications. Follow the SAP technology blog for insights into SAP BTP, ABAP, SAP Analytics Cloud, SAP HANA, and more.
cancel
Showing results for 
Search instead for 
Did you mean: 
cris_hansen
Advisor
Advisor

Each work process writes trace entries into dev_wXX files.

Each line comes from one of the different components, as listed in SAP note 112:

"...

A  ABAP Processor

B  Database (general database interface)

C  Database (DBSL)

D  Diag Processor

E  Lock Management (Enqueue)

F  Startup Framework (in AS Java)

G  Language Support/Internationalization (Unicode Conversion)

H  Internet Communication Framework (ICF)

I  Semaphore, Shared Memory (IPC)

J  VM Container (Java in AS ABAP)

L  Background (Batch)

M  Dispatcher/Taskhandler

N  Security

P  Paging

R  Rolling

S  Printing

T  Debug System

W  WebGui

X  Extended Memory

Y  Dynp Processor

..."

In some cases, e.g. a security issue involving logon (in other words: SSO failed), a SM50 logon trace (per SAP note 495911) might be required.

The information will be recorded in the trace files, but not only "N" messages ("N" represents Security entries in the trace).

How to separate the entries, so you don't need to go through all unnecessary components?

In the past I wrote one application that separated all the entries by the respective components, creating new files (one file per component plus one file for remaining entries).

In order to avoid using a graphic interface, I decided to pursuit a Powershell approach, with the same outcome.

The resulting PS script I am sharing here:

"...

$filename = $args[0];

$fileA = [io.path]::GetFileNameWithoutExtension($filename) + ".A-ABAP-Processor.txt";

$fileB = [io.path]::GetFileNameWithoutExtension($filename) + ".B-Database-(general-database-interface).txt";

$fileC = [io.path]::GetFileNameWithoutExtension($filename) + ".C-Database-(DBSL).txt";

$fileD = [io.path]::GetFileNameWithoutExtension($filename) + ".D-Diag-Processor.txt";

$fileE = [io.path]::GetFileNameWithoutExtension($filename) + ".E-Lock-Management-(Enqueue).txt";

$fileF = [io.path]::GetFileNameWithoutExtension($filename) + ".F-Startup-Framework-(in-AS-Java).txt";

$fileG = [io.path]::GetFileNameWithoutExtension($filename) + ".G-Language-Support-Internationalization-(Unicode-Conversion).txt";

$fileH = [io.path]::GetFileNameWithoutExtension($filename) + ".H-Internet-Communication-Framework-(ICF).txt";

$fileI = [io.path]::GetFileNameWithoutExtension($filename) + ".I-Semaphore,-Shared-Memory-(IPC).txt";

$fileJ = [io.path]::GetFileNameWithoutExtension($filename) + ".J-VM-Container-(Java-in-AS-ABAP).txt";

$fileL = [io.path]::GetFileNameWithoutExtension($filename) + ".L-Background-(Batch).txt";

$fileM = [io.path]::GetFileNameWithoutExtension($filename) + ".M-Dispatcher-Taskhandler.txt";

$fileN = [io.path]::GetFileNameWithoutExtension($filename) + ".N-Security.txt";

$fileP = [io.path]::GetFileNameWithoutExtension($filename) + ".P-Paging.txt";

$fileR = [io.path]::GetFileNameWithoutExtension($filename) + ".R-Rolling.txt";

$fileS = [io.path]::GetFileNameWithoutExtension($filename) + ".S-Printing.txt";

$fileT = [io.path]::GetFileNameWithoutExtension($filename) + ".T-Debug-System.txt";

$fileW = [io.path]::GetFileNameWithoutExtension($filename) + ".W-WebGui.txt";

$fileX = [io.path]::GetFileNameWithoutExtension($filename) + ".X-Extended-Memory.txt";

$fileY = [io.path]::GetFileNameWithoutExtension($filename) + ".Y-Dynp-Processor.txt";

$fileZ = [io.path]::GetFileNameWithoutExtension($filename) + ".remaining-entries.txt";

foreach ($line in [System.IO.File]::ReadLines($filename)) {

  if ($line.length -gt 2) {

    $a = $line.Substring(0,1);

    switch ($a) {

       "A" { Add-Content $fileA $line }

       "B" { Add-Content $fileB $line }

       "C" { Add-Content $fileC $line }

       "D" { Add-Content $fileD $line }

       "E" { Add-Content $fileE $line }

       "F" { Add-Content $fileF $line }

       "G" { Add-Content $fileG $line }

       "H" { Add-Content $fileH $line }

       "I" { Add-Content $fileI $line }

       "J" { Add-Content $fileJ $line }

       "L" { Add-Content $fileL $line }

       "M" { Add-Content $fileM $line }

       "N" { Add-Content $fileN $line }

       "P" { Add-Content $fileP $line }

       "R" { Add-Content $fileR $line }

       "S" { Add-Content $fileS $line }

       "T" { Add-Content $fileT $line }

       "W" { Add-Content $fileW $line }

       "X" { Add-Content $fileX $line }

       "Y" { Add-Content $fileY $line }

       default { Add-Content $fileZ $line }

    }

  }

}

..."

Just open a PowerShell box and run:

powershell -executionPolicy bypass -noexit -file "devwxx.ps1" "dev_w0.txt"

You can replace "dev_w0.txt" by the developer trace you want to parse. "devwxx.ps1" is the name of the file that contains the script.

If you have another PowerShell alternative to do the same task and are willing to share, please comment below.

1 Comment