Skip to Content
avatar image
Former Member

Query two standard BO's

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(); }



Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

1 Answer

  • Best Answer
    Apr 03, 2018 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.

    Add comment
    10|10000 characters needed characters exceeded