Next Number in Headerless Detail form

SarahMQ

Member
Hi Dears,

i create a headerless details form to insert multiple rows in the grid , my form based on a single table in business view , the primary key has a next number incremented in each insert of the grid , the values get inserted and have the next number in the "row is exited " event also the validation processed in this event,

my problem is when the user hit cancel button and get out of the form , the value of the next number is reserved , i mean that the next add of the grid ,the next number of the primary key is the last cancelled value +1 , i need to make the next number skip the cancelled value .

please am newbie in JDE development and need your help in this issue ,

Thanks and Best Regards,
Sarah
 
Generate the next no.'s when you hit the Ok Button.
OR
Store the next no. and when user hits cancel button update the NN table F0002.
 
is this a jde table or custom table?

if custom, on row is exited, use bsfn x00022.GetNextUniqueKeyID to populate next number
 
Sarah,
Bad plan to try to reset the Next Number backwards. What if other users/processes consume next numbers?
 
Generate the next no.'s when you hit the Ok Button.
OR
Store the next no. and when user hits cancel button update the NN table F0002.

OK button will not work well for this scenario because it's a Headerless Detail.
As Larry pointed out in his post... NEVER update F0002 backwards in ER code!
 
Thanks all for your response ,
i tried to "Grab the next number in the "Add Grid Rec to DB - Before" event" as you said JMR , but a duplicate primary key Error Pop Ups and when i returned to the table i found a PK with 0 value !!
 
What field are you updating with the NN? GC or BC?

In this event, you need to make BC Next number column = to the F0002 NN number
Not the GC Next Number column :)
 
Unless your company audits the next number for that document is there any reason you dont want it to skip?. Updating NN table can lead to many duplicate failure.

Chan
 
Hi Johndanter,

it returns the same error "duplicate primary key " with 0 value

thanks a lot
:)
 
I have solve it :)

i have solved my problem by avoiding use next number property,
I overrides the next number of the DD Field (Primary key)
and assign the value of it using a counter in the Row Exited event

i don't know if its a best practice but its solve my problem :)
thanks all for your support
 
Back
Top