cancel
Showing results for 
Search instead for 
Did you mean: 

How to assign Standard BO to association of sub node

former_member195790
Participant
0 Kudos

Hi experts

I've created BO and script action file below.

ScriptHolder.bo

import AP.Common.GDT as apCommonGDT;

import AP.FO.BusinessPartner.Global;

businessobject ScriptHolder {

  element holderID:ID;

  element firstname: LANGUAGEINDEPENDENT_ENCRYPTED_EXTENDED_Name; // criteria for searching

  action testAction;

  action deleteRows;

  node SearchResult [0,n]  {

       element resultId:ID;

      association ToCustomer to Customer;

  }

}

Action-testAction.absl

import ABSL;

import AP.FO.BusinessPartner.Global;

var v_result : elementsof this.SearchResult;

var CustomerQry  = Customer.QueryByIdentification;

var CustomerRes = CustomerQry.Execute( );

var cust : Customer;

var i = 0;

foreach(cust in CustomerRes){

  v_result.Clear();

  v_result.resultId = i;

  i = i+1;

  //v_result.ToCustomer = cust        ====>> I can not assign what I have gotten from query to  ToCustomer association

  this.SearchResult.Create( v_result );

}

Any suggestion ?

Best Regards,

Krit R.

Accepted Solutions (1)

Accepted Solutions (1)

former_member200567
Active Contributor
0 Kudos

Hi Krit ,

Try this.

import ABSL;

import AP.FO.BusinessPartner.Global;

var v_result : elementsof ScriptHolder.SearchResult;      // change to BO name

var CustomerQry  = Customer.QueryByIdentification;

var CustomerRes = CustomerQry.Execute( );

var cust : Customer;

var i = 0;

foreach(cust in CustomerRes){

  v_result.Clear();

  v_result.resultId = i;

  i = i+1;

var search_result= this.SearchResult.Create( v_result );

search_result.ToCustomer=cust;   // you can only assign the association after you have created the instance.


}

One advice.

Please post this kind of question in SAP Cloud Applications Studio space.

Best Regards

Fred

former_member195790
Participant
0 Kudos

Thank you very much Fred.

Could you please tell me how to jump into SAP Cloud Applications Studio space ?.

I have so many questions are waiting for the answers.

Might be because  I put them to the wrong space. So no one answer me.

former_member200567
Active Contributor
0 Kudos

Hi Krit,

There is Move button under Actions(right side). You can move the question to SAP Cloud Application Studios.

But I think it is only possible before someone has answered your questions.

Best Regards

Fred

Answers (0)