04-21-2011 8:41 AM
Hello everyone
I need some advice.
I have transp. table ZINVOICE which have data in production system.
field of table are
VBELN Primary key
KUNNR
NAME
FKART
FKDAT
NETWR
STAT
TAXINVNUM
ZFKDAT
ZNETWR
now i want table ZINVOICE have 2 primary (VBELN + TAXINVNUM)
when i activate system show
******************************************
Key is already defined; field TAXINVNUM cannot be in the key
Message no. AD434
Diagnosis
When defining table fields, you added further key fields at the end after entering a block of key fields followed by a block of non-key fields.
All the key fields of a table must be in a block at the beginning of the table.
Procedure
All key fields in a table should be entered in a single block.
******************************************
is it mean that primay key must be in beginning of the table ?
can i delete field in table ZINVOICE and insert field and change position of fields to
VBELN Primary key
TAXINVNUM Primary key
KUNNR
NAME
FKART
FKDAT
NETWR
STAT
ZFKDAT
ZNETWR
can i do like this ?
is it impact my existing data in SAP ?
please advice.
04-22-2011 2:05 PM
Dear
As per my understanding
Your production Z table already has data in the previous fields.
But now you have inserted the Key field at the begining ?
If you have inserted the key field then that field should also have data in it to get saved
or to be retrieved As the primary key rule it should not be null and should be unique.
So the error will come.
So first you take the backup of the table in production and proceed.
and make the table empty and add the field which you require as key
and again upload the new data with the added fields data.
Regards,
Prakash.
04-21-2011 8:56 AM
After to have deleted the field, and re-created after the last key field (with the same name)
you have to adapt the database (SE14).
the content of the old database will be adapted with the new one.
You will not loose your data, but remember that now you have a new key field... so you can loose the duplicates according to the new key rules
04-21-2011 12:43 PM
Hi,
As you said you have to re-arrange the fields:-
VBELN Primary key
TAXINVNUM Primary key
KUNNR
NAME
FKART
FKDAT
NETWR
STAT
ZFKDAT
ZNETWR
and After that go to Se14 and Activate and Adjust the database and Click on Save data.
But you will loose duplicate data.
Regards,
Sandipan
04-21-2011 12:54 PM
As you are adding a new key, you should not get problem with duplicate records.
You should create two transport requests and activate/transport the table twice.
- In the first request, change the order of fields in the database table, don't add primary key now, activate , if required adjust database table (should not be required), transport database table in target system.
- In the second request, declare the second field as a primary key, proceed same way.
DON'T TRANSPORT BOTH REQUESTS TOGETHER
First step
VBELN K
TAXINVNUM
KUNNR
NAME
...
Second step
VBELN K
TAXINVNUM K
KUNNR
NAME
...
Question: Did you forget to add the client field, if yes you will have to adjust the table and the records will be copied in every client, you will have to create and execute a small cleanup program
Third step
MANDT K
VBELN K
TAXINVNUM K
KUNNR
NAME
...
Regards,
Raymond
04-22-2011 2:05 PM
Dear
As per my understanding
Your production Z table already has data in the previous fields.
But now you have inserted the Key field at the begining ?
If you have inserted the key field then that field should also have data in it to get saved
or to be retrieved As the primary key rule it should not be null and should be unique.
So the error will come.
So first you take the backup of the table in production and proceed.
and make the table empty and add the field which you require as key
and again upload the new data with the added fields data.
Regards,
Prakash.
04-23-2011 12:09 PM
Hi,
U can proceed by rearranging the table fields with key fields in the begining
and go to data base utility -> database object -> database utility -> activate and adjust database
make sure the radio button " save data".
u can transport this to production that will not create problem since the key fields is been checked
with the combination of two fields
VBELN Primary key
TAXINVNUM Primary key
as per the initial table setting there cannot be any duplicates based on vbeln, and so there will not be any problem when TAXINVNUM field is added as key field.
If at all that TAXINVNUM field is blank in production it will remain blank in the key field, as it checks for the combination of
VBELN and TAXINVNUM .
Since its a Production transaction table , u need to transport the same when the system is not been used,
ie) the particular transaction updating the z table.
and to be on a safer side download the data's of the table before transporting
04-24-2011 8:47 AM
Hi ensure you key fields are place one after the another.
you can run se14 to adjust the table. and there might be a posibility that you may have to delete or do table conversion before doing these changes as now you may haqve possibility of duplicate keys as you already have data in this table.
thanks
04-29-2011 10:35 AM
Hi,
As Nayak said, i'm also thinking so.. please check in this way.. you might find the problem.
04-29-2011 1:54 PM
Hi,
First you take a backup of the data ZINVOICE before proceeding with the changes.
Then you need to rearrange the fields and assign the key field in development server with the following fields:
MANDT
VBELN Primary key
TAXINVNUM Primary key
KUNNR
NAME
FKART
FKDAT
NETWR
STAT
ZFKDAT
ZNETWR
Then activate and adjust the database using SE14 transaction. You can save the changes in one request and then tranport it to Quality and Production server.