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.
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
2. Add elements under Root
(* not under Data List)
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
(*Instance Binding must be Root)
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
ii) Test Update button
That’s all folks.
Thanks for reading.
Fred
Hi Fred,
Brilliently explained document and quite helpful,
But i have one doubt as you are using object based screens but in my solution we have created screens as thing based,
so do you think it will work there also,
as in thing based we usually use advance search using SADL query and we dont have dont option of advance menu in OWL .
Thanks,
Bhupi.
Hi bhupinder,
I am not familiar with Thing based screens for I am mainly working on ByD and have no access to C4C. Advanced search pane does not depend on Query type as far as I know.
Best Regards,
Fred
Bhupinder,
You already have Quick Create UI in thing based ui design.
Regards
Sunil
Excellent document Fred K .
Thanks for sharing ............... 🙂
Regards,
Mithun
Thanks, Mithun. 🙂
Thanks for sharing!!
Cheers,
Chandan
Thanks, Chandan.
Nice details .. It's an alternative of Quick Create, with your finding now user can add value in ByD just like they do using QC in C4C.
Keep sharing .. 🙂
Regards
Sunil
Thanks, Sunil.
Helpful document!
Thanks, Pradeep.
Hi Fred,
How this scenario is useful? or in how this scenario could be used?
Thanks, Pradeep.
Hi Pradeep,
As for me, there are times when we need a temporary search function.
e.g we need to retrieve data from multiple standard BOs and combine the retrieved data as we want and create and show the result rows as we want. We use a middle screen (a QA), and add Selection Criteria to the screen and create the result rows from the middle screen.
Best Regards,
Fred