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: 

Copy T000 to Custom Table/when only client field is Primary field

narendra_gupta1
Explorer
0 Kudos
608

Hi All,

I want to copy records of table T000 to custom table. I am using below code:

DATA : it_t000 TYPE TABLE OF t000,

wa_t000 TYPE t000.

SELECT * FROM t000 INTO TABLE it_t000.

LOOP AT it_t000 INTO wa_t000.

MODIFY zt000 FROM wa_t000. ( here ZT000 is custom table copied from T000)

CLEAR wa_t000.

ENDLOOP.

The problem is T000 have MANDT field as primary key, which is copying only one record to my custom table which belongs to my current client.

I tried to change my custom table where i added 2 extra fields (char3) to my custom table to keep value of MANDT and kept serial no as primary key but now the custom table is facing issue while activating custom table with below error.

"Field MANDT of foreign key ZT000-MWAER not found :

"Data exists and the client-dependency has changed."

Please help.

Thanks,

Naren

1 ACCEPTED SOLUTION

hohoman
Active Participant
295

Hello,

if you want to select cross Client you have to add the commands CLIENT SPECIFIED to the SQL Statements and then you have to add MANDT to the condition clause "MANDT GT 0" ... then u should get all records

Your target table should have one real and Logical Client field ... the real one to address the Client where the recordsets are stored and a Logical one (not DATATYP CLNT) to store the Client numbers.

Regards

holger

3 REPLIES 3

hohoman
Active Participant
296

Hello,

if you want to select cross Client you have to add the commands CLIENT SPECIFIED to the SQL Statements and then you have to add MANDT to the condition clause "MANDT GT 0" ... then u should get all records

Your target table should have one real and Logical Client field ... the real one to address the Client where the recordsets are stored and a Logical one (not DATATYP CLNT) to store the Client numbers.

Regards

holger

0 Kudos
295

Thanks Holger, for quick reply and solution .

can you answer one more question? do we have any BAPI to update T000?

hohoman
Active Participant
295

No there is no Bapi this would not make sense T000 is very important table wrong updates or deletion will remove a client logically from the system. And you are not able to login anymo