This website is not affiliated with, sponsored by, or approved by SAP AG.
12 posts • Page 1 of 1
At query execution time I need to populate a virtual key figure with the average of the lowest 4 values of all records selected from the InfoProvider. I have written code in zxrsrtop and zxrsru02. I am now trying to finish it up in zxrsrzzz. My problem is that this code is executed for each record that is pulled from the infoprovider. Is there anyway to group the records after selection is complete so that I can identify the lowest 4 records and then populate my virtual key figure with their average?
Any suggestions are greatly appreciated. Thank you in advance for your help.
a virtual key figure might not be the correct place. As you have correctly recognized you can only process record by record. I would rather use conditions in the query definition (BEx analyzer). For the new condition choose Bottom N as operator and 4 as a value. You can also define a variable so the last n values will be displayed depending on the variable input.
Hope that helps,
Thomas aka /H
I'm afraid that conditions/exceptions will not work because I need to AVERAGE the lowest 4, not just display them.
Here is an example of what I am trying to do
I have the following records (simplified for this example):
Company(Characteristic) Price (Key Figure)
Now I need to compute an average of the lowest 4. I can display this as another company (characteristic) or as another key figure. Unfortunately, I cannot do this at load time because our users can choose to exclude companies from the query - so that should not be included in the average. Thus, I think the averaging needs to be computed at run-time. Do you have any ideas regarding how I can accomplish this?
Thank you in advance for your help.
Thank you for the response. Unfortunately, that won't work because the users need to see all of the records at the same time, not just the lowest 4. A condition will only return the lowest 4. Additionally, I need to create some other calculations as well (average of all values, average of lowest 4 +.1, etc.)
I am still trying to find a way to make this work. I am not certain it is possible but I am trying and need to test the use of virtual objects. My code in zxrsrtop, zxrsru02, zxrsru01, and zxrsrzzz is all active but I am getting an error when I try to run the query. The error says
Field Symbol has not yet been assigned
I think that all of my field symbols have been assigned. Has anyone seen this error before? Alternatively, does anyone know how to debug these user exits?
Thank you again for all of your help and suggestions.
I don't know if anyone is still looking at this posting, but I am still updating with my successes and new problems.
This last problem was a simple mistake on my part. I now have all field symbols assigned correctly. However, my problem now is that not all of the field symbols are getting the right values. It looks like the program is not recognizing all of the fields in C_S_DATA (numeric characteristics and date/time fields in particular). I don't know if it is a problem with the field catalog/field symbol assignments or what. Has anyone encountered this situation before? Again, all suggestions/help are appreciated.
I know it's no consolation but we are having the exact same issue at the moment. So I'll bump it back to the top and hopefully someone will be able to help.
We were able to figure out that C_S_DATA did not recognize some of our fields because when the query was built some of the data definitions and field assignments in the ZXRSRTOP and ZXRSRZZZ includes were incorrect. We had to go into the query and make some changes (drag those fields into rows/columns, etc.) so that it would pick up the new code in those includes.
Now my problem is that sometimes the average is double or triple what it should be. I can't figure out where that is occurring. At the end of my code in ZXRSRZZZ the field assignment picks up the correct average. When it leaves there and goes through some SAP code something happens and a few of the averages become incorrect. Any ideas on what could be causing this? I am trying to debug through the SAP code, but I haven't found it yet.
I appreciate any help/suggestions. Let me know if I can help you Ed!
Can you please explain how you corrected this error. I could not understand much out of your post and also facing this error while executing some queries but we dont have Virtual Characteristic and Key Figure in my Query.
Any pointers would be helpful.
12 posts • Page 1 of 1
Who is online
Users browsing this forum: No registered users and 6 guests