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

Generating unique key

Former Member
0 Likes
775

Hi all,

How can we create a unique key of 8 characters long using BUKRS(4), BELNR(10) and GJAHR(4)?

Thanks in advance.

Poorna

5 REPLIES 5
Read only

Former Member
0 Likes
738

you can.. but your requirement is vague..explain clearly.

regards,

Sandeep Josyula

Read only

FredericGirod
Active Contributor
0 Likes
738

create a table with the 3 fields in key and add a number range.

BUKRS (X)

BELNR (X)

GJAHR (X)

Value

to add the value of Value go to transaction SNRO.

Fred

Read only

0 Likes
738

Hi Fred,

Thanks for replying.

Firstly let me explain my questions properly for all.

I want to create a unique key of 8 charecters long using BUKRS, BELNR and GJAHR in BKPF table.

I'll be using this unique while downloading BKPF data to two different files. I'll be using this 8 characters long unique key as reference in these two files which is sent to legacy system for further processing.

Hope i'm clear with my question.

Fred can you please explain more about SNRO transaction and how i can create number range using these three fields.

Thanks in advance

Poorna

Read only

0 Likes
738

The SNRO transaction will generate a unique value.

You will need to make a link between this value and the 3 fields. To create this link I propose to create a table.

You will need a user-exit / Badi to set the value into the tabel BKPF. In this user-exit, add the code to ask a new value of the range number using function : NUMBER_GET_NEXT.

Create the entry in the Zxxxx table. And replace the value into the BKPF table.

SNRO:

set an object name ZKEY_BKPF for ex.

Press create button (blank page)

Add description

set the data element of the field of BKPF

set the size

After this with function NUMBER_GET_NEXT, SAP will propose you the next free number.

Fred

Read only

Former Member
0 Likes
738

Can you please brief as why do you need the unique key and how long would you keep the data for because the solution would more or less depend on that.