Skip to Content
avatar image
Former Member

Copy Custom BO data to new instance

Hi All,

I need to copy the data from one instance of a Custom BO to a new instance, is there any way to do this?

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

1 Answer

  • Apr 07, 2016 at 09:17 AM

    Hi Fernando,

    There is no standard copy function available for custom BO instances as far as I know.

    It would be helpful and straight forward if you are familiar with OBN Navigation. I think the best way to understand how OBN Navigation works is by referencing OBN Navigation,inport, outport and event handlers in the Controller tap of OWL, QA and OIF. I really recommend you to learn OBN Navigation if you are not familiar before starting this workaround.

    Here is what I would do to create a copy button on OWL.

    Let's say your BO definition is like this.

    [AlternativeKey] element ID : ID;

    element Desc: Text

    We will try to copy Desc.

    1. Add new element to custom BO

    [AlternativeKey] element ID : ID;

    element Desc : Text;

    element SourceID : ID;

    Hope you are familiar with OBN navigation.

    2. Target QA Configuration (existing QA can be used)

    a) Event handler configuration

    i) Create a new data field in data model witn name "InportSourceID"

    ii) Create an event handler

    ii) Add BOOperation Create to event handler

    iii) Add DataOperation and assign SourceID with InportSourceID

    b) In EventAfterModify, write this.

    if(!this.SourceID.IsInitial()){

    var instance= CustomBO.Retrieve(this.SourceID)

    if(instance.IsSet()){

    this.Desc = instance.Desc;

    }

    }

    c) Inport Configuration

    i) Create new inport basically same as Create inport (refer to the existing Create inport)

    ii) In Select Operation, enter CopyInport

    iii) Select same port type package as Create inport

    iv) add a parameter and bind the parameter with InportSourceID (created in a.i )

    v) Set the event handler created in a.ii in Fire Event Handler property of the inport

    3) Source OWL configuration

    a) Add OBN navigation with wizard

    b) Select the custom BO

    c) In Select Operation step, you will see the created inport of Target QA. (in our case it is "CopyInport")

    d) Add parameter in the outport and bind the parameter with SourceID

    c) Rename the event handler

    d) Add new button on OWL and set the event handler in OnClick property of the button

    Cheers,

    Fred

    Add comment
    10|10000 characters needed characters exceeded

    • Hello Fernando,

      Via ABSL:

      If the BO is flat (only Root node) it is easy:

      • Get the data structure either via a query or a retrieve
      • Hand this data structure over in a Create call

      If there are subnode you need to loop over them and creating a copy of each subnode attached to the copied Root node.

      Bye,

      Horst