SAP Landscape Management 3.0, Enterprise Edition

Configuring User Exits

You use the user exit function in SAP Landscape Management, to provide hooks for executing custom functionality while executing default SAP Landscape Management operations. By default, user exits in SAP Landscape Management are disabled.

Context

User exits are executed as hooks of a certain well defined set of SAP Host Agent operation types.

We differentiate between the following hook types:

Hook Type

Description

Pre

User exit is executed before the actual SAP Host Agent operation

Post

User exit is executed after the actual SAP Host Agent operation

Error

User exit is executed in case the operation or the post-hook fails

The following hooks are available on SAP Host Agent side for the different operations in SAP Landscape Management:

SAP Landscape Management Operation

SAP Host Agent Hook

Application Instance

Start

StartInstance

SAP instance

StartDatabase

Database

Stop

StopInstance

SAP instance

StopDatabase

Database

Prepare

ACOSPrepare

Mount

Ifup

RegisterInstanceService

SAP instance

AttachDatabase

Database

Unprepare

ACOSPrepare

Unmount

Ifdown

UnregisterInstanceService

SAP instance

DetachDatabase

Database

All of the operations have the parameter SAPHOOKNAME. This parameter is defined as follows: <Hook Type> <SAP Host Agent Hook> .

Procedure

  1. Choose Start of the navigation pathSetup Next navigation step Settings Next navigation step EngineEnd of the navigation path.
  2. Enable the execution of user exit commands. You have the following possibilities:

    Checkbox

    Description

    Enable User Exit Scripts

    To invoke configured pre- and/or post-operation user exits, select the checkbox.

    Enable User Exit Scripts Individually per Operation

    To decide individually for each operation whether SAP Host Agent invokes the pre- and/or post-operation user exits, select the checkbox.

  3. To use error-hooks, set the profile parameter as service/hook/enableErrorHooks in the profile of SAP Host Agent. By default, the profile of SAP Host Agent is named host_profile and is located as follows:
    • Windows

      c:\Program Files\SAP\hostctrl\exe

    • UNIX

      /usr/sap/hostctrl/exe

  4. Restart SAP Host Agent to apply the profile parameter settings as follows:
    • Windows

      1. Log on as administrator.

      2. In a command prompt, enter the following command:

        net stop SAPHostExec

      3. Enter the following command:

        net start SAPHostExec

    • UNIX

      1. Log on as root user.

      2. In a command prompt, enter the following command:

        cd /usr/sap/hostctrl/exe

      3. Enter the following command:

        ./saphostexec -restart

  5. Create a configuration file for each hook you want to activate.

    This configuration file consists of the following mandatory entries:

    Keyword

    Syntax

    Example

    Host Name:

    <SAP hook name parameter>

    PreStartInstance

    Command:

    <Path to user exit script> $[ <Argument 1> ]$[ <Argument 2> ]

    UNIX

    /usr/sap/hostctrl/exe/prestartinstance_hook.sh$[SAPSYSTEMNAME]/$[SAPSYSTEMNAME]$[SAPLOCALHOST]

    Windows

    c:\\Adaptive\\scripts\\PreStartInstance.bat $[SAPSYSTEM] $[SAPSYSTEMNAME] $[SAPLOCALHOST]

  6. Save the configuration file in the hooks.d/ subfolder of the executable directory of SAP Host Agent on the managed host.