This blog contains experience gained over the years of implementing (and de-implementing) large scale IT applications/software.

SAP SLD Change Log Cleanup Table Reorg

When you apply changes or content updates to the SLD (system landscape directory) in SAP, the change log grows.
It’s possible to see the change log entries from the SLD administrator page.
Due to this growth, the underlying database table will benefit from reorganisation at some point.
In our scenario, this was on DB2.
We decided to run the cleanup, but first here was the size of the table BC_SLD_CHANGELOG:

db2prd> db2 “SELECT TABNAME, NPAGES FROM SYSCAT.TABLES
ORDER BY NPAGES DESC”
TABNAME                       NPAGES
—————————- ——————–
BC_SLD_CHANGELOG              14162
BC_SLD_INST                   12830
J2EE_CONFIGENTRY              5870
BC_SLD_ASSINST                3905
EP_ATTR_VALUES3               3082
J2EE_CONFIG                   2163
DBH_STG_PKG_CACHE_METRICS     1421
SYSCOLDIST                    1193

Then delete the change log in https://<server>/sld
Select “Administration -> Maintenance -> Clean Up Change Log -> Remove Entries”.
I then scheduled a standard job to do this work from the “Cleanup Task Configuration” tab.
Finally, reorg the following tables to release the space:

db2 “REORG INDEXES ALL FOR TABLE SAPPODDB.BC_SLD_CHANGELOG”

db2 “runstats on table SAPPODDB.BC_SLD_CHANGELOG AND INDEXES ALL”

db2 “SELECT TABNAME, NPAGES FROM SYSCAT.TABLES WHERE TABNAME = ‘BC_SLD_CHANGELOG'”

TABNAME                       NPAGES
—————————- ——————–
BC_SLD_CHANGELOG              1205

That’s it.

Starting and Stopping Individual SAP AS Java Server Processes

Should you need to restart either manually or automatically (via script) a specific AS Java server node, it’s possible to use the sapcontrol tool to provide precise control.

The method detailed below is based on the documentation provided here:
Performs a given control function (EnableProcess/StartProcess, DisableProcess/StopProcess,
SoftStopProcess, ActivateProcess, DeactivateProcess, RestartProcess, SoftRestartProcess,
DumpStackTrace, EnableDebugging, DisableDebugging, IncrementTrace, DecrementTrace) on a given AS
Java process. processname must match a process name in the AS Java process list returned by
J2EEGetProcessList. To perform AS Java instance-wide operations (StartInstance, StopInstance,
RestartInstance, BootInstance, RebootInstance), use processname “all”.
Based on the above information, we can query the AS Java processes for a specific AS Java instance, using the following command line as the sidadm user:

