01 August, 2011

Get sequence next value in ADF


I will present how to use ADF BC to get next value of sequence.

1- Creating Method 

We can create generic method that I will pass to it sequence name and it will return next value.


As we noticed in previous code that I use SequenceImpl to get sequence value.



2- Use that method at Entity Object Attribute to set default value of attribute

 first set value type of attribute to Expression .
 set Value as adf.object.getSequenceValue("My_seq_name").

3- Use getSequenceValue at Entity Object Impl

we can set default value to attribute of  Entity Object in EntityObjectImpl class itself by overriding Create method and set attribute value to sequence value.


Thanks
Mahmoud A. El-Sayed

5 comments:

  1. Thanks for explaining the complete method to get sequence next value in ADF. This post has helped me a lot as I have been messing with it from past two three days. I will try to do now according to the mentioned steps.
    sap upgrades

    ReplyDelete
  2. Thanks
    for help

    ReplyDelete
  3. but this solution is not optimal, it gets the id from a sequence before the commit , the best is execute the secuence when the insertion is ready, and after recover the id registry from the database that was assigned to the new row to refresh the record in the entity


    regards from Ecuador

    ReplyDelete

How to Pass Parameters to ActionListener in ADF

In some cases, it is required to pass a value to ActionListener of ADF Button. The method that can be invoked by actionListeners has only...