Using MANDT in tables.

Rick Sample Rick.Sample at gbe.com
Thu Aug 19 13:08:55 EDT 2004


I did some reading on this subject and seems that MANDT in automatically  
included in SELECT queries. Like, " WHERE MANDT = SY-MANDT AND ..."
And, If you want to select data from several clients, you must use the .... 
CLIENT SPECIFIED addition in the FROM clause. 
 
If the system automatically includes WHERE MANDT = SY-MANDT 
then the use of WHERE MANDT = SY-MANDT in my own SELECT statement 
would be mute. Except for the fact that WHERE MANDT = SY-MANDT would 
be entered twice. (?)
 
Question is, does this have any impact on system performance for an Oracle DB?
This is auto generated code when I built a new Business Object. 
I test it both ways. Taking out he MANDT and leaving it in. 
 
What I have told everyone in ABAP unless specifically directed NOT 
to include this WHERE MANDT = SY-MANDT, I am using it because 
this is what I see in most SAP code that I inspected. 
 
 
FORM SELECT_TABLE_ZNSRH USING SUBRC LIKE SY-SUBRC.
* Select single * from ZNSRH, if OBJECT-_ZNSRH is initial
  IF OBJECT-_ZNSRH-MANDT IS INITIAL AND
     OBJECT-_ZNSRH-NSRDOC IS INITIAL.
  SELECT SINGLE * FROM ZNSRH CLIENT SPECIFIED
   WHERE MANDT = SY-MANDT AND
         NSRDOC = OBJECT-KEY-NSRDOCUMENTNUMBER.
    SUBRC = SY-SUBRC.
    IF SUBRC NE 0. EXIT. ENDIF.
    OBJECT-_ZNSRH = ZNSRH.
  ELSE.
    SUBRC = 0.
    ZNSRH = OBJECT-_ZNSRH.
  ENDIF.
ENDFORM.
 
....
Other get_property code using MANDT excluded for brevity.
 
4.6C / Oracle DB
 
 
Thanks!
 
 
 
 
 
Rick Sample
SAP Workflow / Developer
Graybar, Inc.
11885 Lackland Rd.
63146-4208
314.573.5822
Rick.Sample at GBE.com
 
 
 
>>> jp47 at matrix.swt.edu 8/18/2004 12:02:40 >>>
Rick,
 
You are right, this is a trick question.
 
As a general rule, I try to use MANDT, since this is the style I see
most common in SAP.  Making your "Z" table data Client Dependent allows
for data diversity across clients within a system. This data segregation
allows for more flexibility and control in development/testing,
training, and production.  For master data (ie customizing) that is
truly system wide (and essential), you may consider Client Independent
tables.  This will ensure data consistency system wide and will
eliminate the need to populate data in all clients.    
 
For workflow related settings, I plan to stick with MANDT.  
 
Mark        
 
-----Original Message-----
From: SAP Workflow [mailto:Owner-SAP-WUG at MITVMA.MIT.EDU] On Behalf Of
Rick Sample
Sent: Wednesday, August 18, 2004 11:17 AM
To: SAP-WUG at MITVMA.MIT.EDU 
Subject: Using MANDT in tables.
 
 
We are creating tables for a new application. While some of it 
should have gone directly to ABAP like creating the DB (tables) 
and programs.
 
We created some tables with MANDT and was asked why we decided to use 
MANDT in our tables. 
 
Not sure if this was a trick question so I need to ask why wouldn't we 
want to use MANDT? 
When I created a new Business Object it checks for Mandt by default. 
 
Pros / cons?
 
Rick Sample
WorkFlow Developer
Graybar, Inc. 
 


More information about the SAP-WUG mailing list