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

Problem in Table Maintainence generator event

Former Member
0 Likes
1,061

Dear Gurus,

We have a table wherein there is a key field which will be generated internally by incrementing the previous highest value in table(ie, say 10 is my last number in table, the number will be automatically incremented to 11).

The problem here is, whenever we enter a single record as a new entry, system generates next number (ie, say 10 is my last number in table, the number will be automatically incremented to 11).

But incase we copy paste multiple entries, system throws error saying duplicate records cannot be proccessed.(ie, these multiple records entered has not been saved into the database, hence the system increments the same number (ie, 10 to 11 say) again and again.

Is there any EVENT in table maintainence generator for this scenario? Is there a EVENT for ENTER in TMG?

How can we get rid of this problem once for all.

Waiting for your replies.

With Regards,

Jagan

Dear Gurus,

We have a table wherein there is a key field which will be generated internally by incrementing the previous highest value in table(ie, say 10 is my last number in table, the number will be automatically incremented to 11).

The problem here is, whenever we enter a single record as a new entry, system generates next number (ie, say 10 is my last number in table, the number will be automatically incremented to 11).

But incase we copy paste multiple entries, system throws error saying duplicate records cannot be proccessed.(ie, these multiple records entered has not been saved into the database, hence the system increments the same number (ie, 10 to 11 say) again and again.

Is there any EVENT in table maintainence generator for this scenario? Is there a EVENT for ENTER in TMG?

How can we get rid of this problem once for all.

Waiting for your replies.

With Regards,

Jagan

5 REPLIES 5
Read only

Former Member
0 Likes
1,016

This message was moderated.

Read only

Abhijit74
Active Contributor
0 Likes
1,016

Hello,

There are events called "Before saving the data in the database" and "Creating a new entry" . I think by coding in these events we will get your desire results.

Create a "Z" number range via SNRO, then define the range, like 1 to 999999. In the creating a new entry event write below code.

FORM f_automatic_increment

.

DATA: lv_num TYPE CMS_DTE_SEQNO.

    CALL FUNCTION 'NUMBER_GET_NEXT'

         EXPORTING

              nr_range_nr             = '01'

              object                  ='ZCBT_NUM' --> it's the object

         IMPORTING

              number                  = lv_num

         EXCEPTIONS

              interval_not_found      = 1

              number_range_not_intern = 2

              object_not_found        = 3

              quantity_is_0           = 4

              quantity_is_not_1       = 5

              interval_overflow       = 6

              buffer_overflow         = 7

              OTHERS                  = 8.

ZTQM_VBATCH_COPY-REC_INCREMENT = lv_num.

ENDFORM.

Also, please see this thread http://scn.sap.com/message/7474131.

Thanks,

Abhijit

Read only

Former Member
0 Likes
1,016

Ji Jagan,

In TMG you create form routine 01 and 05.

In 05 you just create the next number from either your number range or incrementing last number by one.

In form routine 01 you check, the new nomber from database, else give error message.

Thanks

Srimanta

Read only

former_member213851
Active Contributor
0 Likes
1,016

Hi Jagannathan,

After going to Table maintenance screen, follow path  Environment ->Modification -> Event .

Then select the event '05 - Craeting New Entry '.

Now write code to increment the Number.

Regards,

Sachin

Read only

Former Member
0 Likes
1,016

Hello Jagannathan,

Are you using the SAP number interval range transaction for defining your number range object?

If so, are you utilizing the buffering option in the 'Customizing tab'?

If not, I highly suggest that you create the interval range using the t-code SNRO.  This t-code is well documented.   While in the t-code select 'Help-->Application Help', to pull up the documentation.

Once you have configured your number range object, call the function module, NUMBER_GET_NEXT, to determine the next number in the sequence.

This approach provides the ability to handle multiple servers and multiple requests in the buffer.

Regards,

Kim