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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
12 | |
12 | |
7 | |
5 | |
5 | |
4 | |
4 | |
3 | |
3 | |
3 |