Skip to Content
0
Former Member
Mar 09, 2009 at 08:37 PM

Update Rules - Creating Unique Record Identifier

81 Views

Hello,

I am using 2LIS_03_UM and 2LIS_03_BF to load to a custom datastore.

The material movements data is coming across with no problem but the revaluation data is giving me a bit of a problem.

For example - I have 2 records in the PSA that are identical. When I load to the datastore, one will be overlaid. I have tweaked the datastore key until I can bring nothing else in that makes it unique thus the need for a unique number for each record.

The end users need all the revaluation data.

I have found that I can create a start routine in the update rule to create a unique identifier but I have another question. Is there any way that I can use the data packet and data record number coming in from the PSA and have that part of my key in the ods?

Also, is there an easier way?

This is more complicated than what I have had to do before.

Here is the other code that I found from the forum posted by Yogesh Kulkarni (thanks!).

TABLES: /bic/aODSNAME00,

/bic/aODSNAME40.

DATA: w_no(30) TYPE n,

w_unq_key00(30) TYPE n,

w_unq_key(30) TYPE n,

w_unq_key = 0.

w_unq_key00 = 0.

SELECT COUNT( * ) INTO w_no FROM /bic/aODSNAME40 UP TO 5 ROWS.

IF w_no EQ 0.

SELECT MAX( /BIC/ZCIAUNIQT ) INTO w_unq_key00 FROM /bic/aODSNAME00.

IF w_unq_key00 = '0' .

w_unq_key = 1.

ELSE .

w_unq_key = w_unq_key00 .

ENDIF.

ELSE.

SELECT MAX( /BIC/ZCIAUNIQT ) INTO w_unq_key FROM /bic/aODSNAME40.

ENDIF.

LOOP AT DATA_PACKAGE.

w_unq_key = w_unq_key + 1.

DATA_PACKAGE-/BIC/ZCIAUNIQT = w_unq_key.

MODIFY DATA_PACKAGE.

ENDLOOP.

________________________________________

Any help is appreciated,

Lynda