Application Development 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: 

sequence number adjustment in the column

Former Member
0 Kudos
403

In my table maintenance generator,

I have one field called sequence number which increments by '1', each time user enters a new record in my table maintenance generator(have coded in such a way).

now the internal table, under sequence column if some records get deleted,

then the numbering of that column should be adjusted automatically.

Like

1st record - 1 A B D

2nd record - 2 A B C

3rd record - 3 A B D

4th record - 4 A B C

5th record - 5 E D F

If some user deletes 3rd record , then instead of showing the TMG as below

1st record - 1 A B D

2nd record - 2 A B C

3th record - 4 A B C

4th record - 5 E D F

the TMG should should show as

(I need that to be sequence column adjusted as )

1st record - 1 A B D

2nd record - 2 A B C

3th record - 3 A B C

4th record - 4 E D F

My thought is to write on new module in PAI,

and buils the logic in case of syst-ucomm = 'DELE'.

Please suggest me any function module availble or any good logic for this

.

Thanks in ADV.

1 ACCEPTED SOLUTION

Former Member
0 Kudos
232

If multiple records

say

1st

3rd

7th

11th

50th records gets deleted, the logic won't work . thanks.

8 REPLIES 8

Former Member
0 Kudos
232

Loop at the IT where sequence > deleted_sequence, substract 1 from sequence and modify the it.

Former Member
0 Kudos
233

If multiple records

say

1st

3rd

7th

11th

50th records gets deleted, the logic won't work . thanks.

0 Kudos
232

is the number part of the key?

0 Kudos
232

Sort the deleted records in inverse order, with the higher sequences first, loop through them and do the main loop with the where for each.

Former Member
0 Kudos
232

yes part of the key.

Former Member
0 Kudos
232

This really isn't the way the TMG was meant to be used. Normally, one just uses it to manually add change or remove individual records, not a number of records based on some logic. It would probably be simpler to build a simple dynpro to take care of this.

Rob

Former Member
0 Kudos
232

In TMG, say the user creates 10 records in wrong way ...or to test some thing .

then if they don't want some records or all the 10 records ..then they can select those records and delete them in bunch. Am I right ?

0 Kudos
232

Yes, but the user has to manually select the records to be deleted. This logic will work on any record.

Rob