Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Does the field "MANDT" work?

daixiong_jiang3
Active Participant
0 Kudos

i saw two statements in SAP abap objects performance examples(access through SE38):

SELECT * FROM SBOOK CLIENT SPECIFIED INTO SBOOK_WA

WHERE CARRID = 'LH'

AND CONNID = '0400'.

ENDSELECT.

Runtime: 2.689.736 microseconds

______________________________________________

SELECT * FROM SBOOK CLIENT SPECIFIED INTO SBOOK_WA

WHERE MANDT IN ( SELECT MANDT FROM T000 )

AND CARRID = 'LH'

AND CONNID = '0400'.

ENDSELECT.

Runtime: 81.329 microseconds

And usually wo do not have to specify the field "MANDT", and does the field really work like the above way?

2 REPLIES 2

daixiong_jiang3
Active Participant
0 Kudos

A single SAP system can manage the application data for several separate areas of a business (for example, branches). Each of these commercially separate areas in the SAP system is called a client, and has a number. When a user logs onto the SAP Web AS ABAP, they specify a client. The first column in the structure of every database table containing application data is the client field (MANDT, from the German word for client). It is also the first field of the table key. Only universal system tables are client-independent, and do not contain a client name.

By default, Open SQL statements use automatic client handling. Statements that access client-dependent application tables only use the data from the current client. You cannot specify a condition for the client field in the WHERE clause of an Open SQL statement. If you do so, the system will either return an error during the syntax check or a runtime error will occur. You cannot overwrite the MANDT field of a database using Open SQL statements. If you specify a different client in a work area, the ABAP runtime environment automatically overwrites it with the current one before processing the Open SQL statement further.

Should you need to specify the client specifically in an Open SQL statement, use the addition

... CLIENT SPECIFIED ....

directly after the name of the database table. This addition disables the automatic client handling and you can use the field MANDT both in the WHERE clause and in a table work area.

andre_kster
Explorer
0 Kudos

Did you execute the examples twice?

My assumption is, that the second select was much faster due to the data being buffered in the database RAM from the first select.