Sub topic 3
Client-dependent versus cross-client settings
This chapter assumes you can navigate SAP GUI and transaction codes, know that an SAP system holds several clients, and understand database tables with primary keys. It builds on the previous chapter, where a client was introduced as the unit of business data separation. Here you learn how SAP decides which data belongs to one client and which is shared by all of them, and why that decision determines the effect of a configuration change.
The two scopes
Every table in the ABAP Dictionary is either client-dependent or cross-client.
- A client-dependent table has the client field (usually
MANDT) as the first key field. Each row belongs to exactly one client. - A cross-client table has no client field. Each row is visible in every client of the system.
The consequence is practical. If you change a client-dependent entry in client 100, clients 200 and 300 are unaffected. If you change a cross-client entry from any client, every client in that system sees the change immediately.
| Aspect | Client-dependent | Cross-client |
|---|---|---|
| Client field in the table | Yes, first key field | No |
| Visibility of a row | Only the client that owns it | All clients in the system |
| Typical content | Company codes, plant definitions, payment terms, master and transaction data | Repository objects, some system-wide settings, some data of the ABAP runtime |
| Effect of a change | One client | The whole system |
| Controlled in SCC4 by | Client role and the Customizing recording flag | The "Cross-Client Object Changes" setting |
Most Customizing is client-dependent. That is why one development system can host a sandbox client, a Customizing client and a unit-test client side by side, each with different settings.
How Open SQL handles the client field
In ABAP, Open SQL applies automatic client handling. When you read a client-dependent table, the runtime adds a condition on the client field for the current logon client. You do not write MANDT in the WHERE clause.
The following report reads company codes from the client-dependent table T001. Company codes are defined in the IMG. The query returns only the rows of the client you are logged on to.
REPORT zdemo_company_codes.
SELECT bukrs, butxt, ort01, waers
FROM t001
ORDER BY bukrs
INTO TABLE @DATA(company_codes).
LOOP AT company_codes INTO DATA(cc).
WRITE: / cc-bukrs, cc-butxt, cc-ort01, cc-waers.
ENDLOOP.Run it in two clients of the same system and you can get different lists. If a company code exists in client 100 but was never created in client 200, it simply does not appear in client 200. The same rule applies to inserts: Open SQL writes the current client into the row.
A cross-client table has no client field, so the same statement returns all rows regardless of the logon client.
Recognizing the scope of a table
You can check the scope in several ways.
- In transaction
SE11, display the table and look at the first key field. A field of typeMANDT(data elementMANDT) marks a client-dependent table. - In the table maintenance generator (
SE11, then Utilities, Table Maintenance Generator), the view is maintained withSM30. A client-dependent table shows only the entries of your logon client. - In
SE16orSE16N, a client-dependent table offers a client field in the selection screen. A cross-client table does not. - Naming conventions help but do not prove anything. Do not rely on a table name to decide the scope.
The client field is not always called MANDT. Some tables use another name for a field of the client data type. Look at the type, not at the name.
Why the distinction matters for Customizing
Two things follow from the scope of the tables behind an IMG activity.
Effect on other clients
A client-dependent change stays in your client. A cross-client change reaches all clients at once, including a client that holds a running test or even a productive business process. Because of that, SAP protects cross-client changes through a client setting in SCC4.
Effect on transports
Customizing requests carry table entries. For a client-dependent table, the request records the client in which the entries were changed. When the request is imported, the entries are written into the target client you choose during import, for example client 100 in the production system.
For a cross-client table, the target is the whole system. The request does not target a single client, and the import affects every client in the target system.
This is why a Customizing request is created in a specific client and imports into a specific client. The client of the request and the client of the import are separate decisions, which the later chapters on STMS cover.
Client settings that guard the boundary
The settings maintained in SCC4 are stored in table T000. Two flags matter for this chapter:
- The change-recording flag decides whether changes to client-dependent Customizing are recorded in a request.
- The cross-client flag decides whether cross-client objects and Customizing can be changed from this client.
The following report reads these settings for the current client.
REPORT zdemo_client_settings.
SELECT SINGLE mandt, mtext, cccategory, cccoractiv, ccnocliind
FROM t000
WHERE mandt = @sy-mandt
INTO @DATA(client_settings).
IF sy-subrc = 0.
WRITE: / client_settings-mandt, client_settings-mtext,
/ 'Role:', client_settings-cccategory,
/ 'Change recording:', client_settings-cccoractiv,
/ 'Cross-client changes:', client_settings-ccnocliind.
ENDIF.T000 is itself a cross-client table, which is why the WHERE clause names mandt explicitly. In a cross-client table, mandt is an ordinary field, so the condition is how you pick one client's row.
The next chapters explain each flag in detail. For now, remember the rule of thumb: a productive client normally forbids both Customizing changes and cross-client changes, so settings reach it only through transports.
Reading the effect of an IMG activity
Before you run an IMG activity in a shared development system, work out its scope.
- Open the activity and choose the documentation. Many activities state whether the settings are cross-client.
- Use the activity's technical information, or note the table or view it maintains.
- Check the scope in
SE11. - Check
SCC4for the client you are in. If cross-client changes are not allowed, the system blocks the change and you need a client where they are allowed.
Common errors
- Assuming a setting is local. A developer changes a cross-client table in a sandbox client and breaks tests in another client. Check the scope first.
- Expecting a client-dependent change to appear everywhere. A consultant configures a plant in client 100 and finds it missing in client 200. Each client needs its own entry, or you must copy it with a client copy or a transport.
- Comparing clients across systems without checking the client. The same table can hold different values in the development, quality and production systems. Compare like with like: system and client.
- Writing
WHERE mandt = ...against client-dependent tables. Open SQL already restricts the client. Adding the condition is unnecessary, and to read another client you must use theCLIENT SPECIFIEDaddition, which disables the automatic handling. Use it with care and only in system tools. - Treating cross-client as harmless because it is "only configuration". A cross-client change in a production system takes effect in all clients at once and is not limited by the transport target client.
Summary of the model
Scope is a property of the table, not of the request or the user. The first key field tells you the scope. The scope tells you who sees the change now and which clients receive it after a transport. SCC4 decides whether the change is allowed in the first place.
Exercise
A colleague changes an entry in a cross-client table while logged on to client 100 of the development system. A tester is working in client 200 of the same system. Will the tester see the change, and what would be different if the table were client-dependent?
Show answer
The tester sees the change at once, because a cross-client table has no client field and every client of the system reads the same rows. The change is allowed only if SCC4 permits cross-client changes in client 100. If the table were client-dependent, the entry would belong to client 100 only. Client 200 would keep its own entries and the tester would not see the change.
Exercise
You run the report zdemocompanycodes in clients 100 and 200 of the same system and get different lists. Which property of table T001 explains this, and how would you confirm the property in SE11?
Show answer
T001 is client-dependent. Open SQL adds the current logon client as a condition, so each client returns only its own rows. In SE11 you confirm this by displaying T001 and checking that the first key field is the client field (type MANDT).