Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
VijayetaSharma
Active Contributor

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>

Category

Sub Categor

Sales

%GT ‘Sales’

Oral Care

Toothpaste

30

  1. 16.6667

Mouthwash

30

  1. 16.6667

Thoothbrush

60

  1. 33.3333

Personal Care

Liquid soap

60

  1. 33.3333

Toilet saop

60

  1. 33.3333

Result for 2000

120

  1. 66.6667

Overall result

180

100

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

STEP 1:

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

STEP 3:

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

STEP 4:

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 :

STEP 6:

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 :

http://help.sap.com/saphelp_nw04/helpdata/en/9b/c1993c54966f3ae10000000a114084/frameset.htm

http://help.sap.com/saphelp_nw04/helpdata/en/e7/5f983c1a356858e10000000a114084/frameset.htm

http://help.sap.com/saphelp_nw70/helpdata/EN/e2/16f13a2f160f28e10000000a114084/content.htm

5 Comments
Labels in this area