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

document number in a table

Former Member
0 Likes
757

Hi Gurus,

I Am a Bw guy and i have created a table in R/3 ,my problem is i want to create unique record number to each record automaticlly ..like serial no to identify each record uniquely ..how can i do that? it should be generated automatically for a new record.?

Regards,

Rk

Hi Gurus,

I Am a Bw guy and i have created a table in R/3 ,my problem is i want to create unique record number to each record automaticlly ..like serial no to identify each record uniquely ..how can i do that? it should be generated automatically for a new record.?

Regards,

Rk

4 REPLIES 4
Read only

Former Member
0 Likes
740

make the document number field as primary key field in the database table ,,and then start inserting the data..

Read only

0 Likes
740

Hi

Assing the field with the primary key, which you want to make as unique and inorder to avoid duplicate numbers.

If you make it like this foe example doc number = 1000.

If an entry already made for 1000, and if you r trying to add another document with same number the system will not allow the duplicate entries.

Thanks and Regards

Arun joseph

Read only

0 Likes
740

Hi ,

Thanks for your reply,i know that primary key concept,,here i have created a own table in R/3 and i can enter the values for the fields in the table like empid,manid,timein,timeout date ,,,as these are the fields in my table if i want to find a record uniquly i should keep empid,timein and date as the primary key ..then only there can be multiple entry for an employee id,,,,so i want some doc no like kind of keys to be automatically generated for each record without manual entry for each record..how can i do that?

Read only

0 Likes
740

Hi Karthik, Try this way to get the next empid automatically.

DATA:l_pernr TYPE pernr-pernr.

  SELECT MAX( pernr )
    FROM pa0003
    into l_pernr.
    IF sy-subrc = 0.
     empid = l_pernr + 1. "Here u have to assign to screen field in the PBO if it is module pool program. 
     WRITE / l_pernr.
    ENDIF.
I hope that it helps u . Regards, Venkat.O