Client Dependent vs Client Independent
In SAP, highest level of organization structure is client. Whenever we login to SAP system, we login to a specific client. Data in the R/3 system is categorized as client-dependent and client-independent. I have collected some details about Client Dependent vs Client Independent concept of SAP.
Client dependent data means the data which user creates in one client is limited to that client only and it is not accessible in other clients
Client Independent means data means the data which user creates in one client that is available in that as well as in other clients
Client Dependent Table
- They have first field called MANDT of type CLNT which contains the client number.
- The data set can be different in this type of table for different client.
Client Independent Table
- They don’t have that MANDT field in table.
- This Table is called cross client table means for all the clients they have the same entries in the table.
- Client Dependent: SAPscript and STD texts data
- Client Independent: Smart forms, all dictionary objects data and repository objects data like programs, function modules, tables etc.
Smart Forms are Client Independent because when you activate them you are actually generating a Function Module. This means that the Print Programs actually call a FM instead of using the “OPEN_FORM”, “WRITE_FORM” etc. FM’s that SAPscript use.
There is no specific reason behind why SAPscripts are designed as client dependent and smart forms as client independent!
SAPscript technology is based on a mainframe product from the 1980s. SAPscript forms have always been — under the hood — relatively passive objects, with minimal embedded logic. These forms were designed to be driven and controlled by ABAP programs, much in the way ABAP programs read in database tables to produce reports; if you ever download a SAPscript form (e.g., via utility program RSTXSCRP), and look at the portable text file it produces. Many text objects (e.g., invoice header texts) are bound directly to documents which are client-dependent, so it makes sense for these text objects to also be client-dependent. From a complexity standpoint, SAPscript forms are close enough to these text objects where we can see how it made sense at the time to make them client-dependent too. Sap script was developed a long back and Smart form is developed to avoid these types of some restrictions.
The ABAP editor is client independent. This means that a program, once created, will be available in all the clients of the system. The data that the program tries to access, though, is client dependent.
Understanding Client-Dependent and Client-Independent Tables
There are two types of tables in an R/3 database: client-dependent and client-independent. A table is client-dependent if the first field is of type CLNT. The length will always be 3, and by convention, this field is always named MANDT. If the first field is not of type CLNT, the table is client-independent.
For example: assume there are two clients in system – 800 and 900. A program selects rows from table LFA1 and writes out LFA1-LIFNR. When this program is run in client 800, only those rows are selected where MANDT equals 800. This happens automatically because the first field in the table is of type CLNT. If the user were to log on to client 900 and run the same program, those rows of data would be found and written out where client is 900.
The logon client mechanism divides the rows within a client-dependent table into distinct groups. To access a different set of data, the user logs on and specifies a different client number.
NOTE: The user master records (containing R/3 user IDs) are client-dependent. Therefore, to gain access to a client, the security administrator must create a new user ID for you within that client.
Developers and testers use the logon client mechanism to create and access multiple, independent sets of data within a single table.
For example: assume two typical programmers are working on an enhancement to the billing system. User-1 is modifying the update transaction and is creating a new report to go with User-2′s modifications.
User-2 sets up data for his test run, executes his report and obtains output. User-1 works in the next cubicle, but due to lack of communication he is not aware that his transaction uses the same tables as User-2′s report. He runs his transaction and updates the data. User-1 gets what he wanted, but User-2 then modifies his code and runs his program again. His output differs from the last run, and the differences many not result from his changes, but rather they may result from User-1′s changes. What we have here is a failure to communicate.
If the tables used by User-1 and User-2′s programs were client-dependent, they could each log in to separate clients, set up independent sets of data, and test their programs without ever talking to each other. They could perform all of their testing in the comfort of their cubicles and in isolation from their coworkers.
To make their tables’ client-dependent, they only need MANDT as the first field and the R/3 system will take care of the rest. When records are added to the table, the system automatically moves the current logon client into the MANDT field when the record is send to the database. Their Open SQL select statements will only return rows where the client number in the table is equal to their current logon client number. The Open SQL database statements insert, update, modify, and delete also provide automatic client handling.
If the tables involved are all client-dependent, there can be more than one group of testers working at a time in one test system. Two teams of testers can test divergent functionality in the same set of programs at the same time provided they log on to different logon clients. The updates done by one team will not change the data belonging to the other team.
A training client could also exist on the test system. The students could log on to one client and the testers could log on to another. Both would run the same set of programs, but the programs would access independent sets of data.
NOTE: The average R/3 installation has three systems: development, test, and production. By default, each system comes with three clients installed: 000, 001, and 066. It is common to have from three to six clients in the development and test systems, but rarely will you see more than one client in production.
(Source – Different SDN forum discussions and SAP help)
Thanks for sharing the Document.
I have to specify a point regarding SAP Scripts.
Why SAP Scripts are Client dependent?
Whenever you activate the SAP Script, it converts into TEXT. In SAP all the TEXTS are client dependent. so SAP scripts are also client dependent.
Consider this point if i am correct.
Yes Pavan, you are absolutely correct. SAPscripts are converted to TEXTs and stored in tables STXH and STXL which client dependent tables.
The reason why these tables are designed as client dependent is not sure. May be because they were designed way before.
Ya correct Murtuza Chhatariya .
Thanks for your agree.
Thanks for sharing the very informative document.
I just have question.
The Logon Client mechanism takes care of defaulting the MANDT value with SY-MANDT value whenever you write a SELECT query over a client dependent table.
Now will I be able to override this functionality by specifying the MANDT explicitly in the SELECT query?
If I can, then isnt it a security loophole? i.e., if I dont have access to a particular client data, I would still be able to query for that client's data?
It is possible at least if you have access of other client. Check out key word CLIENT SPECIFIED. Also transaction SCC1 or RFCs.
I do not think it as security loophole. Client is added to keep logically related objects and data in one unit. If one should be restricted to only one client, I do not think he would be given development rights in that system to write such queries 🙂
I'll check what happenes if we do not have access of other client.
I tried to access data of one of the table for a different client for which I am not given authorization; I was able to access data using select query with CLIENT SPECIFIED keyword.
So conclusion is whenever we are given access to any system; no matter which client; we may access data of another client using programming!
Thanks for the info..
I found a documentation discussing this topic..
How Reliably Is the Data in a Multiple Client System Isolated? (SAP Library - Client Concept)
Good Information plz if you have any document share it.
Thanks alot for your information.
very important information its a basic information but it really build your concept strong. Excellent Work.