Skip to Content

Work around for Limitation of %GT operand when Allow External Access to this Query

This document will explain a Limitation of %GT operand when Allow External Access to this Query is checked and a workaround to achieve the same results .at BEx Query level.

Introduction :

%GT operand shows how high the percentage share is with regard to the overall result. The overall result is the outcome of aggregating the highest results level. Dynamic filters (filters that were not specified in the Query Designer) also play a role in calculating the overall result.

Example Table for Operator %GT <Operand>


Sub Categor


%GT ‘Sales’

Oral Care



  1. 16.6667



  1. 16.6667



  1. 33.3333

Personal Care

Liquid soap


  1. 33.3333

Toilet saop


  1. 33.3333

Result for 2000


  1. 66.6667

Overall result



Business Scenario – User needs a financial report which gives Net Sales based on Category and Sub – Category. Further, he needs % Net sales for each Category and sub category based on Total Net Sales.

To achieve this there are two Approaches:

  1. By using %GT formula in Bex query (%GT will work when Allow external access to this query is unchecked)
  2. By using Constant Selection property of Keyfigure at Bex Query level (%GT will not work and throw error when Allow external access to this query is checked).

Approach 1 :

By Using %GT


Drag and drop Category and Sub Category from Infoprovider Panel to rows and Net Sales to columns.

The basic layout of Bex query as below :


STEP 2 :

As shown in below screen shot ,under Columns, right click on Key Figure and click New Formula



As shown in below screen shot click edit button of formula :



As shown below change the description of  New Formula to %Net Sales and under data function double click NDIV0 (X) . NDIV0(X)will avoid the exception raised by query  of division by 0 . If Divisor if 0 , then result will be 0 .


STEP 5 :

Now double click the Net Sales from Key Figure section :



Now select %GT operator as shown below :


STEP 7 :

Click ok


STEP 8 :

Save the query and to see the output execute Tcode RSRT . As show in below screen shot

Overall result for Category = -43,530,655,241.44 and Net sales for Toothpaste = 1,975,377.52

Therefore % Net Sales =( ((1,975,377.52 )/ 43,530,655,241.44)* 100 =00.45 approximately . It is concluded that Toothpaste Net Sales is Approximately 26% of total Net Sales .

Screen shot for toothpaste % Net sales and Net Sale


Screen shot for overall category Net sales


NOTE : The above mention steps are only possible  when Allow external access to this query is unchecked . IF when  Allow external access to this query  property is checked then while saving , the query throws a below mention error :



If you check allow external access then above error pops up

Detail description of error :


Now suppose you want this query to be allow external access to this query checked , there is another way to achieve the above mentioned desired result

Approach 2 :

STEP 1 : Create New Calculated Key Figure with NoDIM


STEP 2: Create Calculated Key Figure using NODIM operator to used keyfigure without any currency


STEP 3: Drag and drop CKY and check the Constant Selection  property as shown below :


With Constant selection property , Calculated key figure hold constant aggregated Net sales irrespective of filters Pane restrictions.

STEP 4:  Now create New selection as shown in below screen shot:


STEP 5: Click Edit and drag and drop Net Sales and put all the restriction which are at Filters pane(Query level restrictions)


STEP 6: Check the Constant selection property for Net Sales with Query selection as shown below:


STEP 7: Now create a % Net Sales formula which calculates  Percentage Net Sales to Net Sales with query selection as shown below:


%A operator is used for percentage calculation.Click ok

STEP 8: Save Query . Final Query Layout  with Allow External Access to this Query checked  as shown below :


Execute query in RSRT to validate the result. As shown in below screen shot

Net Sales with Query Selections=  [43,530,655,241.44]

Net Sales = [2,236,424,774,461.19]

% Net Sales = ([2,236,424,774,461.19] / [43,530,655,241.44]) * 100 = .0045


Referred links :

You must be Logged on to comment or reply to a post.