No of key fields in a database table
hello experts,
can anyone tell me what is the maximum number of keys we can have in a database table.
thanks in advance
Hi,
There are two restrictions on the key fields while creating a table.
1) The maximum number of keys in a table can be 16
2) The maximum length of the key fields can be 120.
Regards,
Ferry Lianto
Similar Messages
-
Creation of key field in a database table
Hi All,
As per my requirement, i have to add few new key fields in an existing table.
Now total number of key fields are 17, but while saving this is giving me an syntax error stating 'According to SAA standard key fields cannot be more that 16'.
I s there any other go? i can not reduce the number of key fields.
Regards,
Pankaj.
Edited by: Pankaj Bist on Sep 5, 2008 3:24 PMHi,
In the se11 transaction,In the menu bar o like this.
Utilites-->Database Utility and the Press the button Activate and Adjust Database.
Note:
Make sure that you total data in the table to be downloaded into ur system.
As ctivate and Adjust Database makes data to be deleted.
Regards,
Rama. -
Default Primary Key Field of any database table
hi,
I am working on a database in which the data in the tables is generated from some other modules. I have to add, view and update functionalities to this table in the database. Unfortunately there is no primary key field for the table i am working on and as some existing modules are using this table i am not allowed to change the design of the table at this stage.
Without primary i think its not possible to do updates. Because if all fields can have their values changed, then there will be a breakdown if the field value changes in the mid time when i had already retrieved the data to show on the screen, but not yet updated the value in the database. I hope you understood my problem.
Please suggest solutions. I am not sure, but i think i read somewhere that every table created has a default primary associated whose value is always incresing with a new addtion of recored and its value never decreases. But i am unable to recollect the field name...i think it is some thing like[b] OID .... But i checked there is no such field name by OID. So please help me with some alternative solution...or by telling the default primary key field name.
ThanxAll the databases I know (namely Informix, PostgreSQL, SQL Server, even Access) have a row id column generated automatically.
PostgreSQL example
There is a way to read the value of this column; for example with PostgreSQL let�s say you have the following:
CREATE TABLE no_id_column (
column_one varchar(80),
column_two varchar(80)
INSERT INTO no_id_column(column_one, column_two) VALUES (�red�, �pink�);
INSERT INTO no_id_column(column_one, column_two) VALUES (�yellow�, �orange�);Certainly, if we executed:
SELECT * FROM no_id_column;Would obtain:
column_one column_two
red pink
yellow orangeBut if we modify the query
SELECT oid, * FROM no_id_column;We magically obtain a row identificator
oid column_one column_two
21569 red pink
21570 yellow orangeThe data in the oid column is generated automatically by the database manager. Every time we insert a row we�ll have a different one. Just take into account that if the database contains a large amount of data, the oid could cycle. -
Bank Key field change from database table
Dear All,
At our client, 4 house banks are maintained. The bank keys entered for these are not BSR Codes but something like 100,200,300,400.
This is not correct as we need to maintain BSR Code in Bank Key field as it is required on Form 16 A (TDS Cetificate)
The Bank Key field is in display mode. I am thinking of changing wrong value from database table T012 & BNKA .
Has anybody done this before? Will it affect my past or future transactions?
Thanks & regards,
GovDear Gulshan,
What you are saying is correct & I subscribe to your view also.
Creation of House Bank all over again seems to be one of the better options.
We tried doing one more thing & which is working fine on Development.
Our primary requiremnt is to have BSR Code on the From 16 A. System picks up the Bank key for this.
We copied the standard Form 16A & created a Z. Then abaper created a subroutine. It is like when Bank key 100 comes to Form16A, replace it with say 0098500 (Correct BSR Code of the Bank)
This helped to get the correct BSR Code in Form 16A & saved us from recreation of House Bank data.
Your comments are welcome.
Regards,
Gov -
Regarding key field in a database table
Hi friends, this is very urgent, plz help me.
Here I have one field ex: MATNR , and I have to find out whether this field is key field or not in the MARA table. here the thing is I have to findout this programitically not going by SE11.
Plz suggest me
Regards
Venkat.Hi prabhu,
i think this is useful, but could you elaborate this little bit.
regards
Venkat -
Changing Non key field to Key field in a custom table
Hello Abap gurus:
I have a requirement in which i need to change a non key field in my custom table(Z TABLE) to key field.
For example; i have field sequence as
field 1 key field
field 2 key field
field 3 key field
field 4 non-key field
field 5 non-key field
field 6 non-key field
field 7 non-key field.
i want to change field 7 as key field.
Can i do perform operation??
when i am tryingto perform bove operation it is taking long time to get the table activated.
Could any one please help me in getting this resolved.
regards,
Sravanthi.Use DB Utility (se14) to perform alter table or conversion. The latter is used when atemps to perform first operation fails. Which one is used, really depends on system and current DB table state (i.e. if has any content and what is being adjusted).
The way Max suggested is similar to [conversion process|http://help.sap.com/saphelp_nw04/helpdata/EN/cf/21f1b8446011d189700000e8322d00/content.htm] which system takes care of itself.
Refer [Adjusting Database Structures|http://help.sap.com/saphelp_nw04/helpdata/EN/cf/21f1ab446011d189700000e8322d00/content.htm] and already given link to conversion.
Please also consider potential errors while doing conversion . This can lead to data loss, so you should think of some backup to prevent that.
Regards
Marcin -
To modify a field in a database table based record identification by primar
hi
i want to to modify a field in a database table based record identification by primary key filed and two more fields
ie customer (primary key
i want to modify record from intenal table the record existing with primary key field customer
the status field needs to be mofied as " value rolled"
the below code is happening
loop at it_record into wa_Record
wa_inv-customer (primary key) = wa_Record=custome
wa_inv-date = wa_Record-date
...so one
append wa_inv to it_invest
clear wa_inv
endloop.
if not it_invest is initial
modify TABle1 ( this table is data base table which needs to be mofified) based on the primary key field
and also date field and status field which is not primary key.
regards
aroraHi there.
Your requirement is to update a Z Database table from your internal table, right? You have several options:
LOOP AT it_invest INTO wa_inv.
UPDATE dbtable
SET date = wa_inv-date
WHERE prim_key = wa_inv-prim_key
AND any_field = wa_inv-any_field.
ENDLOOP.
or
LOOP AT it_invest INTO wa_inv.
UPDATE dbtable FROM wa_inv. "if wa_inv of same type of dbtable
ENDLOOP.
In the first example, I wrote any field because you can update dbase table, filtering for fields that don't belong to the primary key. However, remember that you will change all records that respect the key you used (so, in your case, use the primary key).
Regards.
Valter Oliveira. -
How to modify or put entry in a particular field of a database table
i want to to modify a field in a database table record identification by primary key fileds
the situatio is like this
there are two primay key in database table
customer number PK
status PK
date
and third field which i want to modify is customer part number.
based on condition that
database table1-cuspip = wa_record-cuspip.
database table1-status <> wa_record-status
and database table-date = wa_record-date
if above is true a particular field the database table for that record
ie customer_part_number = 'FAiled'.
loop at it_record into wa_Record
endloop.
please suggest how to modify the database table record if the avove condition is tru and please give me full working code
regards
AroraDear Nishant,
Use UPDATE function for updating the customer part number.
But please do mention the database table and the keys used for update.
if en entry already exists with the key then the Entry will fail so use MODIFY statement to modify the Consumber Part Number with the specificed keys and transport the modified customer part number and then do COMMIT the changed entry to database.
Hope this helps you in some way.
Encourage others to answer you queries by suitably rewarding them.
Thanks
Venugopal -
How to set key fields in a Database view
Hi guru's
iam balaji,plz guide me with how to set key fields in a view.......that field is a non key field in the base table....
thanks in advance,
Balaji.Stake a look at this:
Diagnosis
In the view, not all of the mandatory fields were included as key
fields. The key of the view therefore is not unique.
System Response
All the fields are regarded as key fields in order to guarantee that th
key lengths are unique.
Procedure
For views with a large number of fields, this could have a negative
effect on the performance for the language construction described below
In this case, all the mandatory key fields should be included in the
view.
regards -
Extracting Values of a Field from a Database Table in SAP ECC System
Hi,
I downloaded Extracting Values of a Field from a Database Table in SAP ECC System Using MII 12.0
senario from sdn. I'm trying to do that senario in MII 12.05. But I have problem with section 6 in page 7 (you can supply senario from sdn)
"6- Under the loop of Repeater, use action u2018Rowu2019 to append just the string part of the WA which will display only values for field u2018Batchu2019"
I did not find WA elemen in Output element of Repeater_0
How can I create WA element?
Thanks.Cemil,
Set up a SAP JCo Interface action block. Use the RFC name RFC_READ_TABLE.
In the link editor map the table to "MARA", set RowCount to something small (20 is good sample size) and create an xml transaction property named FIELDS and copy the following into it:
<?xml version="1.0" encoding="UTF-8"?><FIELDS>
<item>
<FIELDNAME>MATNR</FIELDNAME>
<OFFSET/>
<LENGTH/>
<TYPE/>
<FIELDTEXT/>
</item>
<item>
<FIELDNAME>MTART</FIELDNAME>
<OFFSET/>
<LENGTH/>
<TYPE/>
<FIELDTEXT/>
</item>
<item>
<FIELDNAME>BSTME</FIELDNAME>
<OFFSET/>
<LENGTH/>
<TYPE/>
<FIELDTEXT/>
</item>
<item>
<FIELDNAME>XCHPF</FIELDNAME>
<OFFSET/>
<LENGTH/>
<TYPE/>
<FIELDTEXT/>
</item>
<item>
<FIELDNAME>DATAB</FIELDNAME>
<OFFSET/>
<LENGTH/>
<TYPE/>
<FIELDTEXT/>
</item>
</FIELDS>
Then link the Transaction.FIELDS to SAP_JCo_Interface_0.Request{/RFC_READ_TABLE/TABLES/FIELDS}. You may run into problems with two other fields and optionally they can be removed (set link type to remove xml). I usually remove them initially for testing. The two fields are:
SAP_JCo_Interface_0.Request{/RFC_READ_TABLE/INPUT/NO_DATA}
SAP_JCo_Interface_0.Request{/RFC_READ_TABLE/INPUT/DELIMITER} (or you can set this to something like a semicolon,";" or tilda,"~". I find it easier to caclulate position by length, but that is my own idiosyncrasy.)
Once you get this one working, we can explore how to do filtering on the dataset. Your output should be something like this:
<?xml version="1.0" encoding="utf-8"?>
<RFC_READ_TABLE>
<INPUT>
<DELIMITER />
<NO_DATA />
<QUERY_TABLE>MARA</QUERY_TABLE>
<ROWCOUNT>20</ROWCOUNT>
<ROWSKIPS>0</ROWSKIPS>
</INPUT>
<TABLES>
<DATA>
<item>
<WA>000000000000000023ROH 00000000</WA>
</item>
<item>
<WA>000000000000000038HALB 00000000</WA>
</item>
<item>
<WA>000000000000000043HAWA 00000000</WA>
</item>
<item>
<WA>000000000000000058HIBE 00000000</WA>
</item>
<item>
<WA>000000000000000059HIBE 00000000</WA>
</item>
<item>
<WA>000000000000000068FHMI 00000000</WA>
</item>
<item>
<WA>000000000000000078DIEN 00000000</WA>
</item>
<item>
<WA>000000000000000088FERT 00000000</WA>
</item>
<item>
<WA>000000000000000089FERT 00000000</WA>
</item>
<item>
<WA>000000000000000098HALB 00000000</WA>
</item>
<item>
<WA>000000000000000170NLAG 00000000</WA>
</item>
<item>
<WA>000000000000000178NLAG 00000000</WA>
</item>
<item>
<WA>000000000000000188NLAG 00000000</WA>
</item>
<item>
<WA>000000000000000288HALB 00000000</WA>
</item>
<item>
<WA>000000000000000358HAWA 00000000</WA>
</item>
<item>
<WA>000000000000000359HAWA 00000000</WA>
</item>
<item>
<WA>000000000000000521HAWA 00000000</WA>
</item>
<item>
<WA>000000000000000578FERT 00000000</WA>
</item>
<item>
<WA>000000000000000597HAWA 00000000</WA>
</item>
<item>
<WA>000000000000000598VERP 00000000</WA>
</item>
</DATA>
<FIELDS>
<item>
<FIELDNAME>MATNR</FIELDNAME>
<OFFSET>000000</OFFSET>
<LENGTH>000018</LENGTH>
<TYPE>C</TYPE>
<FIELDTEXT>Material Number</FIELDTEXT>
</item>
<item>
<FIELDNAME>MTART</FIELDNAME>
<OFFSET>000018</OFFSET>
<LENGTH>000004</LENGTH>
<TYPE>C</TYPE>
<FIELDTEXT>Material Type</FIELDTEXT>
</item>
<item>
<FIELDNAME>BSTME</FIELDNAME>
<OFFSET>000022</OFFSET>
<LENGTH>000003</LENGTH>
<TYPE>C</TYPE>
<FIELDTEXT>Purchase Order Unit of Measure</FIELDTEXT>
</item>
<item>
<FIELDNAME>XCHPF</FIELDNAME>
<OFFSET>000025</OFFSET>
<LENGTH>000001</LENGTH>
<TYPE>C</TYPE>
<FIELDTEXT>Batch management requirement indicator</FIELDTEXT>
</item>
<item>
<FIELDNAME>DATAB</FIELDNAME>
<OFFSET>000026</OFFSET>
<LENGTH>000008</LENGTH>
<TYPE>D</TYPE>
<FIELDTEXT>Valid-From Date</FIELDTEXT>
</item>
</FIELDS>
<OPTIONS />
</TABLES>
</RFC_READ_TABLE>
Add a repeater sourced on:
SAP_JCo_Interface_0.Response{/RFC_READ_TABLE/TABLES/DATA/item}
Link your repeater output to a tracer with this:
Repeater_0.Output{/item/WA}
What you will see in each tracer message is a single line of data with all the fields contents concatenated together. You can look up what each field in the string represents by the length of the field as returned in the Response segment of the RFC_READ_TABLE rfc. Then you can parse out the data you are interested in.
Give this a try and let me know how you succeeded.
By the way, I could not find the scenario you referred to. Can you post a link?
Regards,
Mike
Edited by: Michael Appleby on Jan 12, 2009 5:16 PM -
To replace values of one of the field in the database table
How to replace values of one of the field in the database table with a new values? Pls help to solve
Hi
You can use the UPDATE command to update one of the field value in a table
see the UPDATE syntax and use it
but in real time you should not do like this
Regards
Anji -
Adding 2 new fields as Primary Key field in a Z Table which is existing PRD
Hi Friends,
I have to add two new fields as primary key fields in a Z TABLE, which is existing in Quality and Production Systems with Data.
If I incorporate these two new fields (Primary Key fields) in development and if the TR is moved to Quality and Production sytems, is there any possibility of loss in data will happen at Quality and Prd systems?
At present, Table is having 20 fields with 2 primary key fields and i have to add 2 more primary key fields.
I have checked in SCN and not find relevant threads.
Please help me out.
Regards,
Suresh.NO . It wont be a problem .
For ex :
If you have VBELN , POSNR are key fields now , you have an unique reord with that combination .
If you add one other field in it fo ex VKBUR then records will be like this
VBELN POSNR VKBUR MATERIAL QTY
10020 10 abcxyz 1
10020 10 1234 abcxyz 1
So your previous records before adding new primary keys , will have new fields balnk , and the new records will have data filled up in all primary key fields .
However , if you try to update the existing records that will be in existing PRIMARYKEY combination only .
for example if you try update record 1 above with VKBUR value 85858 , it creates a new record , it wont be updated in existing record.
Hope this helps , Pls let me know if u have any more doubts. -
How to delete data from single field in a database table?
Hi guys,
Plz suggest me How to delete data from single field in a database table?
thnks,
pavanhi
in addition to abv details..chk this:
http://help.sap.com/saphelp_nw2004s/helpdata/en/fc/eb3aef358411d1829f0000e829fbfe/content.htm
http://dev.mysql.com/doc/maxdb/en/34/ee7fbd293911d3a97d00a0c9449261/content.htm
regards,
madhu -
Significant of key field in Info cube table
Hi,
what is significant of key field in Info cube table?
Best regards,
dushyant.hi ,
key figures are very important in tables, when it is in cube it act as dimensions
for the reporting purpose see this scenario
the table has following fields
student no
student name
student attendance
student mark
in this scenario when we want report according to student no its normal we would get, but when we want according to attendance,marks we dont get report according to attendance and mark, so we put all those fields in key fields.
So we could say that Key fields are the dimensions and according to this we get reports
thank yu -
How to Find the Data Type of the Field In a Database Table
Hi Experts,
I'm currently working on a program which needs to find out the data type of the given field in a database table. In addition to accessing DD03L directly, is there any other workaround such as function module to help me achieve this? It would be helpful if a demo example could be provided.
Thanks a lot.Hi,
Use this..
DESCRIBE FIELD dobj TYPE typ.
write typ.
type will contain the data type of the object.
and check this thread also....
Re: How to get datatype of fields in dynamic structures
Cheers,
Simha.
Reward all the helpful answers..
Maybe you are looking for
-
Ok this may be a simple fix but I cant figure it out. I am trying to give my wife more room on her phone to take photos of our new baby, so I synced her phone to iTunes it shows the bar of whats taking up space on it, and 3/4ths of the phone space i
-
Do i need a flatscreen LED tv to use ATV?
Or can i use it on my 1990s CRT TV?
-
After romoving Ubuntu from dual boot
I recently removed ubuntu from dual booting. Before, it asked me which OS I would like to run when my PC started up. It showed two options, Windows and Ubuntu. After I removed Ubuntu it still stops at that screen but only Windows is there. How can I
-
My company currently has a WRT54GX4 for the laptops as a replacement for a now completely failed WRT54g v1.0. I've read some issues about internet connectivity dropped but this is different. My WRT will stay connected but drop to 5.5mbps with excelle
-
How does the 1st gen appletv with the hard drive work?
I want to know what the hard drive records and stores. Poscasts? Purchased media? Rented media? Your itunes media? Ripped DVD's? What does the hard drive hold media wise? Does the 1st gen have the same features as the 2nd, netflix, poscasts, PC media