‎2007 Sep 19 7:47 AM
Hello Experts!!
I have a report which uses the insert statemet in the following way-
INSERT Z_TRANS_DTL CLIENT SPECIFIED
However, this statement works in certain systems and does not work in others. It returns a sy-subrc of 4 in those systems. What is the cause for this? Is writing insert this way obsolete? If so, why is it still working in certain systems?
Please help me out on this!
Cheers!
Smitha
‎2007 Sep 19 7:49 AM
hi Smitha,
the problem could be with CLIENT SPECIFIED addition, probably it wants to insert into a client, which does not exist in that system.
On the other hand in which system does it work and in which not?
thanks
ec
‎2007 Sep 19 7:49 AM
hi Smitha,
the problem could be with CLIENT SPECIFIED addition, probably it wants to insert into a client, which does not exist in that system.
On the other hand in which system does it work and in which not?
thanks
ec
‎2007 Sep 19 7:51 AM
A single R/3 System can manage the application data for several separate areas of a business (for example, branches). Each of these commercially separate areas in the R/3 System is called a client, and has a number. When a user logs onto an R/3 System, 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
<i>... CLIENT SPECIFIED ....</i>
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.
Please reward points if useful
‎2007 Sep 19 7:53 AM
Hi,
By default, data is only inserted in the current client. However, if you use the <b>CLIENT SPECIFIED</b> addition, you can switch off the automatic client handling. This enables you to enter data for any client in a cross-client table, not just in the client in which you are logged on. In this case, the client field is treated like a normal field to which you can assign a value in the work area.
Regards,
LIJO
‎2007 Sep 19 7:54 AM
If you use CLIENT SPECIFIED the automatic client handling of OPEN SQL is turned off. This means that you will have to give the client identifier in the source. Make sure you are entering the correct client value in the MANDT field.
‎2007 Sep 19 7:55 AM
Hi,
chek this
1. INSERT INTO dbtab [CLIENT SPECIFIED] VALUES wa.
INSERT INTO (dbtabname) [CLIENT SPECIFIED] VALUES wa.
2. INSERT dbtab [CLIENT SPECIFIED] FROM TABLE itab. oder
INSERT (dbtabname) [CLIENT SPECIFIED] FROM TABLE itab.
3. INSERT dbtab [CLIENT SPECIFIED]. oder
INSERT *dbtab [CLIENT SPECIFIED]. oder
INSERT (dbtabname) [CLIENT SPECIFIED] ... .
Effect Adds new records to a database table (see relational
database). You can specify the name of the database table
either directly in the program in the form dbtab or at runtime
as the contents of the field dbtabname. In either case, the
database table must be declared in the ABAP Dictionary. You
can only insert data using a view if the view refers to a
single table and has the maintenance status "No restriction"
in the ABAP Dictionary.
By default, data is only inserted in the current client.
However, if you use the CLIENT SPECIFIED addition, you can
switch off the automatic client handling. This enables you to
enter data for any client in a cross-client table, not just in
the client in which you are logged on. In this case, the
client field is treated like a normal field to which you can
assign a value in the work area.
Regards,
Nagaraj
‎2007 Sep 19 7:57 AM
Hi,
Following is the effect of using client specified in Insert statement.
EFFECT:
-
Automatic client handling is switched off.
This allows you to process data on a cross-client basis for client-specific tables. The client field is then treated like a normal table field which the program must fill with values in the work area wa.
If you execute the statement on a client-specific tables, then you need to pass the MADT values programatically.Just check for this scenario in the systems where the insert with client specified is not successful.
Hope this helps....
Regards,
Dilli
‎2007 Sep 19 11:25 AM
Hello All!!
Thanks for all the replies. It helped me greatly!
I need a clarification. This is the statement I am using-
INSERT Z_TRANS_DTL CLIENT SPECIFIED
Z_TRANS_DTL has mandt field which is appropriately populated.
If supposing I am executing the report in client 200 and the mandt value in the work area Z_TRANS_DTL is 000, the insertion will happen only in client 000? And will the table Z_TRANS_DTL in client 200 not contain this inserted row? What will be the sy-subrc value in this case?
Also, will this insertion happen only for that system in which i am executing the report? I mean, if supposing I am executing this report in a system called ABC client 200 and the mandt value in the insert statement is 000, will it update the table in system ABC client 000 or can it be any system with client 000?
I am having a problem wherein when i execute this statemnt in one system, the sy-subrc value returned is zero whereas the same statement if i execute in yet another system I get sy-subrc = 4. In both cases the mandt value is different from the one I am executing the report in.
Any help on this will be greatly appreciated!!
Thanks again!
Smitha
‎2007 Sep 19 12:48 PM
Data is client specific. So, whatever data you enter in client XXX will be available only in client XXX and not in client YYY. The system itself should not matter, and the data will get inserted in the client you specified in the system that you are running this report in. Now, the sy-subrc value in the new system you are running this report maybe 4 because the client you are specifying in the source does not exist in this new system. You can find all the clients present in a system by going to T000 table. Hope this helped. If you have any more clarifications, feel free to get back to me.