cancel
Showing results for 
Search instead for 
Did you mean: 

Creating Custom BO Instance in ABSL from Standard BO Event

former_member535186
Participant
0 Kudos

HI all,

am developing custom Business object which contains entries or records from Opportunity BO extended TAB.

i have created before-save event, and query on custom Bo to check the consistence.

var query_customer = CustomLG.QueryByElements;

var selparam = query_customer.CreateSelectionParams(); selparam.Add(query_customer.OpportunityID , "I", "EQ", this.ID.content);

var result = query_customer.Execute(selparam);

if (result.Count() == 0) {

var customerRoot : elementsof CustomLG;

customerRoot.OpportunityID = this.ID.content ;

customerRoot.LgStatus = "Requested" ;

customerRoot.LgAmountData.content = this.LgAmount.content ; customerRoot.LgAmountData.currencyCode = this.LgAmount.currencyCode ;

could you please suggest a solution to create statement which adds instance entry using this data??

best Regards,

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

I'm not sure if I got your problem right but if your problem is to create an instance of CustomLG with the given data see the following line.

var newCreatedInstance = CustomLG.Create(customerRoot);

Best regards

Tobias

former_member535186
Participant
0 Kudos

Hi Tobias,

thank you very much for reply,

- Yes you have got what i needed but, by adding this statement to my code, it returns an error says,

(customerRoot) Parameter type 'OpportunityNodeElements' is not Valid.


capture.png

Best Regards,

HorstSchaude
Product and Topic Expert
Product and Topic Expert

Hello Motaz,

This command will work only if the "elementsof" belong to the BO for which the Create is called.

In your case is the elementsof Opportunity not the same as the BO CustomLG.

Bye,
. Horst

Former Member

Based on your screenshot the line should be

var newCreatedInstance = Opportunity.Create(Root);
former_member535186
Participant
0 Kudos

Thank you all,

Is that another solution to be able to fill records on custom OWL screen of CustumLG with data inserted on extended new tab in Opportunity BO.

former_member535186
Participant
0 Kudos

Hi Horst,

Is that solution works for update OWL screen with data inserted on Standard BO.

https://blogs.sap.com/2015/04/23/how-custom-queries-work-on-owl/

HorstSchaude
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hello Motaz,

based on the heading you want to create an instance of your custom BO CustomLG where the data is populated from the SAP BO Opportunity?

Then this should do the work:

var CustomLGRootData : elementsof CustomLG;
CustomLGRootData.??? = this.???;
...
var CustomLGRootNode = CustomLG.Create( CustomLGRootData );

Please replace the "???" with the resp. elements of your CustomBO and the SAP BO.

HTH,
. Horst