Problem with query 0SD_C03_Q009 / Infocube OSD_C003
Hello,
I am new to BI and have a question because I implemented the Internal Sales Rep business package in the portal which includes an iView with BI query 0SD_C03_Q009. This is for NW2004s IDES installation.
All of the business content, extractors, etc., have been activated and data has been extracted to BI. However, when the query runs, all the values (i.e. Incoming order value, Billing value, etc.) are zero. However, if go into the BI Administrators Workbench (RSA1) and right-click on the InfoCube (0SD_C03) and use the display data function, I can see the correct records in the cube with values in the 0NET_VAL_S field. However, there appears to be two "types" of records -- some with the values populated and others without. I believe these represent data extracted from 2LIS_11_VAITM and 2LIS_11_VAHDR respectively. Also, when checking the update rules, I can see that only "No. of docs" is active for 2LIS_11_VAHDR whereas all the other fields, including 0NET_VAL_S is active for 2LIS_11_VAITM.
For some reason, it appears that the query is only pulling in the "header" records that do not have 0NET_VAL_S populated which is why my results have zero values.
Can someone explain why the query appears to only be pulling in the "header" records? Or is there something wrong in my update rules and I should really have more fields active than just the "No. of docs"? Did I go wrong somewhere in the process of activating the business content, update rules, extractors, etc?
Sorry that was for another query.
i referred to
http://help.sap.com/saphelp_nw70/helpdata/en/b6/287b372018e84ee10000009b38f889/frameset.htm
But there is not restriction on the query... so if there is data it should come..
see if any of other query in the given list works....
http://help.sap.com/saphelp_nw70/helpdata/en/09/a7b339688d2453e10000000a114084/content.htm
Regards
Raj
Edited by: Rajesh J Salecha on Sep 9, 2009 4:21 PM
Similar Messages
-
View with columns based on function - problem with query
Hi,
I'm using Oracle 9i;
I've created a view which has columns based on a table columns (multiple columns from 1 table) and funtion (multiple columns based on 1 function).
The function takes ID as the first argument and name of the column to determine which value to return as the second one.
Here is a sample of such function (simplified):
FUNCTION my_function
(in_id IN NUMBER, in_col_name IN VARCHAR2)
RETURN VARCHAR2
IS
c_name VARCHAR2(100);
c_last_name VARCHAR2(100);
BEGIN
SELECT T.NAME, T.LAST_NAME
INTO c_name, c_last_name
FROM TABLE_1 T, TABLE_2 Z
WHERE T.PK = Z.FK
AND Z.ID = in_id;
IF in_col_name = 'NAME' THEN
RETURN c_name;
ELSIF in_col_name = 'LAST_NAME' THEN
RETURN c_last_name;
END IF;
END;
For simplicty I've restricted the number of columns.
CREATE OR REPLACE VIEW my_view
(ID, NAME, LAST_NAME)
AS
SELECT
T.ID ID
,CAST(my_function(T.ID,'NAME') AS VARCHAR2(100)) NAME
,CAST(my_function(T.ID,'LAST_NAME') AS VARCHAR2(100)) LAST_NAME
FROM TABLE T;
There is no problem with query:
SELECT * FROM my_view;
The problem arises when I query the view (regardles of '=' or 'LIKE'):
SELECT * FROM my_view
WHERE name LIKE '%some_part_of_name%'
The query returns rows for same names, for same it doesn't. If I put '=' and the whole name the query returns nothing, but when I put 'LIKE' and the first letter it returns rows in some cases.
I've tried to debug this situation and I've discovered that the function recives ID not in the proper order and not the same amount of times - in explicit:
for each ID in (1, 2, 3, 4, 5, 6, ... , 100) the function should be called twice for each ID and in the same order, but it does not.
I get 1, 1, 2, 3, 3, 6, 20, 20 and so on.
Help needed.
Greetings.The problem is more complicated than the solutions provided here.
The reason why I'm using the function is this:
the original view was constructed using multiple union all selects and the speed was terrible. I've created the index on the base table to obtain a proper sort. For retriving all records at once the view works perfectly, but if one wants to query by columns based on function the results are suprisng - sometimes there are, some times there are none, or if you serch with "like" and only a part of string there are results, but with "=" there are no results.
Here are real DDLs:
View:
CREATE OR REPLACE VIEW V_DOK_ARCH
(ID_ZDAR, TYP, STAN, DATE_CREATED, CREATED_BY,
DATE_MODIFIED, MODIFIED_BY, SPRA_ID_SPRA, PODM_ID_PODM, PODM_UMOW_ID_UMOW,
NR_WFS, WFS_NR_INTER, UWAGI_OPER, FUNDUSZ, NUMER,
DATA_PODPISANIA, RODZAJ, TYP_PRZY, TYP_UBEZ, NAZWISKO,
IMIE, IMIE_OJCA, NAZWA_FIRMY, NAZWA_FIRMY_SKR, DANE_KLIE)
AS
SELECT /*+ INDEX(Z ZDAR_DATE_CREATED_DESC_I) */
Z.ID_ZDAR ID_ZDAR
, Z.TYP TYP
, Z.STAN STAN
, Z.DATE_CREATED DATE_CREATED
, Z.CREATED_BY CREATED_BY
, Z.DATE_MODIFIED DATE_MODIFIED
, Z.MODIFIED_BY MODIFIED_BY
, Z.SPRA_ID_SPRA SPRA_ID_SPRA
, Z.PODM_ID_PODM PODM_ID_PODM
, Z.PODM_UMOW_ID_UMOW PODM_UMOW_ID_UMOW
, Z.NR_WFS NR_WFS
, Z.WFS_NR_INTER WFS_NR_INTER
, Z.UWAGI_OPER UWAGI_OPER
, Z.FUNDUSZ FUNDUSZ
, CAST(F_Rej_Zdar_Char(Z.ID_ZDAR, 'NUMER') AS VARCHAR2(30)) NUMER
, F_Rej_Zdar_Date(Z.ID_ZDAR, 'DATA_PODPISANIA') DATA_PODPISANIA
, CAST(F_Rej_Zdar_Char(Z.ID_ZDAR, 'RODZAJ') AS VARCHAR2(4)) RODZAJ
, CAST(F_Rej_Zdar_Char(Z.ID_ZDAR, 'TYP_PRZY') AS VARCHAR2(4)) TYP_PRZY
, CAST(F_Rej_Zdar_Char(Z.ID_ZDAR, 'TYP_UBEZ') AS VARCHAR2(3)) TYP_UBEZ
, CAST(F_Rej_Zdar_Char(Z.ID_ZDAR, 'NAZWISKO') AS VARCHAR2(30)) NAZWISKO
, CAST(F_Rej_Zdar_Char(Z.ID_ZDAR, 'IMIE') AS VARCHAR2(30)) IMIE
, CAST(F_Rej_Zdar_Char(Z.ID_ZDAR, 'IMIE_OJCA') AS VARCHAR2(30)) IMIE_OJCA
, CAST(F_Rej_Zdar_Char(Z.ID_ZDAR, 'NAZWA_FIRMY') AS VARCHAR2(300)) NAZWA_FIRMY
, CAST(F_Rej_Zdar_Char(Z.ID_ZDAR, 'NAZWA_FIRMY_SKR') AS VARCHAR2(100)) NAZWA_FIRMY_SKR
, CAST(LTRIM(F_Rej_Zdar_Char(Z.ID_ZDAR, 'NAZWISKO')||' '||F_Rej_Zdar_Char(Z.ID_ZDAR, 'IMIE')||' '||F_Rej_Zdar_Char(Z.ID_ZDAR, 'IMIE_OJCA')||F_Rej_Zdar_Char(Z.ID_ZDAR, 'NAZWA_FIRMY')||DECODE(F_Rej_Zdar_Char(Z.ID_ZDAR, 'NAZWA_FIRMY'),NULL,F_Rej_Zdar_Char(Z.ID_ZDAR, 'NAZWA_FIRMY_SKR'),NULL)) AS VARCHAR2(492)) DANE_KLIE
FROM T_ZDARZENIA Z
WHERE F_Rej_Zdar_Char(Z.ID_ZDAR, 'JEST') = 'T';
and functions:
CREATE OR REPLACE FUNCTION F_Rej_Zdar_Char
(WE_ID_ZDAR IN NUMBER
,WE_KOLUMNA IN VARCHAR2
RETURN VARCHAR2
IS
c_numer T_PRZYSTAPIENIA.NUMER%TYPE;--VARCHAR2(30);
c_rodzaj T_KLIENCI.RODZAJ%TYPE;--VARCHAR2(1);
c_typ_przy T_PRZYSTAPIENIA.TYP_PRZY%TYPE;--VARCHAR2(1);
c_typ_ubez T_PRZYSTAPIENIA.TYP_UBEZ%TYPE;--VARCHAR2(3);
c_nazwisko T_KLIENCI.NAZWISKO%TYPE;--VARCHAR2(30);
c_imie T_KLIENCI.IMIE%TYPE;--VARCHAR2(30);
c_imie_ojca T_KLIENCI.IMIE_OJCA%TYPE;--VARCHAR2(30);
c_nazwa_firmy T_KLIENCI.NAZWA_FIRMY%TYPE;--VARCHAR2(300);
c_nazwa_firmy_skr T_KLIENCI.NAZWA_FIRMY%TYPE;--VARCHAR2(100);
c_jest VARCHAR2(1) := 'T';
c EXCEPTION;
BEGIN
--dbms_output.put_line('id zdar wykonania '||WE_ID_ZDAR);
BEGIN
SELECT p.NUMER, k.RODZAJ,p.TYP_PRZY,p.TYP_UBEZ,k.nazwisko, k.imie, k.imie_ojca, k.nazwa_firmy, k.nazwa_firmy_skr
INTO c_numer, c_rodzaj, c_typ_przy, c_typ_ubez, c_nazwisko, c_imie, c_imie_ojca, c_nazwa_firmy, c_nazwa_firmy_skr
FROM T_KLIENCI k, T_PRZYSTAPIENIA p, T_ZDARZENIA z, T_PODMIOTY D1, T_PODMIOTY D2
WHERE p.KLIE_ID_KLIE = k.ID_KLIE
AND z.PODM_ID_PODM = D1.ID_PODM
AND D1.KLIE_ID_KLIE = p.KLIE_ID_KLIE
AND Z.PODM_UMOW_ID_UMOW = D2.ID_PODM
AND D2.PRZY_ID_PRZY = P.ID_PRZY
AND z.ID_ZDAR = WE_ID_ZDAR;
EXCEPTION
WHEN NO_DATA_FOUND THEN
BEGIN
SELECT p.NUMER, k.RODZAJ,p.TYP_PRZY,p.TYP_UBEZ,k.nazwisko, k.imie, k.imie_ojca, k.nazwa_firmy, k.nazwa_firmy_skr
INTO c_numer, c_rodzaj, c_typ_przy, c_typ_ubez, c_nazwisko, c_imie, c_imie_ojca, c_nazwa_firmy, c_nazwa_firmy_skr
FROM T_KLIENCI k, T_PRZYSTAPIENIA p, T_ZDARZENIA z, T_PODMIOTY D
WHERE z.PODM_UMOW_ID_UMOW IS NULL
AND z.PODM_ID_PODM = D.ID_PODM
AND D.KLIE_ID_KLIE = k.ID_KLIE
AND p.KLIE_ID_KLIE = k.ID_KLIE
AND z.ID_ZDAR = WE_ID_ZDAR;
EXCEPTION
WHEN NO_DATA_FOUND THEN
BEGIN
SELECT NULL NUMER, NULL RODZAJ,NULL TYP_PRZY,NULL TYP_UBEZ, I.nazwisko, I.imie, I.imie_ojca, I.NAZWA NAZWA_FIRMY, I.NAZWA_SKR nazwa_firmy_skr
INTO c_numer, c_rodzaj, c_typ_przy, c_typ_ubez, c_nazwisko, c_imie, c_imie_ojca, c_nazwa_firmy, c_nazwa_firmy_skr
FROM T_ZDARZENIA z, T_INSTYTUCJE I
WHERE Z.TYP IN ('WFS526','WFS542','WFS553','WFS609','WFS611','WYP_KS','WYP_PO','WYP_SB','DI_ZAT')
AND z.PODM_UMOW_ID_UMOW IS NULL
AND Z.PODM_ID_PODM = I.ID_INST
AND z.ID_ZDAR = WE_ID_ZDAR;
EXCEPTION
WHEN NO_DATA_FOUND THEN
BEGIN
SELECT p.NUMER NUMER, DECODE(a.TYP_AGENTA,'A','F','P') RODZAJ, DECODE(a.TYP_AGENTA,'P','R',a.TYP_AGENTA) TYP_PRZY,NULL TYP_UBEZ,a.nazwisko, a.imie, a.imie_ojca, a.nazwa_firmy, a.nazwa_firmy_skr
INTO c_numer, c_rodzaj, c_typ_przy, c_typ_ubez, c_nazwisko, c_imie, c_imie_ojca, c_nazwa_firmy, c_nazwa_firmy_skr
FROM T_AG_AGENCI a, T_AG_UMOWY p, T_ZDARZENIA z
WHERE a.ID_AGAG = p.AGAG_ID_AGAG
AND z.PODM_UMOW_ID_UMOW = p.ID_AGUM
AND z.ID_ZDAR = WE_ID_ZDAR;
EXCEPTION
WHEN NO_DATA_FOUND THEN
BEGIN
SELECT p.NUMER NUMER, DECODE(a.TYP_AGENTA,'A','F','P') RODZAJ, DECODE(a.TYP_AGENTA,'P','R',a.TYP_AGENTA) TYP_PRZY,NULL TYP_UBEZ,a.nazwisko, a.imie, a.imie_ojca, a.nazwa_firmy, a.nazwa_firmy_skr
INTO c_numer, c_rodzaj, c_typ_przy, c_typ_ubez, c_nazwisko, c_imie, c_imie_ojca, c_nazwa_firmy, c_nazwa_firmy_skr
FROM T_AG_AGENCI a, T_AG_UMOWY p, T_ZDARZENIA z
WHERE a.ID_AGAG = p.AGAG_ID_AGAG
AND z.PODM_ID_PODM = a.ID_AGAG
AND z.PODM_UMOW_ID_UMOW IS NULL
AND z.ID_ZDAR = WE_ID_ZDAR;
EXCEPTION
WHEN NO_DATA_FOUND THEN
BEGIN
SELECT p.NUMER_UMOWY NUMER, DECODE(p.TYP_AGENTA,'A','F','P') RODZAJ, DECODE(p.TYP_AGENTA,'P','R',p.TYP_AGENTA) TYP_PRZY,NULL TYP_UBEZ,p.nazwisko, p.imie_pierwsze, p.imie_ojca, p.nazwa_firmy, p.nazwa_firmy_skr
INTO c_numer, c_rodzaj, c_typ_przy, c_typ_ubez, c_nazwisko, c_imie, c_imie_ojca, c_nazwa_firmy, c_nazwa_firmy_skr
FROM T_AG_KANDYDACI a, T_AG_UMOWY_TAB p, T_ZDARZENIA z
WHERE a.ID_AGKAN = p.TECH_PODM_ID_PODM
AND z.PODM_UMOW_ID_UMOW = p.TECH_ID_AGUMT
AND z.ID_ZDAR = WE_ID_ZDAR;
EXCEPTION
WHEN NO_DATA_FOUND THEN
BEGIN
SELECT p.NUMER_UMOWY NUMER, DECODE(p.TYP_AGENTA,'A','F','P') RODZAJ, DECODE(p.TYP_AGENTA,'P','R',p.TYP_AGENTA) TYP_PRZY,NULL TYP_UBEZ,p.nazwisko, p.imie_pierwsze, p.imie_ojca, p.nazwa_firmy, p.nazwa_firmy_skr
INTO c_numer, c_rodzaj, c_typ_przy, c_typ_ubez, c_nazwisko, c_imie, c_imie_ojca, c_nazwa_firmy, c_nazwa_firmy_skr
FROM T_AG_KANDYDACI a, T_AG_UMOWY_TAB p, T_ZDARZENIA z
WHERE a.ID_AGKAN = p.TECH_PODM_ID_PODM
AND z.PODM_ID_PODM = a.ID_AGKAN
AND z.PODM_UMOW_ID_UMOW IS NULL
AND z.ID_ZDAR = WE_ID_ZDAR;
EXCEPTION
WHEN NO_DATA_FOUND THEN
BEGIN
SELECT k.NUMER_UMOWY NUMER, DECODE(k.TYP_PRZYSTAPIENIA,'P','F','P') RODZAJ,k.TYP_PRZYSTAPIENIA TYP_PRZY,'NPO' TYP_UBEZ, k.nazwisko, k.imie_pierwsze, k.imie_ojca, k.nazwa_firmy nazwa_firmy, k.nazwa_firmy_skr nazwa_firmy_skr
INTO c_numer, c_rodzaj, c_typ_przy, c_typ_ubez, c_nazwisko, c_imie, c_imie_ojca, c_nazwa_firmy, c_nazwa_firmy_skr
FROM T_WE_UM_NPO_TAB k, T_ZDARZENIA z
WHERE z.ID_ZDAR = k.TECH_ZDAR_ID_ZDAR
AND k.TYP_PRZYSTAPIENIA IN ('P','W')
AND z.PODM_ID_PODM IS NULL
AND z.PODM_UMOW_ID_UMOW IS NULL
AND z.ID_ZDAR = WE_ID_ZDAR;
EXCEPTION
WHEN NO_DATA_FOUND THEN
BEGIN
SELECT k.NUMER_UMOWY NUMER, 'F' RODZAJ,'-' TYP_PRZY,'OPS' TYP_UBEZ, k.nazwisko, k.imie_pierwsze, k.imie_ojca, NULL nazwa_firmy, NULL nazwa_firmy_skr
INTO c_numer, c_rodzaj, c_typ_przy, c_typ_ubez, c_nazwisko, c_imie, c_imie_ojca, c_nazwa_firmy, c_nazwa_firmy_skr
FROM T_WE_UM_OPS_TAB k,T_ZDARZENIA z
WHERE z.ID_ZDAR = k.TECH_ZDAR_ID_ZDAR
AND z.PODM_ID_PODM IS NULL
AND z.PODM_UMOW_ID_UMOW IS NULL
AND z.ID_ZDAR = WE_ID_ZDAR;
EXCEPTION
WHEN NO_DATA_FOUND THEN
BEGIN
SELECT NULL NUMER, NULL RODZAJ,NULL TYP_PRZY,NULL TYP_UBEZ, NULL nazwisko, NULL imie_pierwsze, NULL imie_ojca, NULL nazwa_firmy, NULL nazwa_firmy_skr
INTO c_numer, c_rodzaj, c_typ_przy, c_typ_ubez, c_nazwisko, c_imie, c_imie_ojca, c_nazwa_firmy, c_nazwa_firmy_skr
FROM T_ZDARZENIA z
WHERE z.TYP NOT IN ('UM_OPS','UM_NPO','NPO_OP','UZUP_U')
AND z.PODM_ID_PODM IS NULL
AND z.PODM_UMOW_ID_UMOW IS NULL
AND z.ID_ZDAR = WE_ID_ZDAR;
EXCEPTION
WHEN NO_DATA_FOUND THEN
--dbms_output.put_line('id zdar wykonania '||WE_ID_ZDAR||' ostatni wyjatek');
NULL;
END;
END;
END;
END;
END;
END;
END;
END;
END;
END;
--raise c;
IF WE_KOLUMNA = 'NUMER' THEN
RETURN c_numer;
ELSIF WE_KOLUMNA = 'RODZAJ' THEN
RETURN c_rodzaj;
ELSIF WE_KOLUMNA = 'TYP_PRZY' THEN
RETURN c_typ_przy;
ELSIF WE_KOLUMNA = 'TYP_UBEZ' THEN
RETURN c_typ_ubez;
ELSIF WE_KOLUMNA = 'NAZWISKO' THEN
RETURN c_nazwisko;
ELSIF WE_KOLUMNA = 'IMIE' THEN
RETURN c_imie;
ELSIF WE_KOLUMNA = 'IMIE_OJCA' THEN
RETURN c_imie_ojca;
ELSIF WE_KOLUMNA = 'NAZWA_FIRMY' THEN
RETURN c_nazwa_firmy;
ELSIF WE_KOLUMNA = 'NAZWA_FIRMY_SKR' THEN
RETURN c_nazwa_firmy_skr;
ELSIF WE_KOLUMNA = 'JEST' THEN
RETURN c_jest;
END IF;
END;
CREATE OR REPLACE FUNCTION F_Rej_Zdar_Date
(WE_ID_ZDAR IN NUMBER
,WE_KOLUMNA IN VARCHAR2
RETURN DATE
IS
d_data DATE;
BEGIN
BEGIN
SELECT p.DATA_PODPISANIA
INTO d_data
FROM T_KLIENCI k, T_PRZYSTAPIENIA p, T_ZDARZENIA z, T_PODMIOTY D1, T_PODMIOTY D2
WHERE p.KLIE_ID_KLIE = k.ID_KLIE
AND z.PODM_ID_PODM = D1.ID_PODM
AND D1.KLIE_ID_KLIE = p.KLIE_ID_KLIE
AND Z.PODM_UMOW_ID_UMOW = D2.ID_PODM
AND D2.PRZY_ID_PRZY = P.ID_PRZY
AND z.ID_ZDAR = WE_ID_ZDAR;
EXCEPTION
WHEN NO_DATA_FOUND THEN
BEGIN
SELECT p.DATA_PODPISANIA
INTO d_data
FROM T_KLIENCI k, T_PRZYSTAPIENIA p, T_ZDARZENIA z, T_PODMIOTY D
WHERE z.PODM_UMOW_ID_UMOW IS NULL
AND z.PODM_ID_PODM = D.ID_PODM
AND D.KLIE_ID_KLIE = k.ID_KLIE
AND p.KLIE_ID_KLIE = k.ID_KLIE
AND z.ID_ZDAR = WE_ID_ZDAR;
EXCEPTION
WHEN NO_DATA_FOUND THEN
BEGIN
SELECT NULL DATA_PODPISANIA
INTO d_data
FROM T_ZDARZENIA z, T_INSTYTUCJE I
WHERE Z.TYP IN ('WFS526','WFS542','WFS553','WFS609','WFS611','WYP_KS','WYP_PO','WYP_SB','DI_ZAT')
AND z.PODM_UMOW_ID_UMOW IS NULL
AND Z.PODM_ID_PODM = I.ID_INST
AND z.ID_ZDAR = WE_ID_ZDAR;
EXCEPTION
WHEN NO_DATA_FOUND THEN
BEGIN
SELECT p.DATA_PODPISANIA DATA_PODPISANIA
INTO d_data
FROM T_AG_AGENCI a, T_AG_UMOWY p, T_ZDARZENIA z
WHERE a.ID_AGAG = p.AGAG_ID_AGAG
AND z.PODM_UMOW_ID_UMOW = p.ID_AGUM
AND z.ID_ZDAR = WE_ID_ZDAR;
EXCEPTION
WHEN NO_DATA_FOUND THEN
BEGIN
SELECT p.DATA_PODPISANIA DATA_PODPISANIA
INTO d_data
FROM T_AG_AGENCI a, T_AG_UMOWY p, T_ZDARZENIA z
WHERE a.ID_AGAG = p.AGAG_ID_AGAG
AND z.PODM_ID_PODM = a.ID_AGAG
AND z.PODM_UMOW_ID_UMOW IS NULL
AND z.ID_ZDAR = WE_ID_ZDAR;
EXCEPTION
WHEN NO_DATA_FOUND THEN
BEGIN
SELECT p.DATA_PODPISU_AGENTA DATA_PODPISANIA
INTO d_data
FROM T_AG_KANDYDACI a, T_AG_UMOWY_TAB p, T_ZDARZENIA z
WHERE a.ID_AGKAN = p.TECH_PODM_ID_PODM
AND z.PODM_UMOW_ID_UMOW = p.TECH_ID_AGUMT
AND z.ID_ZDAR = WE_ID_ZDAR;
EXCEPTION
WHEN NO_DATA_FOUND THEN
BEGIN
SELECT p.DATA_PODPISU_AGENTA DATA_PODPISANIA
INTO d_data
FROM T_AG_KANDYDACI a, T_AG_UMOWY_TAB p, T_ZDARZENIA z
WHERE a.ID_AGKAN = p.TECH_PODM_ID_PODM
AND z.PODM_ID_PODM = a.ID_AGKAN
AND z.PODM_UMOW_ID_UMOW IS NULL
AND z.ID_ZDAR = WE_ID_ZDAR;
EXCEPTION
WHEN NO_DATA_FOUND THEN
BEGIN
SELECT k.DATA_PODPISANIA_UM DATA_PODPISANIA
INTO d_data
FROM T_WE_UM_NPO_TAB k, T_ZDARZENIA z
WHERE z.ID_ZDAR = k.TECH_ZDAR_ID_ZDAR
AND k.TYP_PRZYSTAPIENIA IN ('P','W')
AND z.PODM_ID_PODM IS NULL
AND z.PODM_UMOW_ID_UMOW IS NULL
AND z.ID_ZDAR = WE_ID_ZDAR;
EXCEPTION
WHEN NO_DATA_FOUND THEN
BEGIN
SELECT k.DATA_PODPISANIA_UM DATA_PODPISANIA
INTO d_data
FROM T_WE_UM_OPS_TAB k,T_ZDARZENIA z
WHERE z.ID_ZDAR = k.TECH_ZDAR_ID_ZDAR
AND z.PODM_ID_PODM IS NULL
AND z.PODM_UMOW_ID_UMOW IS NULL
AND z.ID_ZDAR = WE_ID_ZDAR;
EXCEPTION
WHEN NO_DATA_FOUND THEN
BEGIN
SELECT NULL DATA_PODPISANIA
INTO d_data
FROM T_ZDARZENIA z
WHERE z.TYP NOT IN ('UM_OPS','UM_NPO','NPO_OP','UZUP_U')
AND z.PODM_ID_PODM IS NULL
AND z.PODM_UMOW_ID_UMOW IS NULL
AND z.ID_ZDAR = WE_ID_ZDAR;
EXCEPTION
WHEN NO_DATA_FOUND THEN
d_data := NULL;
END;
END;
END;
END;
END;
END;
END;
END;
END;
END;
IF WE_KOLUMNA = 'DATA_PODPISANIA' THEN
RETURN d_data;
END IF;
END; -
Hello Experts,
I'm tryng to develop my first application for EP (v7 SP12) with NWDS (without NWDI).
This application has to read and write data in the EP DB (oracle v10).
I'm using:
<u>a Dictionary Project</u> (define the DB Tables)
<u>a Java Project</u> (define class as DAO, DBManager etc)
<u>a Library Project</u>
<u>an EJB Project</u>
<u>an EAR Project</u>
With these projects I can deploy a <u>webService</u> in my EP server.
BUT I have some problem with a query that I'm tryng to sent to my DB through a DAO Class called by my WebService.
The query is simple and correct but it does not work...
This is the error message returned (the query id in bold)
(column names: GIORNO, NOMEDITTA, NOMEAREA, NOMESETTORE)
<i>HTTP/1.1 500 Internal Server Error
Connection: close
Server: SAP J2EE Engine/7.00
Content-Type: text/xml; charset=UTF-8
Date: Fri, 21 Sep 2007 14:29:57 GMT
Set-Cookie: <value is hidden>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ><SOAP-ENV:Body><SOAP-ENV:Fault><faultcode>SOAP-ENV:Client</faultcode><faultstring>java.sql.SQLException: com.sap.sql.log.OpenSQLException: The SQL statement <b>"SELECT NOMESETTORE, MIN(? - "GIORNO") AS GIORNI FROM SRS_DATEINFORTUNI WHERE NOMEDITTA = ? AND NOMEAREA= ? GROUP BY NOMESETTORE ORDER BY NOMESETTORE"</b> <u>contains the syntax error[s]: - 1:25 - the arithmetic expression >>? - "GIORNO"<< contains a host variable (parameter marker)</u></faultstring><detail><ns1:getGiorniSettori_com.akhela.giorniSenzaInfortuni.ejb.exception.GiorniSenzaInfortuniException xmlns:ns1='urn:GiorniSenzaInfortuniWSWsd/GiorniSenzaInfortuniWSVi'></ns1:getGiorniSettori_com.akhela.giorniSenzaInfortuni.ejb.exception.GiorniSenzaInfortuniException></detail></SOAP-ENV:Fault></SOAP-ENV:Body></SOAP-ENV:Envelope></i>
The variable '?' is the today date, the difference <b>"(?-GIORNO)"</b> is an int..
Moreover in my DAO class the query is <b>"SELECT NOMESETTORE, MIN(? - GIORNO) AS GIORNI FROM SRS_DATEINFORTUNI WHERE NOMEDITTA = ? AND NOMEAREA= ? GROUP BY NOMESETTORE ORDER BY NOMESETTORE</b>", instead in the error message is reported <b>MIN(? - "GIORNO")</b>...
We have tryed also with alternative query, for example we used <b>"MIN(SYSDATA - GIORNO)"</b> but <b>SYSDATA</b> was interpreted as column name and not found....
Any help???
Best RegardsHi, I found something about the Host Variable (http://help.sap.com/saphelp_nw70/helpdata/en/ed/dbf8b7823b084f80a6eb7ad43bdbb9/content.htm), there explain that if you want to use an host variable you have to put ':' as prefix..
My problem is that <u>I need to extract the minimum of the subtraction between two dates:</u>
Query <b>MIN(? - GIORNO)</b> --> <i>Error: the arithmetic expression >>? - "GIORNO"<< contains a host variable (parameter marker)</i>
So I tried to use the ':' as indicated in the manual..
<b>MIN:(? - GIORNO)</b> --> - <i>SQL syntax error: the token ":" was not expected here
- expecting LPAREN, found ':'</i>
<b>MIN(:(? - GIORNO))</b> --> <i>- 1:25 - Open SQL syntax error: :PARAMETER not allowed
- 1:26 - SQL syntax error: the token "(" was not expected here
- 1:26 - expecting ID, found '('</i>
Then I tried to avoid the MIN() function and I tried to do just the subtraction:
<b>? - GIORNO</b> --><i> - 1:21 - the arithmetic expression >>? - "GIORNO"<< contains a host variable (parameter marker)</i>
<b>:(? - GIORNO)</b> --> <i>- 1:21 - Open SQL syntax error: :PARAMETER not allowed
- 1:22 - SQL syntax error: the token "(" was not expected here
- 1:22 - expecting ID, found '('</i>
<b>'2007-09-24' - GIORNO</b> --> <i>- 1:34 - SQL syntax error: first argument of operator "-" must be a number, date/time or interval
- 1:43 - SQL syntax error: arguments of operator "-" do not have correct types
- 1:43 - SQL syntax error: derived columns in SELECT list with AS must be values</i>
<b>GIORNO - GIORNO</b> --> <i>- 1:21 - the group by list and the select list are inconsistent: the column >>"GIORNO"<< is neither grouped nor aggregated
- 1:30 - the group by list and the select list are inconsistent: the column >>"GIORNO"<< is neither grouped nor aggregated</i>
Why these parts of query are not accepted???
I don't understand why... I hope you can help me.
Best Regards
Alessandro -
Problems with Query Panel with Table
Hi. I'm having a problems with this component in runtime. I'm using JDev 11.1.1.1 with ADFBC.
The query uses three optional parameters. When i put a value for the first and leave other blank and execute query, following error is produced:
03/11/2009 04:02:28 AM oracle.adfinternal.view.faces.config.rich.RegistrationConfigurator handleError
GRAVE: Server Exception during PPR, #6
javax.el.ELException: java.lang.ClassCastException: oracle.jbo.common.ViewCriteriaImpl cannot be cast to oracle.jbo.ViewCriteriaRow
at com.sun.el.parser.AstValue.invoke(AstValue.java:161)
at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:283)
at org.apache.myfaces.trinidad.component.UIXComponentBase.broadcastToMethodExpression(UIXComponentBase.java:1282)
at oracle.adf.view.rich.component.UIXQuery.broadcast(UIXQuery.java:115)
I couldn't find any reference about this. Please help....
ThanksFrank,
I am also getting the same error. The version I am using is 11g Release 1(11.1.1.2.0)
Here is what I did:
1. created a view criteria on a view object
2. all are optional
3. Dragged the view criteria as a query component (query panel with query table) on to the design layout
and the error when I clicked the Search button is:
javax.el.ELException: java.lang.ClassCastException: oracle.jbo.common.ViewCriteriaImpl cannot be cast to oracle.jbo.ViewCriteriaRow
at com.sun.el.parser.AstValue.invoke(AstValue.java:161)
at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:283)
at org.apache.myfaces.trinidad.component.UIXComponentBase.broadcastToMethodExpression(UIXComponentBase.java:1289)
at oracle.adf.view.rich.component.UIXQuery.broadcast(UIXQuery.java:115)
at oracle.adf.view.rich.component.fragment.UIXRegion.broadcast(UIXRegion.java:148)
at oracle.adf.view.rich.component.fragment.UIXRegion.broadcast(UIXRegion.java:148)
at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.broadcastEvents(LifecycleImpl.java:812)
at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._executePhase(LifecycleImpl.java:292)
at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:177)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)
at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:292)
at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:191)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at sni.foundation.facesextensions.filters.FoundationFilter.doFilter(FoundationFilter.java:92)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.adfinternal.view.faces.webapp.rich.RegistrationFilter.doFilter(RegistrationFilter.java:97)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:420)
at oracle.adfinternal.view.faces.activedata.AdsFilter.doFilter(AdsFilter.java:60)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:420)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:247)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:157)
at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:92)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:94)
at java.security.AccessController.doPrivileged(Native Method)
at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:313)
at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:413)
at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:138)
at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:70)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.dms.wls.DMSServletFilter.doFilter(DMSServletFilter.java:326)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3592)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2202)
at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2108)
at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1432)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
Caused by: java.lang.ClassCastException: oracle.jbo.common.ViewCriteriaImpl cannot be cast to oracle.jbo.ViewCriteriaRow
at oracle.adfinternal.view.faces.model.binding.FacesCtrlSearchBinding._clearFilterCriteriaRows(FacesCtrlSearchBinding.java:4549)
at oracle.adfinternal.view.faces.model.binding.FacesCtrlSearchBinding._addFilterCriteria(FacesCtrlSearchBinding.java:4603)
at oracle.adfinternal.view.faces.model.binding.FacesCtrlSearchBinding.processQuery(FacesCtrlSearchBinding.java:423)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.sun.el.parser.AstValue.invoke(AstValue.java:157)
Thanks
Venkatesh -
i have problems with a query, i need that have the follows fields.
SELECT T0.[DocNum] AS #Doc, T0.[NumAtCard] AS Referencia, T0.[docDate] AS Fecha, T0.[LicTradNum] AS RFC, T0.[CardName] AS 'Nombre del Cliente', T0.[DocTotalFC] AS TotME, T0.[DocRate] AS 'TC Fact', T0.[DocTotal] AS TotMS, T0.[VatSumFC] AS 'IVA ME', T0.[VatSum] FROM [dbo].[OINV] T0
But i need to know if this invoices have a PR, RF, RC,etc.
I saw that ORIN(RIN1) is for -> RC, OINV(INV9) -> RF, ORCT -> PR but i dont know how make a correctly INNER JOIN. When the invoice have a PR giveme Num of PR, if the invoice have a RC giveme the number of document destination.
So, how can i join these tables for get that information.
Thank you for you help.SELECT * FROM ORDR T0
INNER JOIN RDR1 T1 ON T0.DocEntry = T1.DocEntry
This is a basic inner join created from the SAP Query Generator
Template would be
Select <field names> FROM <base table name>
Inner join <table you want to join> on <<condition you want to two tables to joins>>
or
Simply you can write it
SELECT * FROM ORDR T0, RDR1 T1 WHERE T0.DocEntry = T1.DocEntry
it will do the same thing and you can simply join more tables.
Hope this will help...
Sanjaya -
Performance problem with query on bkpf table
hi good morning all ,
i ahave a performance problem with a below query on bkpf table .
SELECT bukrs
belnr
gjahr
FROM bkpf
INTO TABLE ist_bkpf_temp
WHERE budat IN s_budat.
is ther any possibility to improve the performanece by using index .
plz help me ,
thanks in advance ,
regards ,
srinivashi,
if u can add bukrs as input field or if u have bukrs as part of any other internal table to filter out the data u can use:
for ex:
SELECT bukrs
belnr
gjahr
FROM bkpf
INTO TABLE ist_bkpf_temp
WHERE budat IN s_budat
and bukrs in s_bukrs.
or
SELECT bukrs
belnr
gjahr
FROM bkpf
INTO TABLE ist_bkpf_temp
for all entries in itab
WHERE budat IN s_budat
and bukrs = itab-bukrs.
Just see , if it is possible to do any one of the above?? It has to be verified with ur requirement. -
Performance Problem with Query load
Hello,
after the upgrade to SPS 23, we have some problems with loading a Query. Before the Upgrade, the Query runs 1-3 minutes, and now more then 40 minutes.
Does anyone have an idea?
Regards
MarcoHi,
Suggest executing the Query in RSRT transaction by choosing the option ' Execute+Debugger' to further analyze where exactly the query is taking time.
Make sure choosing the appropriate 'Query Display' (List/BEx Analyzer/ HTML) option before Executing the query in the Debugger mode since the display option also effect the query run time.
Hope this info helps!
Bala Koppuravuri -
ALERT PROBLEM WITH QUERY OUTPUT
I have a few queries that were originally created using the B1 Query Wizard, that I then attached to Alerts. Unfortunately when the Alert runs, the query output is different either in layout or records returned (usually less) when compared to running the query directly. Is this a glitch in B1 as some folks have told me or is there a problem with queries created by the Query Wizard?
Hi Frank,
This is a limitation.
The note 874145 is written about it. It also offers some workarounds.
I would think that you can also create a 'Select count(*)' query that would also run as an alert that would tell the user how many records are affected. I did not test this, just an idea.
Hope it helps,
Jesper -
Dear all,
I have this query which returns me the quantity received through inventory transfer window against quantity sent out through the same window. There can be multiple receipts against one dispatch (Jobwork) and the receipts are linked through a udf which carries the docnum of the document through which the material went out for jobwork. Now my problem is that the query throws me the balance quantity per row i.e suppose material sent out 10 nos and received 5 times 2 nos. The query shows me 8 as balance in all the five rows whereas I want the query to show me 6 in the 2nd row, 4 in 3rd row and so on. I hope I have made myself clear: Kindly help me with this query.
Select X.Docnum as "Outgoing Challan No", X.U_V_Code, X.U_V_Name, X.U_Vendor_Address, X.U_dl_trpt, X.DocDate, X.Filler as "From Whse", X.ItemCode, X.Dscription,
X.Quantity, X.WhsCode as "To Whse", Y.Docnum as "Incoming Challan No", Y.U_Supp_Refno as "Vendor Challan No", Y.DocDate as "Receiving Date", Y.Rec_Quantity as "Received Quantity", Y.WhsCode as "Receiving Warehouse", (X.Quantity-Y.Rec_Quantity) as "Balance Quantity" From
(SELECT T0.DocNum, T0.U_V_CODE, T0.U_V_NAME, T0.U_Vendor_Address, T0.U_dl_trpt, T0.DocDate, T0.Filler, T1.ItemCode, T1.Dscription, T1.Quantity, T1.WhsCode
FROM OWTR T0 INNER JOIN WTR1 T1 ON T0.DocEntry = T1.DocEntry WHERE T0.U_Challan is null and T0.U_V_CODE is not null) as X Left Join
(SELECT T0.DocNum, T0.U_V_CODE, T0.DocDate, T1.ItemCode, T1.Dscription, SUM(T1.Quantity)as "Rec_Quantity", T1.WhsCode,
T0.U_Challan, T0.U_Supp_Refno FROM OWTR T0 INNER JOIN WTR1 T1 ON T0.DocEntry = T1.DocEntry WHERE T0.U_Challan is not null and
T0.U_V_CODE is null Group By T0.DocNum, T0.U_V_Code, T0.DocDate, T1.ItemCode, T1.Dscription, T1.WhsCode, T0.U_Challan, T0.U_Supp_Refno)
as Y on X.docnum = Y.U_Challan and X.ItemCode = Y.ItemCodeclosed
-
Problem with Query Print Layout
Hi, i have this type of problem.
I have create a query with 5 fields,i have saved it, and ,after, i have created a report on this query (Query Print Layout).
So, i have manipulated the report based on the preferences of the customer.
After this operation, customer tell me that he want to see one more field in the report, so i must add, in the original query, this field. But i note that i can't add a field. I can do it, but i must remake all the report.
There is a way to do this type of operation, without remake the report from the start?
Thanks
Regards
MarcoHi Marco:
I asked our Print Layout Expert, and she tolds me that you have to create the report again.
Some time ago, in the report designer was a way to change the link to the query, but that option is disable now.
So, be patient and ask for this functionality to be implemented.
Harold Gómez V. -
Problems with query while transporting
Dear all,
I have transported some queries from the development system to the production system. The transportation ended with the following warnings:
Execute reports for change/transport request: DBWK900095
on the application server: kblbw
There are no reports to execute
Execution of programs after import (XPRA)
End date and time : 20060716141213
Ended with return code: ===> 4 <===
I can see the queries in the BW PRD system but when I run them, they ask for login to DEV system and fetch the data from DEV system itself. Even though the query is physically inside PRD system it is running on the DEV system. I'll be very grateful if someone can give me some inputs in solving this problem. Thanks a lot.
Regards,
SumitDear Sumit,
Kindly check this link. will help you a lot..
Query Transportation
assign points if useful ***
Thanks,
Raj -
Problems with query transport (missing object)
Hello,
I've a problem while transporting a query with the transport connection. I choose the option "necessary objects" but the import in the productive system fails due to a missing object.
How can I find the missing object? In the transport log only the ID is given (e.g. " Element 67ZP0WYO09DFA52PLG2SREVBT is missing in version M")
Thanks in advance,
MarkusHi Markus,
Check data base tables RSZELTXREF & RSZELTTXT for the missing element in the transport.
Try to include all the missing elements of a Query in a new transport and try again.
Hope this will help.
Praveen -
Problems with query via Database-Link (Oracle 7.3.4)
I made the following simple query via database-link.
select count (*) from [email protected]
I got the result in about 200 miliseconds.
Then I4ve tried the following query.
select * from [email protected]
It took about 2 hours end ended with an error message "ORA-03113: end-of-file on communication channel"
So I made another choice
select * from [email protected] where rownum <=1
Took about 200 miliseconds.
So I made the query again an changed only the number of rownums,until I was at rownum <=8
then it went sleeping again(I've canceled the statement because I didn't want to wait 2 hours again).
We made the same things from another server with the same database-link on the same remote server
and we had no problems.
Any Idea???No, network is OK!
Other links are running, I have also no problems when I connect directly to the remote server. -
Hi, gurus. Below is the lines of code i wrote for querying database, but the result i get is not presented correctly.
//conn is set up in another method
//getQueryOption(), getQuery() are two methods which return string repectively.
//getQueryOption() either returns string "title" or "key" which are two columns
//of a table in database. getQuery() returns the specific title or key that user
//is going to search
Statement stat = conn.createStatement();
rs = stat.executeQuery(
"SELECT * FROM assign2 WHERE " + getQueryOption() + " = " + getQuery());i think the problem is coming from the above code. could anyone point me out what's wrong with it? hope i explained it clearly. any help is deeply appreciated.You should mention the problem that you are having, without the information all we can do is guess. My guess is that you are getting a SQL exception because you've not put last bit of your WHERE clause in quotes. If this is correct, the either use a PreparedStatement in place of a Statement, or change your Query string to:
"SELECT * FROM assign2 WHERE " + getQueryOption() + " = '" + getQuery() + "'");Good luck
Lee -
Hello all,
I'm using sap 2005 SP01 PL36.
I wrote this SQL instruction :
SELECT * FROM
(SELECT 'FAT_ACQ' AS TipoDoc, NNM1.SeriesName AS Serie, CONVERT(char(12), OPCH.DocDate, 3) AS DataDiRegistrazione, OPCH.DocNum AS Num,
OPCH.CardCode, OPCH.CardName AS NomeFornitore, CONVERT(char(12), OPCH.U_DateFrom, 3) AS DaData, CONVERT(char(12), OPCH.U_DateTo, 3)
AS AData, CASE OPCH.DocCur WHEN N'CHF' THEN CONVERT(decimal(9, 2), OPCH.DocTotal) ELSE CONVERT(decimal(9, 2), OPCH.DocTotalFC)
END AS TotaleDocumento, OPCH.DocCur AS Valuta, CASE OPCH.DocCur WHEN N'CHF' THEN CONVERT(decimal(9, 2), OPCH.PaidToDate)
ELSE CONVERT(decimal(9, 2), OPCH.PaidFC) END AS TotalePagato, OPCH.DocCur AS Valuta_, OPCH.DocStatus
FROM OPCH INNER JOIN
NNM1 ON OPCH.Series = NNM1.Series
UNION
SELECT 'NOT_CRE' AS TipoDoc, NNM1.SeriesName AS Serie, CONVERT(char(12), ORPC.DocDate, 3) AS DataDiRegistrazione, ORPC.DocNum AS Num,
ORPC.CardCode, ORPC.CardName AS NomeFornitore, CONVERT(char(12), ORPC.U_DateFrom, 3) AS DaData, CONVERT(char(12), ORPC.U_DateTo, 3)
AS AData, CASE ORPC.DocCur WHEN N'CHF' THEN CONVERT(decimal(9, 2), ORPC.DocTotal) ELSE CONVERT(decimal(9, 2), ORPC.DocTotalFC)
END AS TotaleDocumento, ORPC.DocCur AS Valuta, CASE ORPC.DocCur WHEN N'CHF' THEN CONVERT(decimal(9, 2), ORPC.PaidToDate)
ELSE CONVERT(decimal(9, 2), ORPC.PaidFC) END AS TotalePagato, ORPC.DocCur AS Valuta_, ORPC.DocStatus
FROM ORPC INNER JOIN
NNM1 ON ORPC.Series = NNM1.Series) T0
<b>WHERE CARDCODE = 'F00090'</b>
This query works.
When I change <b>WHERE CARDCODE = 'F00090'</b> with <b>WHERE CARDCODE = '[%0]'</b>, it stops to work.
Some one can help me???
CiaoErcole,
The problem is SAP is unable to determine which values to display for CardCode as you have CardCode in your Select statement from both OPCH and ORPC.
When you hardcode the Value SAP does not have to evaluate the '[%0]' and works fine.
SAP sometimes expects you to qualify the Table name with an Alias. I have just added the <b>ALIAS</b> and tested the Query below and it works well. Copy the Query below and Test.
SELECT * FROM
(SELECT 'FAT_ACQ' AS TipoDoc, T1.SeriesName AS Serie, CONVERT(char(12), T0.DocDate, 3) AS DataDiRegistrazione, T0.DocNum AS Num,
T0.CardCode, T0.CardName AS NomeFornitore, CASE T0.DocCur WHEN N'CHF' THEN CONVERT(decimal(9, 2), T0.DocTotal) ELSE CONVERT(decimal(9, 2), T0.DocTotalFC)
END AS TotaleDocumento, T0.DocCur AS Valuta, CASE T0.DocCur WHEN N'CHF' THEN CONVERT(decimal(9, 2), T0.PaidToDate)
ELSE CONVERT(decimal(9, 2), T0.PaidFC) END AS TotalePagato, T0.DocCur AS Valuta_, T0.DocStatus
FROM [DBO].[OPCH] T0 INNER JOIN
[DBO].[NNM1] T1 ON T0.Series = T1.Series
UNION
SELECT 'NOT_CRE' AS TipoDoc, T1.SeriesName AS Serie, CONVERT(char(12), T0.DocDate, 3) AS DataDiRegistrazione, T0.DocNum AS Num,
T0.CardCode, T0.CardName, CASE T0.DocCur WHEN N'CHF' THEN CONVERT(decimal(9, 2), T0.DocTotal) ELSE CONVERT(decimal(9, 2), T0.DocTotalFC)
END AS TotaleDocumento, T0.DocCur AS Valuta, CASE T0.DocCur WHEN N'CHF' THEN CONVERT(decimal(9, 2), T0.PaidToDate)
ELSE CONVERT(decimal(9, 2), T0.PaidFC) END AS TotalePagato, T0.DocCur AS Valuta_, T0.DocStatus
FROM [DBO].[ORPC] T0 INNER JOIN
[DBO].[NNM1] T1 ON T0.Series = T1.Series) T0
WHERE T0.CARDCODE = '[%0]'
Suda
Maybe you are looking for
-
Cannot set up Firefox sync on desktop - no recovery key and will not let me login to get it
I downloaded Firefox for my new android phone and wanted to sync my desktop with the mobile app. When I first went in it said I had an account already set up, but since I didn't remember any of the information about it I just ended up changing the pa
-
PC suite upgrade doesn't work.
After an automatic upgrade at the version 6.81.13.0, the PC Suite doesn't work (before it were OK). I can't connect my 6680 with USB original cable and I can read this error message "Init IMediaControl2). My PC is a P4 3GHz, with 1024MB and Win XP SP
-
Why does my logic keep quitting! D:
I've been working on a song without a problem up until today. After about two minutes of opening the program, Logic decides to quit on me What is causing the crash? Process: Logic Pro X [586] Path: /Applications/Logic Pro X.app/Co
-
Where are BLOB Files stored when using redo log files.
I am using Archive Log Mode for my backups. I was wondering if Blob files get stored in the redo log files or if they are archived somewhere else? Rob.
-
How to add swing components in an applet
hello friends; I encounterd one problem that is I created one applet which I derived from JApplet and now I want to add some swing components to that applet. I added them properly and when I am testing my applet in Appletviewer it is working fine but