Skip to Content

Query two standard BO's

Apr 03 at 07:44 AM


avatar image
Former Member

Hi All,

I have to send 2 standard business objects (Questionnaire & Service Request) query results to non SAP system.

We are using ODATA to send data and ODATA will return object instance as output.

I have created Custom business object with these 2 BOS fields(7 fields). Written code to query on these 2 standard business objects.

Passed result into custom object. To achieve this, written below query. Now i need help on 2 issues:

1. is this correct way to approach this requirement?

2. how to query "questionnaire" based on each "ticket".

var query = Questionnaire.QueryByElements;

var RefThis:elementsof ZSurveyQA;

var resultData;

var Srquery = ServiceRequest.QueryByElements;

var SrresultData; // 2. Selection

var SrselectionParams = Srquery.CreateSelectionParams(); SrselectionParams.Add(Srquery.ID.content, "E", "EQ", "46433");

// Result SrresultData = Srquery.ExecuteDataOnly(SrselectionParams);

var selectionParams = query.CreateSelectionParams(); selectionParams.Add(query.QuestionnaireCategoryCode, "I", "EQ", "21");

resultData = query.ExecuteDataOnly(selectionParams);

foreach (var result in resultData) {

//RefThis.Ticket =

RefThis.SurveyCat = result.CategoryCode;

RefThis.SurveyName.content = queryResultQuestionnaireValColl.ToRoot.Name.GetFirst().Name.content; RefThis.Surveystat = result.LifeCycleStatusCode;

RefThis.Validfrom = result.ValidFromDate;

RefThis.ValidTo = result.ValidToDate;

RefThis.Version = result.VersionID.Version;


RefThis.Clear(); }



10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Best Answer
Sunil Kumar Maurya
Apr 03 at 05:31 PM

Can you make more easier to understand your requirement, Here from code it seems like your querying

Questionnaire bo for, and creating ZSurveyQA by passing value which retrieved from Questionnaire BO.

Show 3 Share
10 |10000 characters needed characters left characters exceeded
Former Member

I have to send ticket survey details to 3rd party.

Ticket survey details can find in Ticket BO and Questionnaire BO. Created Custom BO with the selective fields of these two BO. I have to combine these two BO's query result into custom BO.


You can query both BO in your custom script and get the result set in two variables.

then you can use both variable as per your requirement.

var temp1;

var temp2;

foreach(var ins in result1){

temp1 = ins.fieldsofSurvey;


foreach(var ins1 in result2){

temp2 = ins.fieldsofTickets;


user temp1 and temp2 as per your requirement

Former Member

Thank you for the details.