2013 Apr 08 8:21 AM
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
2013 Apr 08 9:32 AM
2013 Apr 08 9:35 AM
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
2013 Apr 08 9:46 AM
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
2013 Apr 08 10:36 AM
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
2013 Apr 08 7:28 PM
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
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |