Application Development and Automation 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: 
Read only

adding field as unique to a table

Former Member
0 Likes
1,155

hi,

there are five fields in a table and i want to introduce a field index in the table which will be primary key and will uniquely identify a record and it will go on incrementing as and when the recoed is added to the table...

earlier fields of table are

ship_to all these three are primary keys

ship_to_name

email_id

now i am having problem with updating the database with primary key so will introduce a new field as index and go on adding it so it wil uniquely identify a single record

but my problme is how to incement the index when user enters a entry in the table maintiances screen and save it....

please suggest how to do it....

i want to use a unique field index and it goes on adding as user enters the data and this index to be inserted in the table

regards

Nishant

hi,

there are five fields in a table and i want to introduce a field index in the table which will be primary key and will uniquely identify a record and it will go on incrementing as and when the recoed is added to the table...

earlier fields of table are

ship_to all these three are primary keys

ship_to_name

email_id

now i am having problem with updating the database with primary key so will introduce a new field as index and go on adding it so it wil uniquely identify a single record

but my problme is how to incement the index when user enters a entry in the table maintiances screen and save it....

please suggest how to do it....

i want to use a unique field index and it goes on adding as user enters the data and this index to be inserted in the table

regards

Nishant

3 REPLIES 3
Read only

Former Member
0 Likes
923

You can create a number range object using SNRO and then call the FM NUMBER_GET_NEXT to get the next number.

Read only

Former Member
0 Likes
923

Hello,

For Data creation as per the requirements,pls go through the following........

<u><i>how to</i></u> :

we can write coding in the PBO of the screen for table maintainance to fetch the largest available number and increment it by 1 before updating in z-table.The field which contains the number can be given as a display only field in the screen of maintainance(using screen painter itself)

<u><i>disadvantage</i></u> :

a) whenever the maintainance is regenerated or changed&activated the code in

PBO is overwritten

b)works better with 2step maintainance

Pls check revert and reward if helpful

Regards

Byju

Read only

romanweise
Active Contributor
0 Likes
923

hello Arora,

in addition to creating/using a number range object to get your index value. you could also use a GUID if the key is not supposed to be displayed for a user or for sorting purposes. If you just need an unique value for technical reasons you can create GUIDs by using GUID_CREATE function module.

Rgds.

Roman