sidadm> sapcontrol -host [host] -nr [sys##] -function J2EEGetProcessList
You should substitute the “host” and “sys##” with the host of your application server (virtual host) and the SAP instance number.
The command will return a list of the processes that the instance is running.
For a 2 node AS Java system, you can see the Server0 and Server1 processes in the list.
To restart Server0 on the AS Java instance use the below command line as the sidadm user:

sidadm> sapcontrol -host [host] -nr [sys##] -function J2EEControlProcess “server0” “RestartProcess”
You should substitute the “host” and “sys##” with the host of your application server (virtual host) and the SAP instance number.
Change “server0” for “server1” if you want to restart server1.
Based on the above restart, you can monitor the restart by using the below command line to see when the restart is completed:
sidadm> sapcontrol -host [host] -nr [sys##] -function J2EEGetProcessList | awk -F, ‘{ if ( $2 != “” && FNR > 5 ){ print “Name: “$2″ttState: “$8″ttStarted: “$9 }}’
You should substitute the “host” and “sys##” with the host of your application server (virtual host) and the SAP instance number.

Deploying SAP Portal JDBC Adapter SDA using Telnet

Once you’ve built a new com.sap.aii.adapter.lib.sda file ready for deployment into the SAP AS Java, you have two options for deployment in a NW 731 system:
– Deploy using SUM
– Deploy using Telnet

The SUM method can be arduous, taking anywhere from 20 minutes to over a couple of hours if you don’t already have the software.
Using Telnet is the lowest common denominator, uses existing software already installed and can take as little as 5-10 minutes.
As the <sid>adm user on the AS Java application server, use Telnet (must be installed on the Unix, Linux or Windows O/S, to perform the deployment:

sidadm> telnet 127.0.0.1 5<##>08
Administrator
<pw>

Once connected, you can query the version of the SDA: 

explore name=com.sap.aii.adapter.lib

Development Component:
name: [com.sap.aii.adapter.lib], vendor: [sap.com], location: [SAP AG], version: [7.3113.20140808110905.0000], software type: [primary-library], csn component: [BC-XI-CON-AFW], dependencies: [[name: ‘engine.j2ee14.facade’, vendor: ‘sap.com’]], archive type: [DC]

Then deploy your new SDA file:

deploy /tmp/sap.com_com.sap.aii.adapter.lib  on_deploy_error=stop version_rule=all

Notice that you are disconnected from Telnet at this point.
You should wait around 5-10mins, then re-connect into Telnet as Administrator, then run get_result:

> get_result
The status of the deployed SDUs is Success.
Additional information:

[sdu id: [sap.com_com.sap.aii.adapter.lib]
sdu file path:
/usr/sap/<SID>/J##/j2ee/cluster/server1/temp/tc~bl~deploy_controller/archives/124/1416245030759972000/com.sap.aii.adapter.lib.sda]
version status: [SAME]
deployment status: [Success]
description: []

That’s it.

SAP NW 7.31 Java – HTTP Tracing

Scenario:  You would like to trace a HTTP connection to a Netweaver 7.31 Java stack.

Prior to NW 7.31 you would have enabled tracing in either the old Java Administrative Tool, or newer Netweaver Administrator by setting the “enable” flag for tracing parameters of the HTTPProvider dispatcher service (see my previous blog article here).

Since Netweaver 7.31, the Java stack now includes an ICM (Internet Communication Manager) which is the main access point to which HTTP communications are routed to the Java server nodes.
Therefore, tracing in NW 7.31 Java is actually more like the ABAP stack tracing, because you simply increase the trace level in the ICM and then check the dev_icm trace file.

So the next question is, how do you access the ICM to increase the trace level in a Java stack?
Well this can be performed with the help of the SAPMC (only one “M” and not to be confused with SAP MMC for Windows).
The SAPMC was introduced in later NW 7.0 patches and is part of the sapstartsrv service.
The sapstartsrv actually listens on TCP port 5<##>13.  So if you have access through your firewall, navigate to https://<app server>:5<##>13   and the the Java based applet will start up (note that you’ll need Java 1.4 or above on your PC).

Once loaded, you can see the SAP MC and expand the “AS Java” branch to locate the “Process Table” item:

SAP MC management console

From the “Process Table” you should be able to right click the ICM (on the right) and increment the trace level:

SAP MC increase ICM trace level

The trace level is dynamically increased.
To see the trace file, right click again and select “Show Developer Trace“:

SAP MC ICM display trace

You can always see the current trace level by right clicking the ICM and selecting “Parameters…”, or actually right clicking the ICM node further up the tree and selecting “Parameters…”:

SAP MC show ICM parameters

The current trace level is shown as the “rdisp/TRACE” parameter value on the Dispatcher tab:

SAP MC rdisp/TRACE ICM

Again, right clicking the actual ICM node in the tree gives you direct access to the ICM management web page:

MWSnap106 2014-07-23, 09_39_44

From the ICM management page, you can also see the current trace level:

ICM Manager Monitor

Good luck with your tracing.

HowTo: SAP NW731 Java Full HTTP Trace With Headers Content & Timings

Scenario: You have a SAP Java stack which is hosting either some SAP components/modules, or it’s hosting your own custom Java code.
You would like to perform a full HTTP trace so that you can see the HTTP headers and returned content during a HTTP session between your browser and the SAP HTTP Server.  You also wish to see timings for the processing time of the response.
Following SAP note “724719 – How to enable HTTP tracing in the SAP J2EE Engine 6.40/7.0”  connect into the SAP Netweaver Administrator main web page as J2EE_ADMIN:
SAP NWA J2EE_ADMIN
On the left-hand side, select “System Properties”:
SAP NWA System Properties
Select the dispatcher item under “<SID> -> Instance -> Dispatcher”:
SAP NWA System Properties despatcher
On the Services tab, select “http”:
SAP NWA System Properties despatcher http service
In the “Properties” tab at the bottom, select “HttpTrace” and click the “Modify” button:
SAP NWA System Properties dispatcher http service httptrace
image
Now change the trace setting to the following:
SAP NWA System Properties dispatcher http service httptrace enable
The possible values are described in the SAP note as:
enable
         Using this option will cause the whole requests/responses to be written
enableHeaders
        Using this option will cause only the headers of each request/response to be written
enableHex
        Using this option will cause the whole requests/responses to be written in a 16-column hexadecimal format. This option is valid for J2EE Engine SP10 or higher
enableHexHeaders
        Using this option will cause only the headers of each request/response to be written in a 16-column hexadecimal format. This option is valid for J2EE Engine SP10 or higher
The SAP note also recommends to set the property HttpTraceTime, to “true”.
This is described further in SAP note “972540 – Tracing dispatcher and server response times“.
Since you would only get the dispatcher processing time, you should also set the server trace property as described in the above note, to allow you to see the server processing time:

1) dispatcher + server processing time trace in http access log
– On the dispatcher enable Http Provider#s property #HttpTraceTime#
– On the servers enable Http Provider#s property #LogResponseTime#
Then messages in the httpaccess response file will contain additional fields  d[…] and c[…] where d is dispatcher and server processing time and c is client id.
2) additional traces – if the request is processed for more than XX seconds
– there is a new Http Provider#s property on the server # #TraceResponseTimeAbove#
– if its value is -1 then there will be no additional traces
– if its value is >-1 (the value represents the response time in ms)
    then additional traces will be written in the default trace file only for these requests which response time is >= property#s value
– on the servers put the log severity for HttpProvider service to DEBUG

Once you have enabled the tracing, no restart of the Java stack is required.  It is activate immediately.
Simply check the trace output file /usr/sap/<SID>/<instance>/j2ee/cluster/dispatcher/log/services/http/req_resp.trc  (for NW731+) using operating system level file viewers (or AL11 in an ABAP stack).
For information, you should be aware of the HTTP 1.1 status codes, so you know what to look for if you are tracing an authorisation error (HTTP authorisation) or some other HTTP related issue  https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html .