on 01-19-2016 5:10 AM
Hello, Guys,
I have created a HANA Query Calculation view to select data from vbak and vbap table on where vkorg is "RR" and mandt is client 100.
I have multiple client in my S4HANA box , my issue that I am getting data in calculation view from mutiple client inspite of sending where clause as my current client. My user is created with client 100 , I am not sure why the data is coming from multiple clients ,following is the code for Calc view:
/********* Begin Procedure Script ************/
BEGIN
DECLARE simuuid NVARCHAR(100);
DECLARE team NVARCHAR(1);
DECLARE role NVARCHAR(1);
DECLARE bukrs NVARCHAR(4);
DECLARE aggregate INT;
DECLARE max_days INT;
DECLARE qtr INT;
DECLARE simday INT;
DECLARE last_day INT;
DECLARE mandt NVARCHAR(3);
DECLARE countrows INT;
select VALUE into mandt from USER_PARAMETERS where USER_NAME = SESSION_USER and PARAMETER = 'CLIENT';
select
case
when SUBSTRING ("PARVA",0,9) = 'TEAM_MEMB' then
SUBSTRING ("PARVA",13,1)
when SUBSTRING ("PARVA",0,9) = 'SELFSTUDY' then
SUBSTRING ("PARVA",11,1)
when SUBSTRING ("PARVA",0,9) = 'SUPERADMI' then
'+'
when SUBSTRING ("PARVA",0,9) = 'DEVELOPER' then
'+'
else ''
end as team into team from saperp.USR05 where parid = 'ERPRole' and bname = SESSION_USER and mandt = :mandt; -- CURRENT_USER;
select case
when SUBSTRING ("PARVA",0,9) = 'TEAM_MEMB' then
'U'
when SUBSTRING ("PARVA",0,9) = 'SELFSTUDY' then
'U'
when SUBSTRING ("PARVA",0,9) = 'SUPERADMI' then
'A'
when SUBSTRING ("PARVA",0,9) = 'DEVELOPER' then
'D'
else ''
end as role into role from saperp.USR05 where parid = 'ERPRole' and bname = SESSION_USER and mandt = :mandt;
select count(*) into countrows from saperp.USR05 where parid = 'BUK' and bname = SESSION_USER and mandt = :mandt;
if :countrows = 0 then
select CONCAT(:team,:team) into bukrs from dummy;
else
select "PARVA" into bukrs from saperp.USR05 where parid = 'BUK' and bname = SESSION_USER and mandt = :mandt;
end if;
select count(*) into countrows from "<tablename>" where bukrs = :bukrs and mandt = :mandt;
if :countrows > 0 then
select simuuid into simuuid
from "<tablename>" where bukrs = :bukrs and mandt = :mandt;
end if;
var_out = SELECT
h.vkorg,s.crqtr, s.crday,
i.arktx AS maktx,
SUM( i.netwr ) AS netwr, SUM( i.kwmeng ) AS kwmeng, COUNT( * ) AS orders
FROM vbak AS h
INNER Join vbap AS i ON i.vbeln = h.vbeln
INNER JOIN "<tablename>" AS s ON s.vbeln = h.vbeln
WHERE h.vkorg = :bukrs and h.mandt = :mandt
GROUP BY h.vkorg, i.arktx, s.crqtr, s.crday;
END /********* End Procedure Script ************/
As your user has been associated with a client, goto
Calculation view ->Semantics->view properties->change 'Default client' as "Session Client" from "Cross Client"
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I think you need to create a input parameter or variable for client and then need to get the data based upon client selection .
select VALUE into mandt from USER_PARAMETERS where USER_NAME = SESSION_USER and (("MANDT" IN ('clientdetails');
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
94 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.