Skip to Content

How to connect BO Action with Search Pane

Hi everyone,

Sometimes, we want to create data on the fly by using the advanced search pane. 

e.g Retrieve data from multiple business objects using Search Values from advanced search pane and and create data on the fly.

But search pane can only be used for the existing data. Basically, I create a QA screen as a temp screen for this kind of requirement. Luckily, I found a workaround to connect Search pane and BO Actions on OWL.


Please feel free to point me out if there is any mistake in this document.

Idea:

1. Create Dummy Instance

2. Get search value and transfer to Dummy Instance

3. Perform BO Action

4. Delete the instance back

For simplicity, this document only contains simple Create and Update actions on a custom BO.

Simple BO Actions.png

BO definition:

businessobject N_Product {

  element ProductID :ProductID;

  element Description : LANGUAGEINDEPENDENT_MEDIUM_Text;

  action update;

  action create;

}

Steps:

1. Create Search parameters

     i) Add two new data field under Root/SearchParameters and bind with query elements

2. Add elements under Root

3. Create event handlers

i) Create two event handlers

ii) For Update Button – Create a DUMMY instance

iii) For Update – Get Search value from Search pane and assign to Root elements which are added on step 2.

a) Product Assignment

b) Description Assignment

iv) For Update Button – Add BOAction

v) For Create Button – Repeat i) to iv)

vi) Add two buttons on OWL and assign the created event handlers to the button click events

4. Implement BO Actions

5. Testing

     i) Testing Create button

     ii) Testing Update button

Let’s start.

1. Create Search parameters

i) Add two new data field under Root/SearchParameters and bind with query elements

Search Parameters.png

2. Add elements under Root

(* not under Data List)

Root elements.png

3. Create event handlers

i) Create two event handlers

new event handlers.png

ii) For Update Button – Create a DUMMY instance

Update Dummy Instance.png

iii) For Update – Get Search value from Search pane and assign to Root elements which are added on step 2.

a) Product Assignment

Search value assignment to ProductID.png

b) Description Assignment

Search value assignment to Description.png

iv) For Update Button – Add BOAction

(*Instance Binding must be Root)

Update BO Action.png

v) For Create Button – Repeat i) to iv)

vi) Add two buttons on OWL and assign the created event handlers to the button click events

4. Implement BO Actions

i) Create

import ABSL;

var temp : elementsof N_Product;

temp.ProductID = this.ProductID;

temp.Description =this.Description;

var createdInstance = N_Product.Create(temp);

this.Delete();      // delete the Dummy Instance


ii) Update

import ABSL;

var query =N_Product.QueryByElements;

var selParams = query.CreateSelectionParams();

selParams.Add(query.ProductID.content,”I”,”EQ”,this.ProductID.content);

var results = query.Execute(selParams);

foreach(var result in results){

  result.Description = this.Description;

}

this.Delete();      // delete the Dummy Instance


5. Testing

i) Test Create button

Testing - Create.png

ii) Test Update button

Testing- Update.png

That’s all folks.


Thanks for reading.

Fred

13 Comments
You must be Logged on to comment or reply to a post.