cancel
Showing results for 
Search instead for 
Did you mean: 

Execute query Competitor takes a long time to do

former_member273875
Participant
0 Kudos

Dear friends,

When I execute the query of Competitor like this

//Start get list competitors by sales organization
//1. Query
var competitorsQuery = BusinessPartner.QueryByCommunicationData;


// 2. Selection
var competitorsSelectionParams = competitorsQuery.CreateSelectionParams();


// 3. Filter competitors by sale organization id
competitorsSelectionParams.Add(competitorsQuery.CompetitorSaleUnitCode_EA8AE8AUBVHCSXVYS0FJ1R3ON.content, "I", "EQ", this.LeanLeadSalesUnitCode.content);
competitorsSelectionParams.Add(competitorsQuery.BusinessCharacterCode.content, "I", "EQ", "CRM005"); //Try to filter Competitor data by BusinessCharacterCode


// 4. Result
var competitorsResultData = competitorsQuery.Execute(competitorsSelectionParams);



For the simple code like this, it takes 10 minutes to get around 300 records.The total records is around 8000 . Could you please help me to optimize this query?

former_member240432
Active Participant

Hello Quang,

Back in December, our colleague johannesschneider suggested to, in your BO-Extension file, add the annotation [Scenario(Scenario_Name)] telling that For Scenario_Name you would have to add the name of your created process extension scenario. Is this done for this scenario?

Accepted Solutions (0)

Answers (1)

Answers (1)

JOSC_ITLAB
Participant
0 Kudos

Hi Quang,

What Fabio said is correct but it seems like you already done this step.

Actually there are big performance issues (in my opinion) with the SAP internal query when we are talking about querys that hit more than 500 entries.

I'd rather advise you to use an oData service for this issue.

To filter the oData with your extension field you need to create an oData extension file.

After that you may build an example oData query in your brwoser which you will later use in the code.

Note that oData is only able to retrieve 1000 entries at a time (which is still tooo many).

I'd rather use the commands top and skip in the oData query. With top=100 you will only receive the first 100 entries. With skip=100 you than can skip the first 100 entries and select 101-200.

Now you can use top=x and skip=y and use them in a while loop to select all entries.

As soon as there are no entries left the oData will throw an error which you can handle to break your while loop and continue with your work.

Also Note that this may bring some network performance issues to the sap systems since you are going to make n calls to the system (since we have no internal odata api)

The only option that would actually help the internal query is a top and skip function for the query.

It is currently in development (or stopped i dont know) but there are a lot of request to implement it.

Kind Regards,

Johannes

JOSC_ITLAB
Participant
0 Kudos

Here is the link to the idea I opened for this issue: https://influence.sap.com/sap/ino/#/idea/226065

former_member273875
Participant
0 Kudos

Hi Johannes Schneider

Thanks for your reply. I have a same think with you to use the Odata to increase the performance but I don't find a way to execute Odata inside ABSL script.

I tried to use External Web Service Integration to consume the c4c Odata api but I always get dump when I consume it

Do you have any example script to consume Odata api? Thanks for your help!

Regards,

Huy-Nguyen