PracticePracticetypeA convention or specification you conform to rather than install. The answer itself, not evidence about one.See every one →What this type is →by SAPby SAPoriginPublished by SAP itself. A visible facet, never an input to a reading — a dormant official plugin reads exactly like a dormant independent one.See every one →Reference

s4hana-hana-audit-policies

SQL templates for the SAP HANA audit policies of the database tenant an SAP S/4HANA system uses, in four sets from the mandatory default policies to scenario examples.

An SAP S/4HANA system needs HANA audit policies to trace security-relevant changes on its database tenant, and this project ships them as SQL files instead of leaving each customer to write its own. They come in four sets: a mandatory one, identical to the policies the SAP HANA Cockpit Audit Policy Wizard provides and set as the default for new installations of SAP S/4HANA 2021, 2022, 2023 and SAP BW/4HANA 2021 and later; a second for S/4HANA schema access logging, which the README says varies with how the database is used; a third for an extended system changelog and monitoring; and a fourth of examples for specific scenarios that the README says should not be applied without careful consideration. A fifth file exposes part of the audit log through a table function, for a user who should not be granted select on every entry. Applying and adjusting the templates on a tenant stays the administrator's job: the README notes that technical users not handled as the SQL files describe can generate a high number of audit log events, and that a policy fails to be created if the global minimal retention period is higher than the one in the policy.

Facts

Last pushLicenceApache-2.0

Where it sits

Lives in
Provides
Audit loggingBTPAudit loggingcapabilityRecording who touched personal or sensitive data, in a form an auditor accepts, without hand-writing it in every handler. It is often confused with application logging, which records what the code did rather than who accessed what.
Requires
SAP S/4HANASAP S/4HANAoutside the atlasthe system whose database tenant the policies are written for; the README states it as the one requirement.SAP HANASAP HANAartifactthe database the SQL files are run against: the HANA tenant the S/4HANA system uses.

Who is behind it

SAP SamplesSAP SamplesOrganisationMaintains this
In the atlas: maintains 222
@SAP-samples
maintainerAjinkya PatilPersonContributes to this
In the atlas: contributes to 112
@ajinkyapatil8190
Bjoern BrencherPersonContributes to this
In the atlas: contributes to 1
@bjoernbrenchersap
Brian BernardPersonContributes to this
In the atlas: contributes to 64
@btbernard
Joe GörlichPersonContributes to this
In the atlas: contributes to 1
@joegoerlich
Lea PoletinPersonContributes to this
In the atlas: contributes to 1
@leapoletinsap
ChristianePersonContributes to this
In the atlas: contributes to 1
@saint-j
6 contributors

What it declares

Every artifact

Type
Practice
Origin
By SAP
Use as
A reference

Connections3

README

quoted from SAP-samples/s4hana-hana-audit-policies under Apache-2.0, read
SAP-samples/s4hana-hana-audit-policies/README.mdOn GitHub

SAP HANA Audit Policy Templates for SAP S/4HANA

REUSE status

Description

This project provides HANA audit policy templates for the SAP HANA database tenant used by SAP S/4HANA. The HANA audit policy templates for S/4HANA provide a set of policies.

  1. Mandatory HANA Audit Policies (File: 1_hana_audit_policy_mandatory.sql)
    A first set of policies defined as mandatory ensure traceability of security relevant changes. These have the prefix 'SAP'. They are identical to the audit policies provided by "SAP HANA Cockpit Audit Policy Wizard" (starting with SAP HANA Cockpit 2.0 SP13). These policies are set as defaults for HANA database tenant used by S/4HANA for new installations with SAP S/4HANA 2021, 2022, 2023 and SAP BW/4HANA 2021 and later. For conversions and system copies, HANA audit policies are only enabled as defaults in case no other HANA audit policies are existing.
  2. S/4HANA Schema Access Log HANA Audit Policies (File: 2_s4hana_hana_audit_policy_recommended.sql)
    The second set of policies define "recommended" policies for S/4 systems. These have the prefix 'SAPS4'. These policies vary with the usage of the SAP HANA DB and cannot be defined identical for all systems.
  3. S/4HANA Optional HANA Audit Policies (File: 3_s4hana_hana_audit_policy_optional.sql)
    The third set called “optional” suggests policy definition for extended system changelog and monitoring. These have the prefix 'SAPS4_Opt'.
  4. S/4HANA HANA Audit Policies additional consideration (File: 4_s4hana_hana_audit_policiy_additional.sql)
    The fourth called “additional” gives examples for policy definition for specific scenarios. It is not recommended to apply the policies without careful consideration. There is no predefined naming. Adoption cannot be done out of the box. Adjustments depend on the usage of an individual HANA database.
  5. S/4HANA Expose View on Auditlog (File: 5_s4hana_expose_view_on_auditlog.sql) The fifth file contains an example implementation of a table function. It is needed if a part of the HANA audit log should to be exposed to a user without granting select on all audit entries.

Please refer to SAP Note 3016478 for more details and explanations.

Requirements

To use those policies you need SAP S/4HANA.

Download and Installation

Information how to list and adjust HANA audit policies can be found on SAP HANA Platform on the SAP Help Portal.

Known Issues

  • If technical users (e.g. ABAP Database user , SAPHANADB, SAPDBCTRL) are not handled as described in the SQL files, a high number of HANA audit log events might be generated.
  • If the global minimal retention period limit (INI parameter minimal_retention_period) is higher than the minimum period in a HANA audit policy, creation of the policy will fail.
  • Additional comments for every policy are provided. Take them into consideration before activating a policy.

How to obtain support

Create an issue in this repository if you find a bug or have questions about the content.

For additional support, ask a question in SAP Community.

Contributing

When contributing to this repository, please first discuss the changes you wish to make through an issue, email, or any other method with the owners of this repository.

License

Copyright (c) 2025 SAP SE or an SAP affiliate company. All rights reserved. This project is licensed under the Apache Software License, version 2.0 except as noted otherwise in the LICENSE file.

Apache-2.0, read
Audit logging
  1. SAP Audit Log serviceIngests and retains compliance audit data from BTP

Details

Sources3
Added by handdiscovered herechecked
github.com/SAP-samples/s4hana-hana-audit-policiestree, pushes, contributors, CIchecked
README.mdquoted, and what the entry declareschecked

Sources are graph entities: the same page may back several entries, and an unreachable source flags every row that rests on it.

Compatibility and provenance
discovered viaAdded by hand
first seen in the atlas
ecosystem and domainbtp, security-and-compliance
Contributors6

From the repository’s contributor list, .

History in the atlas1
  1. First seen.
For your agent
Ref
artifact:sap-samples-s4hana-hana-audit-policies
JSON
/artifacts/sap-samples-s4hana-hana-audit-policies.json
MCP
Connecting an agent