Commission query

Hello Experts!
I need to create a commission report.
it will be based oinv, OITR and ORIN.
i've got the query already and it is working.
There is just one part of the requirement that i am not too sure how to write:
requirement:
If commission was given on an item that was later on credited ,
deduct the commission amount from future commissions.
here is an exerpt of my query
thank you in advance!
-- invoices paid in incoming cash
select 'INV' as type, T1.cardname, T1.DocNum as [Invoice/CM], T1.numatcard, T1.DocDate as invoicedate,T1.doctotal as [Invoice/CM Total], T0.DocNum as [Payment No.],
T3.DocDate as paymentdate, T0.SumApplied - T0.ExpAppld - isnull(T5.NON_COMM,0) as Payment, T2.SlpName,
  case when T4.commission IS NULL or T4.commission = 0 then T2.Commission/100 * (T0.SumApplied - T0.ExpAppld- isnull(T5.NON_COMM,0)) else T4.Commission/100 * (T0.SumApplied - T0.ExpAppld- isnull(T5.NON_COMM,0)) end as commission,
  case when T4.Commission IS NULL or T4.commission = 0 then T2.Commission else T4.Commission end as comm_rate, isnull(T5.NON_COMM,0) as NON_COMM
from rct2 T0
left outer join oinv T1 on T0.DocEntry = T1.DocEntry and T0.InvType = 13
left outer join OSLP T2 on T1.SlpCode = T2.SlpCode
join ORCT T3 on T0.DocNum = T3.DocNum
join OCRD T4 on T1.CardCode = T4.CardCode
left outer join (select T0.Docnum, sum(T1.quantity*T1.price) as NON_COMM from OINV T0 join INV1 T1 on T0.DocEntry = T1.DocEntry
join OITM T2 on T1.itemcode = T2.itemcode where T2.QryGroup1 = 'Y' group by T0.Docnum) T5 on T5.DocNum = T1.DocNum
where T3.Docdate between @from and @to and T1.DocNum is not null

Hi,
1. What you mean by future commission? How did you get this information?
2. Normally, it will be deducted from raised invoice. ie INV 1 commission - RIN 1 commission
Check below query whether suits your requirement:
SELECT T0.[DocNum], T0.[CardCode],
T0.[CardName], T0.[DocTotal], T1.[ItemCode], T1.[Dscription],
T1.[Quantity], T1.[Commission]
FROM OINV T0 INNER JOIN INV1 T1 ON
T0.DocEntry = T1.DocEntry
WHERE T0.[DocDate] between [%0] and [%1]
GROUP BY T0.[DocNum], T0.[CardCode],
T0.[CardName], T0.[DocTotal], T1.[ItemCode], T1.[Dscription],
T1.[Quantity], T1.[Commission]
union all
SELECT T0.[DocNum], T0.[CardCode],
T0.[CardName], T0.[DocTotal], T1.[ItemCode], T1.[Dscription],
T1.[Quantity], -T1.[Commission]
FROM ORIN T0 INNER JOIN RIN1 T1 ON
T0.DocEntry = T1.DocEntry
WHERE T0.[DocDate] between [%0] and [%1]
GROUP BY T0.[DocNum], T0.[CardCode],
T0.[CardName], T0.[DocTotal], T1.[ItemCode], T1.[Dscription],
T1.[Quantity], T1.[Commission]
Thanks & Regards,
Nagarajan

Similar Messages

  • Commission Query not picking up payment on Account linked later

    Hi Experts,
    I created a query for a Client who need to pay Sales Commission to Sales Employees. This report must show only the Invoices that was Paid.
    The Query works fine, exept that it will not pick up the following Payments: When they makie a Incoming Payment on Account and then later link it to an Invoice via the Internal Reconciliation screen.
    SELECT T0.[DocNum] AS 'Incoming Payment', T0.[DocDate] AS ' Incoming Payment Date', T0.[CardCode], T0.[CardName],  T3.[SlpName], T3.[Commission], T1.[DocNum] AS 'Invoice Number', T2.[OpenSum] AS 'Invoice Line Amounts', T2.[OpenSum] * T3.[Commission] / 100 AS 'Commission Amount'
    FROM ORCT T0  INNER JOIN OINV T1 ON T0.DocEntry = T1.ReceiptNum INNER JOIN INV1 T2 ON T1.DocEntry = T2.DocEntry INNER JOIN OSLP T3 ON T1.SlpCode = T3.SlpCode
    WHERE T0.[DocDate] >=[%0] AND  T0.[DocDate] <=[%1]
    How can I get these Invoices that was linked to a Payment to also show in this query?
    Thanks,
    Marli

    I know that this is an old post, but in case someone else wants to use this code I wanted to point out that this code assumes that only invoices are included in payments.  If other types such as deposits or credits are included in the payment, then you will get the wrong results.
    Need to change the link to OINV slightly to check the document type for Invoices
    JOIN
    OINV T1 ON T1.DocEntry = T4.DocEntry AND T4.InvType = 13 -- AR Invoice Hdr
    Then need to do this same for the other possible document types.

  • Sales Person Commission Report

    What will be a query  to do a sales person commission report which includes Credit Memos?

    Hi Max, welcome to forums.
    Check this thread and see if it helps - Re: Commission Query
    Re: Commission Report
    Credit Memo query
    There are plenty of commission related query threads. You can mix and match to get a result most suitable to you.

  • Commission Report Query

    Hello All --
    We use this Query below:
    SELECT 'Invoice' "Invoice/AR Credit Memo", T0.CardCode
    "BP Code", T0.CardName "Company", T2.State1,
    T0.DocDate,T0.DocNum, T0.DocTotal "Gross Amt", T0.TotalExpns "Freight/Svc Charge", (T0.DocTotal - T0.VatSum-
    T0.TotalExpns) "Net Order", T1.SlpName "Sales Rep",
    T1.Commission "% Commision",
    ((T0.DocTotal - T0.VatSum-T0.TotalExpns)*(T1.Commission/100))
    "Commission Amount", T4.GroupName 'Group'
    FROM dbo.OINV T0 LEFT JOIN dbo.OSLP T1 ON T0.SlpCode = T1.SlpCode
    LEFT JOIN dbo.OCRD T2 ON T0.CardCode = T2.CardCode
    LEFT JOIN dbo.OCPR T3 ON T0.CntctCode = T3.CntctCode
    LEFT JOIN dbo.OCRG T4 ON T4.GroupCode = T2.GroupCode
    WHERE (T1.SlpName BETWEEN '[%0]' and '[%1]') AND
    (T0.DocDate BETWEEN '[%2]' AND '[%3]')
    UNION ALL
    SELECT 'Credit Memo', T0.CardCode, T0.CardName,
    T2.State1,T0.DocDate, T0.DocNum, -T0.DocTotal,
    -T0.TotalExpns, -(T0.DocTotal - T0.VatSum-T0.TotalExpns),
    T1.SlpName, T1.Commission,
    ((T0.DocTotal - T0.VatSum-T0.TotalExpns)*(-T1.Commission/100)),T4.GroupName
    FROM dbo.ORIN T0 LEFT JOIN dbo.OSLP T1 ON T0.SlpCode = T1.SlpCode
    LEFT JOIN dbo.OCRD T2 ON T0.CardCode = T2.CardCode
    LEFT JOIN dbo.OCPR T3 ON T0.CntctCode = T3.CntctCode
    LEFT JOIN dbo.OCRG T4 ON T4.GroupCode = T2.GroupCode
    WHERE (T1.SlpName BETWEEN '[%0]' and '[%1]') AND
    (T0.DocDate BETWEEN '[%2]' AND '[%3]')
    One question -- when we export the results to Excel, the DocDate column shows two different formats:
    2007-01-08
    and
    07/21/08
    We like the second format -- this is correct.  The first one should actually be 7/1/08. 
    It looks fine in SAP but once it is exported into Excel, Excel changes the format of the dates -- but it's not even consistent with how it changes the date format.  Some it converts to the 1st and others the 2nd.  The 2nd is how it appears on SAP.
    Please advise -- we really need it to export the date format so that it is consistent in Excel. 
    Thanks!
    Mike

    Mike,
    Take a look at this link...If it is an issue with the date then all rows would have a problem and not just a select ones. 
    http://office.microsoft.com/en-us/excel/HP100541411033.aspx?pid=CH100645001033
    Suda

  • Commission report Query Question

    The inbuilt Commission Report is run by the following query:
    SELECT T0.DocNum, T0.DocType, T0.DocTotal, ( T0.DocTotal - T0.VatSum) As "Net Income"  , T1.SlpName, T1.Commission, ( ( T0.DocTotal - T0.VatSum)*( T1.Commission/100)) As "Sum_Commissions" FROM OINV T0  INNER JOIN OSLP T1 ON T0.SlpCode = T1.SlpCode WHERE T1.SlpName  = N'[%0]' AND T0.DocDate >= '[%1]' AND  T0.DocDate <= '[%2]'
    However, I have a need to change this query to solve a problem:
    If AFTER the Invoices are added to the system, I go back to the Invoice and change/add the Employee Name to the transaction line, the query ignores these additions made. Can I change the query so the Commission Report takes into account changes made to the employees' field AFTER invoices are posted to the system (SAP allowes me to make such changes to the employee)
    In other words I would like the Query to look at the Emploee field AFTER I make changes and give me an updated report.
    i am aware that SAP does not allow changes to the Invoice AFTER posting them to the system but it seems to allow changes to the Commission/Employee field, so I should be able to run a Commission report after I make these changes.
    Thank you
    Robert

    Hi SUDA,
    Yes I mean SALES EMPLOYEE. It seems strange to me as well that this report will ignore the information in this field. I have checked this again and what seems to happen is as follows: Say I have invoice no 712 marked to Employee=Erica and I run the commission report for Erica and invoice 712 correctly appears on the report. Then I go back and change the Employee Name on the Invoice 712 (on each line) to Robert and I run the report again. I would expect that Inv 712 will be included in this report (commission report for Robert) but for some strange reason, IS NOT.
    In fact INV 712 is still associated with ERICA although I have changed the SE to Robert- please check this out?
    Thanks
    Robert

  • SQL Query to reduce Commission amount on a Sales Order

    I hope that this is the right forum to post this and hope that someone may be able to help?
    I have a customer who wants to manipulate the amount of commission given on a sales order for some specific items.
    I have set up a UDF on the item master record called U_Commission_exempt. I have given this valid answer of 'Y' = Yes and 'N' = No
    When I load a sales order, the commission amount is derived from the Sales Employee logged against the BP on the BP Master Data.
    When you enter the Item No. onto the Sales order, I have set up a formatted search that goes and looks at the Item Master Record, and if the U_Commission_Exempt is set to 'Y' the commission amount on the sales order is supposed to be reduced to zero.
    My problem is, I can not get the SQL to do exactly as I want - at the moment it is reducing the amount to zero every time.
    Can anyone offer any thoughts on how the SQL should look?
    Thanks

    Thanks for all the Abhishek - I really do appreciate all the help on this as it's been really furstrating trying to get over this.
    Would you be able to finalise the SQL for me as I still dont quite understand what you are saying - If you look at Gordon's attempts from earlier, the brackets etc all look different to your version.
    If the OITM record returns 'N', the commission needs to come from OSLP 'Commission' which is stored on the sales order as RDR1 'Commission'

  • Pulling open invoices, and paid invoices with details (Query Help).

    Hello All,
    I am sure I messed something up in my joins. I am looking to pull a report of all invoices OINV for a month, then list details of any payment (if it is paid) next to it from RCT2. It is giving me a list of all of the paid invoices, but even though I have a LEFT JOIN it is not listing any of the invoices without payments.
    This is where I am now from the report wizard in Crystal.
    SELECT "OINV"."DocNum", "OINV"."SlpCode", "OINV"."CardCode", "OINV"."DocTotal", "OINV"."U_Commission", "OSLP"."SlpName", "RCT2"."DcntSum", "ORCT"."TaxDate", "OINV"."DocEntry", "OINV"."TotalExpns", "OINV"."CANCELED", "ORCT"."Canceled", "ORCT"."DocNum", "RCT2"."InvType"
    FROM   ("DBName"."dbo"."OINV" "OINV" LEFT OUTER JOIN "DBName"."dbo"."OSLP" "OSLP" ON "OINV"."SlpCode"="OSLP"."SlpCode")
    INNER JOIN ("DBName"."dbo"."ORCT" "ORCT" INNER JOIN "DBName"."dbo"."RCT2" "RCT2" ON "ORCT"."DocNum"="RCT2"."DocNum")
    ON "OINV"."DocEntry"="RCT2"."DocEntry"
    WHERE  "OINV"."CANCELED"='N' AND "ORCT"."Canceled"='N' AND "RCT2"."InvType"<=N'14'
    ORDER BY "OINV"."SlpCode", "ORCT"."DocNum", "ORCT"."TaxDate"
    Thank you in advance for any help you can give me.

    Hello Kiran,
    I thought about that, but my purposes for running the report is to determine commission based on the date that the invoice was paid, I need the TaxDate in ORCT as it relates to the payment in RCT2.
    Removing the ORCT.cancelled condition and the RCT2.invtype conditions now pulls all of the invoices, paid and unpaid. I know now I cant have them in my query, when the record does not exist in ORCT it doesnt have a value for cancelled, and when there is no record in RCT2 there is no invtype, and is filtered.
    Maybe I can say where ORCT.Canelled = 'N' OR ORCT.Cancelled = NULL, but I dont know if that would work.

  • Query in timesten taking more time than query in oracle database

    Hi,
    Can anyone please explain me why query in timesten taking more time
    than query in oracle database.
    I am mentioning in detail what are my settings and what have I done
    step by step.........
    1.This is the table I created in Oracle datababase
    (Oracle Database 10g Enterprise Edition Release 10.2.0.1.0)...
    CREATE TABLE student (
    id NUMBER(9) primary keY ,
    first_name VARCHAR2(10),
    last_name VARCHAR2(10)
    2.THIS IS THE ANONYMOUS BLOCK I USE TO
    POPULATE THE STUDENT TABLE(TOTAL 2599999 ROWS)...
    declare
    firstname varchar2(12);
    lastname varchar2(12);
    catt number(9);
    begin
    for cntr in 1..2599999 loop
    firstname:=(cntr+8)||'f';
    lastname:=(cntr+2)||'l';
    if cntr like '%9999' then
    dbms_output.put_line(cntr);
    end if;
    insert into student values(cntr,firstname, lastname);
    end loop;
    end;
    3. MY DSN IS SET THE FOLLWING WAY..
    DATA STORE PATH- G:\dipesh3repo\db
    LOG DIRECTORY- G:\dipesh3repo\log
    PERM DATA SIZE-1000
    TEMP DATA SIZE-1000
    MY TIMESTEN VERSION-
    C:\Documents and Settings\dipesh>ttversion
    TimesTen Release 7.0.3.0.0 (32 bit NT) (tt70_32:17000) 2007-09-19T16:04:16Z
    Instance admin: dipesh
    Instance home directory: G:\TimestTen\TT70_32
    Daemon home directory: G:\TimestTen\TT70_32\srv\info
    THEN I CONNECT TO THE TIMESTEN DATABASE
    C:\Documents and Settings\dipesh> ttisql
    command>connect "dsn=dipesh3;oraclepwd=tiger";
    4. THEN I START THE AGENT
    call ttCacheUidPwdSet('SCOTT','TIGER');
    Command> CALL ttCacheStart();
    5.THEN I CREATE THE READ ONLY CACHE GROUP AND LOAD IT
    create readonly cache group rc_student autorefresh
    interval 5 seconds from student
    (id int not null primary key, first_name varchar2(10), last_name varchar2(10));
    load cache group rc_student commit every 100 rows;
    6.NOW I CAN ACCESS THE TABLES FROM TIMESTEN AND PERFORM THE QUERY
    I SET THE TIMING..
    command>TIMING 1;
    consider this query now..
    Command> select * from student where first_name='2155666f';
    < 2155658, 2155666f, 2155660l >
    1 row found.
    Execution time (SQLExecute + Fetch Loop) = 0.668822 seconds.
    another query-
    Command> SELECT * FROM STUDENTS WHERE FIRST_NAME='2340009f';
    2206: Table SCOTT.STUDENTS not found
    Execution time (SQLPrepare) = 0.074964 seconds.
    The command failed.
    Command> SELECT * FROM STUDENT where first_name='2093434f';
    < 2093426, 2093434f, 2093428l >
    1 row found.
    Execution time (SQLExecute + Fetch Loop) = 0.585897 seconds.
    Command>
    7.NOW I PERFORM THE SIMILAR QUERIES FROM SQLPLUS...
    SQL> SELECT * FROM STUDENT WHERE FIRST_NAME='1498671f';
    ID FIRST_NAME LAST_NAME
    1498663 1498671f 1498665l
    Elapsed: 00:00:00.15
    Can anyone please explain me why query in timesten taking more time
    that query in oracle database.
    Message was edited by: Dipesh Majumdar
    user542575
    Message was edited by:
    user542575

    TimesTen
    Hardware: Windows Server 2003 R2 Enterprise x64; 8 x Dual-core AMD 8216 2.41GHz processors; 32 GB RAM
    Version: 7.0.4.0.0 64 bit
    Schema:
    create usermanaged cache group factCache from
    MV_US_DATAMART
    ORDER_DATE               DATE,
    IF_SYSTEM               VARCHAR2(32) NOT NULL,
    GROUPING_ID                TT_BIGINT,
    TIME_DIM_ID               TT_INTEGER NOT NULL,
    BUSINESS_DIM_ID          TT_INTEGER NOT NULL,
    ACCOUNT_DIM_ID               TT_INTEGER NOT NULL,
    ORDERTYPE_DIM_ID          TT_INTEGER NOT NULL,
    INSTR_DIM_ID               TT_INTEGER NOT NULL,
    EXECUTION_DIM_ID          TT_INTEGER NOT NULL,
    EXEC_EXCHANGE_DIM_ID TT_INTEGER NOT NULL,
    NO_ORDERS               TT_BIGINT,
    FILLED_QUANTITY          TT_BIGINT,
    CNT_FILLED_QUANTITY          TT_BIGINT,
    QUANTITY               TT_BIGINT,
    CNT_QUANTITY               TT_BIGINT,
    COMMISSION               BINARY_FLOAT,
    CNT_COMMISSION               TT_BIGINT,
    FILLS_NUMBER               TT_BIGINT,
    CNT_FILLS_NUMBER          TT_BIGINT,
    AGGRESSIVE_FILLS          TT_BIGINT,
    CNT_AGGRESSIVE_FILLS          TT_BIGINT,
    NOTIONAL               BINARY_FLOAT,
    CNT_NOTIONAL               TT_BIGINT,
    TOTAL_PRICE               BINARY_FLOAT,
    CNT_TOTAL_PRICE          TT_BIGINT,
    CANCELLED_ORDERS_COUNT          TT_BIGINT,
    CNT_CANCELLED_ORDERS_COUNT     TT_BIGINT,
    ROUTED_ORDERS_NO          TT_BIGINT,
    CNT_ROUTED_ORDERS_NO          TT_BIGINT,
    ROUTED_LIQUIDITY_QTY          TT_BIGINT,
    CNT_ROUTED_LIQUIDITY_QTY     TT_BIGINT,
    REMOVED_LIQUIDITY_QTY          TT_BIGINT,
    CNT_REMOVED_LIQUIDITY_QTY     TT_BIGINT,
    ADDED_LIQUIDITY_QTY          TT_BIGINT,
    CNT_ADDED_LIQUIDITY_QTY     TT_BIGINT,
    AGENT_CHARGES               BINARY_FLOAT,
    CNT_AGENT_CHARGES          TT_BIGINT,
    CLEARING_CHARGES          BINARY_FLOAT,
    CNT_CLEARING_CHARGES          TT_BIGINT,
    EXECUTION_CHARGES          BINARY_FLOAT,
    CNT_EXECUTION_CHARGES          TT_BIGINT,
    TRANSACTION_CHARGES          BINARY_FLOAT,
    CNT_TRANSACTION_CHARGES     TT_BIGINT,
    ORDER_MANAGEMENT          BINARY_FLOAT,
    CNT_ORDER_MANAGEMENT          TT_BIGINT,
    SETTLEMENT_CHARGES          BINARY_FLOAT,
    CNT_SETTLEMENT_CHARGES          TT_BIGINT,
    RECOVERED_AGENT          BINARY_FLOAT,
    CNT_RECOVERED_AGENT          TT_BIGINT,
    RECOVERED_CLEARING          BINARY_FLOAT,
    CNT_RECOVERED_CLEARING          TT_BIGINT,
    RECOVERED_EXECUTION          BINARY_FLOAT,
    CNT_RECOVERED_EXECUTION     TT_BIGINT,
    RECOVERED_TRANSACTION          BINARY_FLOAT,
    CNT_RECOVERED_TRANSACTION     TT_BIGINT,
    RECOVERED_ORD_MGT          BINARY_FLOAT,
    CNT_RECOVERED_ORD_MGT          TT_BIGINT,
    RECOVERED_SETTLEMENT          BINARY_FLOAT,
    CNT_RECOVERED_SETTLEMENT     TT_BIGINT,
    CLIENT_AGENT               BINARY_FLOAT,
    CNT_CLIENT_AGENT          TT_BIGINT,
    CLIENT_ORDER_MGT          BINARY_FLOAT,
    CNT_CLIENT_ORDER_MGT          TT_BIGINT,
    CLIENT_EXEC               BINARY_FLOAT,
    CNT_CLIENT_EXEC          TT_BIGINT,
    CLIENT_TRANS               BINARY_FLOAT,
    CNT_CLIENT_TRANS          TT_BIGINT,
    CLIENT_CLEARING          BINARY_FLOAT,
    CNT_CLIENT_CLEARING          TT_BIGINT,
    CLIENT_SETTLE               BINARY_FLOAT,
    CNT_CLIENT_SETTLE          TT_BIGINT,
    CHARGEABLE_TAXES          BINARY_FLOAT,
    CNT_CHARGEABLE_TAXES          TT_BIGINT,
    VENDOR_CHARGE               BINARY_FLOAT,
    CNT_VENDOR_CHARGE          TT_BIGINT,
    ROUTING_CHARGES          BINARY_FLOAT,
    CNT_ROUTING_CHARGES          TT_BIGINT,
    RECOVERED_ROUTING          BINARY_FLOAT,
    CNT_RECOVERED_ROUTING          TT_BIGINT,
    CLIENT_ROUTING               BINARY_FLOAT,
    CNT_CLIENT_ROUTING          TT_BIGINT,
    TICKET_CHARGES               BINARY_FLOAT,
    CNT_TICKET_CHARGES          TT_BIGINT,
    RECOVERED_TICKET_CHARGES     BINARY_FLOAT,
    CNT_RECOVERED_TICKET_CHARGES     TT_BIGINT,
    PRIMARY KEY(ORDER_DATE, TIME_DIM_ID, BUSINESS_DIM_ID, ACCOUNT_DIM_ID, ORDERTYPE_DIM_ID, INSTR_DIM_ID, EXECUTION_DIM_ID,EXEC_EXCHANGE_DIM_ID),
    READONLY);
    No of rows: 2228558
    Config:
    < CkptFrequency, 600 >
    < CkptLogVolume, 0 >
    < CkptRate, 0 >
    < ConnectionCharacterSet, US7ASCII >
    < ConnectionName, tt_us_dma >
    < Connections, 64 >
    < DataBaseCharacterSet, AL32UTF8 >
    < DataStore, e:\andrew\datacache\usDMA >
    < DurableCommits, 0 >
    < GroupRestrict, <NULL> >
    < LockLevel, 0 >
    < LockWait, 10 >
    < LogBuffSize, 65536 >
    < LogDir, e:\andrew\datacache\ >
    < LogFileSize, 64 >
    < LogFlushMethod, 1 >
    < LogPurge, 0 >
    < Logging, 1 >
    < MemoryLock, 0 >
    < NLS_LENGTH_SEMANTICS, BYTE >
    < NLS_NCHAR_CONV_EXCP, 0 >
    < NLS_SORT, BINARY >
    < OracleID, NYCATP1 >
    < PassThrough, 0 >
    < PermSize, 4000 >
    < PermWarnThreshold, 90 >
    < PrivateCommands, 0 >
    < Preallocate, 0 >
    < QueryThreshold, 0 >
    < RACCallback, 0 >
    < SQLQueryTimeout, 0 >
    < TempSize, 514 >
    < TempWarnThreshold, 90 >
    < Temporary, 1 >
    < TransparentLoad, 0 >
    < TypeMode, 0 >
    < UID, OS_OWNER >
    ORACLE:
    Hardware: Sunos 5.10; 24x1.8Ghz (unsure of type); 82 GB RAM
    Version 10g Enterprise Edition Release 10.2.0.3.0 - 64bit Production
    Schema:
    CREATE MATERIALIZED VIEW OS_OWNER.MV_US_DATAMART
    TABLESPACE TS_OS
    PARTITION BY RANGE (ORDER_DATE)
    PARTITION MV_US_DATAMART_MINVAL VALUES LESS THAN (TO_DATE(' 2007-11-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
    LOGGING
    NOCOMPRESS
    TABLESPACE TS_OS,
    PARTITION MV_US_DATAMART_07_NOV_D1 VALUES LESS THAN (TO_DATE(' 2007-11-11 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
    LOGGING
    NOCOMPRESS
    TABLESPACE TS_OS,
    PARTITION MV_US_DATAMART_07_NOV_D2 VALUES LESS THAN (TO_DATE(' 2007-11-21 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
    LOGGING
    NOCOMPRESS
    TABLESPACE TS_OS,
    PARTITION MV_US_DATAMART_07_NOV_D3 VALUES LESS THAN (TO_DATE(' 2007-12-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
    LOGGING
    NOCOMPRESS
    TABLESPACE TS_OS,
    PARTITION MV_US_DATAMART_07_DEC_D1 VALUES LESS THAN (TO_DATE(' 2007-12-11 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
    LOGGING
    NOCOMPRESS
    TABLESPACE TS_OS,
    PARTITION MV_US_DATAMART_07_DEC_D2 VALUES LESS THAN (TO_DATE(' 2007-12-21 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
    LOGGING
    NOCOMPRESS
    TABLESPACE TS_OS,
    PARTITION MV_US_DATAMART_07_DEC_D3 VALUES LESS THAN (TO_DATE(' 2008-01-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
    LOGGING
    NOCOMPRESS
    TABLESPACE TS_OS,
    PARTITION MV_US_DATAMART_08_JAN_D1 VALUES LESS THAN (TO_DATE(' 2008-01-11 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
    LOGGING
    NOCOMPRESS
    TABLESPACE TS_OS,
    PARTITION MV_US_DATAMART_08_JAN_D2 VALUES LESS THAN (TO_DATE(' 2008-01-21 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
    LOGGING
    NOCOMPRESS
    TABLESPACE TS_OS,
    PARTITION MV_US_DATAMART_08_JAN_D3 VALUES LESS THAN (TO_DATE(' 2008-02-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
    LOGGING
    NOCOMPRESS
    TABLESPACE TS_OS,
    PARTITION MV_US_DATAMART_MAXVAL VALUES LESS THAN (MAXVALUE)
    LOGGING
    NOCOMPRESS
    TABLESPACE TS_OS
    NOCACHE
    NOCOMPRESS
    NOPARALLEL
    BUILD DEFERRED
    USING INDEX
    TABLESPACE TS_OS_INDEX
    REFRESH FAST ON DEMAND
    WITH PRIMARY KEY
    ENABLE QUERY REWRITE
    AS
    SELECT order_date, if_system,
    GROUPING_ID (order_date,
    if_system,
    business_dim_id,
    time_dim_id,
    account_dim_id,
    ordertype_dim_id,
    instr_dim_id,
    execution_dim_id,
    exec_exchange_dim_id
    ) GROUPING_ID,
    /* ============ DIMENSIONS ============ */
    time_dim_id, business_dim_id, account_dim_id, ordertype_dim_id,
    instr_dim_id, execution_dim_id, exec_exchange_dim_id,
    /* ============ MEASURES ============ */
    -- o.FX_RATE /* FX_RATE */,
    COUNT (*) no_orders,
    -- SUM(NO_ORDERS) NO_ORDERS,
    -- COUNT(NO_ORDERS) CNT_NO_ORDERS,
    SUM (filled_quantity) filled_quantity,
    COUNT (filled_quantity) cnt_filled_quantity, SUM (quantity) quantity,
    COUNT (quantity) cnt_quantity, SUM (commission) commission,
    COUNT (commission) cnt_commission, SUM (fills_number) fills_number,
    COUNT (fills_number) cnt_fills_number,
    SUM (aggressive_fills) aggressive_fills,
    COUNT (aggressive_fills) cnt_aggressive_fills,
    SUM (fx_rate * filled_quantity * average_price) notional,
    COUNT (fx_rate * filled_quantity * average_price) cnt_notional,
    SUM (fx_rate * fills_number * average_price) total_price,
    COUNT (fx_rate * fills_number * average_price) cnt_total_price,
    SUM (CASE
    WHEN order_status = 'C'
    THEN 1
    ELSE 0
    END) cancelled_orders_count,
    COUNT (CASE
    WHEN order_status = 'C'
    THEN 1
    ELSE 0
    END
    ) cnt_cancelled_orders_count,
    -- SUM(t.FX_RATE*t.NO_FILLS*t.AVG_PRICE) AVERAGE_PRICE,
    -- SUM(FILLS_NUMBER*AVERAGE_PRICE) STAGING_AVERAGE_PRICE,
    -- COUNT(FILLS_NUMBER*AVERAGE_PRICE) CNT_STAGING_AVERAGE_PRICE,
    SUM (routed_orders_no) routed_orders_no,
    COUNT (routed_orders_no) cnt_routed_orders_no,
    SUM (routed_liquidity_qty) routed_liquidity_qty,
    COUNT (routed_liquidity_qty) cnt_routed_liquidity_qty,
    SUM (removed_liquidity_qty) removed_liquidity_qty,
    COUNT (removed_liquidity_qty) cnt_removed_liquidity_qty,
    SUM (added_liquidity_qty) added_liquidity_qty,
    COUNT (added_liquidity_qty) cnt_added_liquidity_qty,
    SUM (agent_charges) agent_charges,
    COUNT (agent_charges) cnt_agent_charges,
    SUM (clearing_charges) clearing_charges,
    COUNT (clearing_charges) cnt_clearing_charges,
    SUM (execution_charges) execution_charges,
    COUNT (execution_charges) cnt_execution_charges,
    SUM (transaction_charges) transaction_charges,
    COUNT (transaction_charges) cnt_transaction_charges,
    SUM (order_management) order_management,
    COUNT (order_management) cnt_order_management,
    SUM (settlement_charges) settlement_charges,
    COUNT (settlement_charges) cnt_settlement_charges,
    SUM (recovered_agent) recovered_agent,
    COUNT (recovered_agent) cnt_recovered_agent,
    SUM (recovered_clearing) recovered_clearing,
    COUNT (recovered_clearing) cnt_recovered_clearing,
    SUM (recovered_execution) recovered_execution,
    COUNT (recovered_execution) cnt_recovered_execution,
    SUM (recovered_transaction) recovered_transaction,
    COUNT (recovered_transaction) cnt_recovered_transaction,
    SUM (recovered_ord_mgt) recovered_ord_mgt,
    COUNT (recovered_ord_mgt) cnt_recovered_ord_mgt,
    SUM (recovered_settlement) recovered_settlement,
    COUNT (recovered_settlement) cnt_recovered_settlement,
    SUM (client_agent) client_agent,
    COUNT (client_agent) cnt_client_agent,
    SUM (client_order_mgt) client_order_mgt,
    COUNT (client_order_mgt) cnt_client_order_mgt,
    SUM (client_exec) client_exec, COUNT (client_exec) cnt_client_exec,
    SUM (client_trans) client_trans,
    COUNT (client_trans) cnt_client_trans,
    SUM (client_clearing) client_clearing,
    COUNT (client_clearing) cnt_client_clearing,
    SUM (client_settle) client_settle,
    COUNT (client_settle) cnt_client_settle,
    SUM (chargeable_taxes) chargeable_taxes,
    COUNT (chargeable_taxes) cnt_chargeable_taxes,
    SUM (vendor_charge) vendor_charge,
    COUNT (vendor_charge) cnt_vendor_charge,
    SUM (routing_charges) routing_charges,
    COUNT (routing_charges) cnt_routing_charges,
    SUM (recovered_routing) recovered_routing,
    COUNT (recovered_routing) cnt_recovered_routing,
    SUM (client_routing) client_routing,
    COUNT (client_routing) cnt_client_routing,
    SUM (ticket_charges) ticket_charges,
    COUNT (ticket_charges) cnt_ticket_charges,
    SUM (recovered_ticket_charges) recovered_ticket_charges,
    COUNT (recovered_ticket_charges) cnt_recovered_ticket_charges
    FROM us_datamart_raw
    GROUP BY order_date,
    if_system,
    business_dim_id,
    time_dim_id,
    account_dim_id,
    ordertype_dim_id,
    instr_dim_id,
    execution_dim_id,
    exec_exchange_dim_id;
    -- Note: Index I_SNAP$_MV_US_DATAMART will be created automatically
    -- by Oracle with the associated materialized view.
    CREATE UNIQUE INDEX OS_OWNER.MV_US_DATAMART_UDX ON OS_OWNER.MV_US_DATAMART
    (ORDER_DATE, TIME_DIM_ID, BUSINESS_DIM_ID, ACCOUNT_DIM_ID, ORDERTYPE_DIM_ID,
    INSTR_DIM_ID, EXECUTION_DIM_ID, EXEC_EXCHANGE_DIM_ID)
    NOLOGGING
    NOPARALLEL
    COMPRESS 7;
    No of rows: 2228558
    The query (taken Mondrian) I run against each of them is:
    select sum("MV_US_DATAMART"."NOTIONAL") as "m0"
    --, sum("MV_US_DATAMART"."FILLED_QUANTITY") as "m1"
    --, sum("MV_US_DATAMART"."AGENT_CHARGES") as "m2"
    --, sum("MV_US_DATAMART"."CLEARING_CHARGES") as "m3"
    --, sum("MV_US_DATAMART"."EXECUTION_CHARGES") as "m4"
    --, sum("MV_US_DATAMART"."TRANSACTION_CHARGES") as "m5"
    --, sum("MV_US_DATAMART"."ROUTING_CHARGES") as "m6"
    --, sum("MV_US_DATAMART"."ORDER_MANAGEMENT") as "m7"
    --, sum("MV_US_DATAMART"."SETTLEMENT_CHARGES") as "m8"
    --, sum("MV_US_DATAMART"."COMMISSION") as "m9"
    --, sum("MV_US_DATAMART"."RECOVERED_AGENT") as "m10"
    --, sum("MV_US_DATAMART"."RECOVERED_CLEARING") as "m11"
    --,sum("MV_US_DATAMART"."RECOVERED_EXECUTION") as "m12"
    --,sum("MV_US_DATAMART"."RECOVERED_TRANSACTION") as "m13"
    --, sum("MV_US_DATAMART"."RECOVERED_ROUTING") as "m14"
    --, sum("MV_US_DATAMART"."RECOVERED_ORD_MGT") as "m15"
    --, sum("MV_US_DATAMART"."RECOVERED_SETTLEMENT") as "m16"
    --, sum("MV_US_DATAMART"."RECOVERED_TICKET_CHARGES") as "m17"
    --,sum("MV_US_DATAMART"."TICKET_CHARGES") as "m18"
    --, sum("MV_US_DATAMART"."VENDOR_CHARGE") as "m19"
              from "OS_OWNER"."MV_US_DATAMART" "MV_US_DATAMART"
    where I uncomment a column at a time and rerun. I improved the TimesTen results since my first post, by retyping the NUMBER columns to BINARY_FLOAT. The results I got were:
    No Columns     ORACLE     TimesTen     
    1     1.05     0.94     
    2     1.07     1.47     
    3     2.04     1.8     
    4     2.06     2.08     
    5     2.09     2.4     
    6     3.01     2.67     
    7     4.02     3.06     
    8     4.03     3.37     
    9     4.04     3.62     
    10     4.06     4.02     
    11     4.08     4.31     
    12     4.09     4.61     
    13     5.01     4.76     
    14     5.02     5.06     
    15     5.04     5.25     
    16     5.05     5.48     
    17     5.08     5.84     
    18     6     6.21     
    19     6.02     6.34     
    20     6.04     6.75

  • Query: How do you add a Total field and a Calculation

    Hi Experts,
    I have writen the following query with the Query Generator. I have 2 questions:
    I need to display the Total of column T2.[OpenSum]. How do I write this in the Query?
    I need the T2.[OpenSum] to be multiplied with T3.[Commission] - on the line and put into a newly created column and then have a total at the bottom. How do I do this?
    SELECT T0.[DocNum] AS 'Incoming Payment', T0.[DocDate] AS ' Incoming Payment Date', T0.[CardCode], T0.[CardName],  T3.[SlpName], T3.[Commission], T1.[DocNum] AS 'Invoice Number', T2.[OpenSum] AS 'Invoice Line Amounts'
    FROM ORCT T0  INNER JOIN OINV T1 ON T0.DocEntry = T1.ReceiptNum INNER JOIN INV1 T2 ON T1.DocEntry = T2.DocEntry INNER JOIN OSLP T3 ON T1.SlpCode = T3.SlpCode
    WHERE T0.[DocDate] >=[%0] AND  T0.[DocDate] <=[%1] AND  T3.[SlpName] =[%2]
    ORDER BY T1.[DocNum]
    Any help would be greatly appreciated!
    Thanks!
    Marli

    Hi Marli:
    Try this one for a new column:
    SELECT T0.[DocNum] AS 'Incoming Payment', T0.[DocDate] AS ' Incoming Payment Date', T0.[CardCode], T0.[CardName],  T3.[SlpName], T3.[Commission], T1.[DocNum] AS 'Invoice Number', T2.[OpenSum] AS 'Invoice Line Amounts', T2.[OpenSum] * T3.[Commission] AS 'Commission Amount'
    FROM ORCT T0  INNER JOIN OINV T1 ON T0.DocEntry = T1.ReceiptNum INNER JOIN INV1 T2 ON T1.DocEntry = T2.DocEntry INNER JOIN OSLP T3 ON T1.SlpCode = T3.SlpCode
    WHERE T0.[DocDate] >=[%0] AND  T0.[DocDate] <=[%1] AND  T3.[SlpName] =[%2]
    ORDER BY T1.[DocNum]
    As for the total, if you only want to have a grand total, just CTRL + click column head.
    Thanks,
    Gordon

  • Problem in the commission value

    hi
    can anybody help me on the below problem:
    1)
    Commission Agreements in Invoices:To enable Commission Agreements (Condition Type ZCA1) values to be copied from Sales Orders into the associated Invoices and Commission Credit Note.Currently Invoices reselect valid Commission Agreements upon invoice creation, i.e. Values may have changed after Sales Order creation.
    2) Commissions Agreements in Sales Orders:To enable Commission Agreements (Condition Type ZCA1) values to be changed in Quotation, i.e. override Commission Agreement, by authorised users:Option 1: Bespoke transaction.Option 2: Release Strategy.Option 3: Amend manually – Manual approval and exception reporting.Note – If this cannot be restricted in SAP a robust manual process must be implemented
    3) Commission Credit Note Financial Posting to Sales Ledger1 - Sales invoice automatically creates a Commission Credit Note.2 - Value is posted to Suspense Account GL534900 (Automatic)3 - Value is then transferred to relevant Sales Ledger Commission account (Automatic)Step 3 often fails and may be related to dates / period end closing, there is also an issue with Customer credit notes which create commission debit notes
    4) Program Modification – Re-create the link between the original invoice and the commission credit noteThe creation of a Sales Invoice automatically creates a PartRebSettl.Request Order (ZB3).Bespoke table “ZVCOMMLINK” is updated cross referencing the:·     Billing Document.·     Sales Document.·     Accounting Document.This table is used by ABAP Query ZAQ_FI_0042.Action 1: Identify historically data to populate bespoke table.Action 2: Update bespoke table with historical data. 
              please help me on the above problem.i have checked in the copy control in which they are not maintaining the item category TAN in the sales document from sales document to invoice.but i dont know how then its coming in invoice if its not maintained in the copy control.Also in the automatic creation of credit memo i have to create a link between credit memo and the invoice generated
    waiting for a quick reply
    regards
    vikas

    Hi Mano,
    I dont understand where you are giving the condition maximum value in VK11. Can you please tell me the exact place where you are giving that in VK11. Because as for my knowledge we will give that at some other place. Secondly you told that your condition is working fine with quantity but not with value. Can you explain me that in detail. Anyway just check the calculation type in condition record or in condition type controls.
    Just answer the above, I will tell you the solution.
    Rama Rao

  • Can we generate the output of SQL Query in XML format ..

    Hi Team,
    Can we generate an XML doc for an SQL Query.
    I've seen in SQL Server 2000.It is generating the output of an SQL Query in xml format.
    select * from emp for xml auto
    The output looks like
    <emp EMPNO="7369" ENAME="SMITH" JOB="CLERK" MGR="7902" HIREDATE="1980-12-17T00:00:00" SAL="2800" DEPTNO="20"/><emp EMPNO="7370" ENAME="SMITH" JOB="CLERK" MGR="7902" HIREDATE="1980-12-17T00:00:00" SAL="2800" DEPTNO="10"/>

    Just a little bit of short hand.
    Get the XML out of your database, via HTTP
    Of course the easiest method is just to return an XMLType from a stored procedure and let the calling routine figure out what to do with it. Instead
    of that way though, I'll show you how to do it via HTTP. It's all completely built into 10g and is super easy to use.
    CREATE OR REPLACE VIEW emps_and_depts AS
    SELECT e.employee_id AS "EmployeeId",
    e.last_name AS "Name",
    e.job_id AS "Job",
    e.manager_id AS "Manager",
    e.hire_date AS "HireDate",
    e.salary AS "Salary",
    e.commission_pct AS "Commission",
    XMLFOREST (
    d.department_id AS "DeptNo",
    d.department_name AS "DeptName",
    d.location_id AS "Location"
    ) AS "Dept"
    FROM employees e, departments d
    WHERE e.department_id = d.department_id
    Some people hear web and immediately start salivating about security issues. Let me address that quickly. Just because you have the HTTP and/or
    FTP servers running in the database, that does not mean you have a security problem. For one, I would hope your databases are behind a firewall.
    Second, with the correct architecture (DMZ, app servers, etc) you can make this data available outside the firewall fairly transparently and third,
    just because it's on the web does not mean the data MUST be available on the internet. This is a good way to make your data available on your
    intranet. If you are worried about people INSIDE your firewall, that still doesn't preclude web based access. Follow Oracle security guidelines.
    Before I show you how to get to your data, let's talk about URLs and URIs. A URL is a Uniform Resource Locater and URI is a Uniform Resource
    Identifier. A URL is the way you would identify a document on the net, i.e. http://www.oracle.com is a URL. A URI is a more generic form of a URL.
    Oracle supports three types of URI: HTTPURIType - basically a URL (which would be like the URL above), XDURIType - a pointer to an XDB resource
    (usually an XML document but can be other objects), and DBURIType - a pointer to database objects.
    It's the DBURIType that we're going to concentrate on here. The DBURIType let's us reference database objects using a file/folder paradigm. The
    format for a DBURI is /oradb/<schema>/<table>. Oradb is shorthand for the database; it is not the database name or SID. My database is named XE
    but I still use oradb in the DBURI. For example, the view we created above is in my XE database, is owned by HR (at least in my case) and is called
    EMPS_AND_DEPTS. This can be referenced as /oradb/HR/EMPS_AND_DEPTS.
    If the view had many rows and you wanted only one of them, you can restrict it by including a predicate. The documentation for XDB has a great
    write up on Using DBURIs.In our case, we are going to write out the entire document. Now that you understand that the DBURI is a pointer to
    objects in our instance, we can use that to access the data as a URL.
    The format for the URL call is http://<machinename>:<port>/<DBURI>
    In my case, my XE database is running on a machine called mach1 and is listening on port 8080. So to see the view we created above, I open my
    browser and navigate to: http//mach1:8080/oradb/HR/EMPS_AND_DEPTS
    The created URL will be as http//mach1:8080/oradb/PUBLIC/EMPS_AND_DEPTS
    If your database is set up correctly and listening on port 8080 (the default), your browser should ask you to login. Login as the user who created the
    view (in my case HR). You should now get an XML document displayed in your browser.
    And that's it. It doesn't get much simpler than that. If you get rid of the descriptive text above, it basically comes down to:
    Create a table or view
    Open your web browser
    Enter a URL
    Enter a user ID and password
    View your XML
    If you notice, Oracle formatted the data as XML for us. Our view returns scalar columns and an XML fragment called Dept. Oracle formatted the
    return results into an XML format.
    And as a side note, if you look closely, you'll see that my URL has PUBLIC where I said to put HR. PUBLIC is a synonym for all objects that your
    logged in user can see. That way, if your user has been granted select access on many schemas, you can use PUBLIC and see any of them.

  • Query in ASWE XML code doesn't return data

    Hello, since people on the Oracle Metalink site are to lazy to give an answer to this question. I'll try it via this forum. Here we go:
    I'm developing wireless applications running on Oracle9i Application Server Wireless Edition. I'v tried to implement the employee sample from Oracle Online Mobile Studio (studio.oraclemobile.com). The sample name is employee.jsp. This sample combines XML code with JSP.
    (code at the end of the text)
    When I test the sample I get no query results.
    When you take the first option for example, (search by dept number) the query result will not be displayed. I think it has something to do with the "executeQuery" line.
    rset = stmt.executeQuery("select * from EMP where EMPNO='" + empNum + "'");
    After giving the following input (employeenumber) 7369 (which excists in the
    database). I get the following errors:
    The panama server log returns the following error:
    1/14/02 5:19:28 PM NOTIFY : [Thread-13]
    core.XSLTransformerImpl.getXSLProc(XSLTransformerImpl.java:120)
    Create 10 number of XSL-processor for TINY_HTML
    1/14/02 5:19:35 PM NOTIFY : [Thread-15]
    adapter.URLAdapter.invoke(URLAdapter.java:240)
    URL = http://host/portal/test/employee.jsp
    1/14/02 5:19:37 PM NOTIFY : [Thread-17] adapter.URLAdapter.invoke(URLAdapter.java:240)
    URL =http://host/portal/test/employee.jsp?choice=empNum
    1/14/02 5:19:49 PM NOTIFY : [Thread-19]adapter.URLAdapter.invoke(URLAdapter.java:240)
    URL =http://host/portal/test/employee.jsp?&empNum=7369
    1/14/02 5:19:50 PM ERROR : [Thread-19]rt.common.Controller.reportServiceInvocationError(Controller.java:707)
    Service Invocation Error: Stream closed.
    The jserv.log returns the following error:
    [14/01/2002 17:19:50:431 CET] Invalid column name
    java.sql.SQLException: Invalid column name
    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:168)
    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:210)
    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:273)
    at oracle.jdbc.driver.OracleStatement.get_column_index(OracleStatement.java:4383)
    at oracle.jdbc.driver.OracleResultSetImpl.findColumn(OracleResultSetImpl.java:667)
    at oracle.jdbc.driver.OracleResultSet.getString(OracleResultSet.java:1374)
    at portal.test._employee._jspService(_employee.java:201)
    at oracle.jsp.runtime.HttpJsp.service(HttpJsp.java)
    at oracle.jsp.app.JspApplication.dispatchRequest(JspApplication.java)
    at oracle.jsp.JspServlet.doDispatch(JspServlet.java)
    at oracle.jsp.JspServlet.internalService(JspServlet.java)
    at oracle.jsp.JspServlet.service(JspServlet.java)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:588)
    at org.apache.jserv.JServConnection.processRequest(JServConnection.java:402)
    at org.apache.jserv.JServConnection.run(JServConnection.java:260)
    at java.lang.Thread.run(Thread.java:479)
    Does this have something to do with the encoding of the query result in the select statement? As you can see the variable is in the requeststring (URL = http://host/portal/test/employee.jsp?&empNum=7369)
    My database connection works fine (I've also tested the query using SQL plus and the SQL adapter also works).
    Is this the right statement?: ("select * from EMP where EMPNO='" + empNum + "'");
    I can not do anything with the error in the jserv.log (java.sql.SQLException: Invalid column name).
    The columnname EMPNO excists in the example table. The query in SQL plus gives a result.
    Can someone give my any suggestions?
    Thanks in advance.
    Thomas Wesseling, UCC
    ### Code of employee.jsp ###
    <?xml version="1.0" encoding="UTF-8"?>
    <SimpleResult>
    <SimpleContainer>
    <%@ page language="java" import="java.sql.*, java.util.*, java.text.* "%>
    <%
    //URL variables
    String choice = request.getParameter("choice");
    String empNum = request.getParameter("empNum");
    String lastName = request.getParameter("lastName");
    String jobTitle = request.getParameter("jobTitle");
    String deptNum = request.getParameter("deptNum");
    String notFoundMsg = null; //String for containing varying not found msg
    DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
    Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@172.16.0.51:1521:ora816", "scott", "tiger");
    Statement stmt = conn.createStatement();
    ResultSet rset = null;
    //**** Start of service - first card ****
    if (choice==null && empNum==null && lastName==null &&
    jobTitle==null && deptNum==null)
    %>
    <SimpleMenu title="Employee Search by:">
    <SimpleMenuItem target="employee.jsp?choice=empNum">Employee Number</SimpleMenuItem>
    <SimpleMenuItem target="employee.jsp?choice=lastName">Name</SimpleMenuItem>
    <SimpleMenuItem target="employee.jsp?choice=jobTitle">Job Title</SimpleMenuItem>
    <SimpleMenuItem target="employee.jsp?choice=deptNum">Dept Number</SimpleMenuItem>
    </SimpleMenu>
    <%
    //**** SECOND CARD - which search criteria ****
    if (choice!=null)
    if (choice.equals("empNum") && empNum == null)
    %>
    <!-- show search by employee number -->
    <SimpleForm target="employee.jsp?">
    <SimpleFormItem name="empNum" format="*N">Enter Employee Number: </SimpleFormItem>
    </SimpleForm>
    <%
    else if (choice.equals("lastName") && lastName == null)
    %>
    <!-- show search by last name -->
    <SimpleForm target="employee.jsp?">
    <SimpleFormItem name="lastName" format="*A">Enter Last Name: </SimpleFormItem>
    </SimpleForm>
    <%
    else if (choice.equals("jobTitle") && jobTitle == null)
    %>
    <!-- show search by job title -->
    <SimpleForm target="employee.jsp?">
    <SimpleFormSelect name="jobTitle" title="Enter Job Title:">
    <SimpleFormOption value="CLERK">Clerk</SimpleFormOption>
    <SimpleFormOption value="SALESMAN">Salesman</SimpleFormOption>
    <SimpleFormOption value="MANAGER">Manager</SimpleFormOption>
    <SimpleFormOption value="ANALYST">Analyst</SimpleFormOption>
    <SimpleFormOption value="PRESIDENT">President</SimpleFormOption>
    </SimpleFormSelect>
    </SimpleForm>
    <%
    else if (choice.equals("deptNum") && deptNum == null)
    %>
    <!-- show search by dept number -->
    <SimpleForm target="employee.jsp?">
    <SimpleFormItem name="deptNum" format="*N">Enter Dept Number: </SimpleFormItem>
    </SimpleForm>
    <%
    //**** THIRD CARD - query DB based on criteria ****
    //**** empNum entered as search criteria ****
    if (empNum != null) //empNum is entered as search criteria- NEED TO TEST FOR NON-int
    rset = stmt.executeQuery("select * from EMP where EMPNO='" + empNum + "'");
    if (rset.next()) //if rset returns data, show data
    do {
    %>
    <%@ include file="showResult.jsp" %>
    <%
    } while (rset.next());
    } //end rset.next() is true
    else
    notFoundMsg = "Employee Number " + empNum + " Not Found";
    %>
    <%@ include file="notFound.jsp" %>
    <% }
    } //end if empNum != null
    //**** lastName as search criteria ****
    else if (lastName != null)
    rset = stmt.executeQuery("select * from EMP where ENAME='" + lastName + "'");
    if (rset.next())
    do {
    %>
    <%@ include file="showResult.jsp" %>
    <%
    } while (rset.next());
    } //end rset.next is true
    else
    notFoundMsg = "Name " + lastName + " Not Found";
    %>
    <%@ include file="notFound.jsp" %>
    <% }
    } //end if lastName != null
    //**** jobTitle as search criteria ****
    else if (jobTitle != null)
    rset = stmt.executeQuery("select * from EMP where JOB='" + jobTitle + "'");
    if (rset.next())
    do {
    %>
    <%@ include file="showResult.jsp" %>
    <%
    } while (rset.next());
    } //end rset.next is true
    else
    notFoundMsg = "Job Title " + jobTitle + " Not Found";
    %>
    <%@ include file="notFound.jsp" %>
    <% }
    } //end if jobTitle != null
    //**** deptNum as search criteria ****
    else if (deptNum != null) //deptNum is entered as search criteria
    rset = stmt.executeQuery("select * from EMP where DEPTNO='" + deptNum + "'");
    if (rset.next())
    do {
    %>
    <%@ include file="showResult.jsp" %>
    <%
    } while (rset.next());
    else
    notFoundMsg = "Dept Number " + deptNum + " Not Found";
    %>
    <%@ include file="notFound.jsp" %>
    <% }
    } //end if deptNum != null
    conn.close();
    %>
    </SimpleContainer>
    </SimpleResult>
    ### Code of NotFound.jsp ###
    <SimpleText>
    <SimpleTextItem><%=notFoundMsg%></SimpleTextItem>
    <Action label="Search" type="ACCEPT" task="GO" target="employee.jsp?"></Action>
    </SimpleText>
    ### Code of ShowResult.jsp ###
    <%
    //format date from query
    java.sql.Date date = rset.getDate("HIREDATE");
    String hireDate = DateFormat.getDateInstance(DateFormat.MEDIUM).format(date);
    %>
    <SimpleText>
    <SimpleTextItem>Emp#: <%=rset.getString("EMPNO")%></SimpleTextItem>
    <SimpleTextItem>Name: <%=rset.getString("ENAME")%></SimpleTextItem>
    <SimpleTextItem>Job: <%=rset.getString("JOB")%></SimpleTextItem>
    <SimpleTextItem>Manager: <%=rset.getString("MGR")%></SimpleTextItem>
    <SimpleTextItem>Hire Date: <%=hireDate %></SimpleTextItem>
    <SimpleTextItem>Salary: <%=rset.getString("SAL")%></SimpleTextItem>
    <SimpleTextItem>Commission: <%=rset.getString("COMM")%></SimpleTextItem>
    <SimpleTextItem>Dept#: <%=rset.getString("DEPTNO")%></SimpleTextItem>
    <SimpleTextItem>Email: <%=rset.getString("EMAIL")%></SimpleTextItem>
    <SimpleTextItem>Phone: <%=rset.getString("PHONE")%></SimpleTextItem>
    <Action label="Search" type="SOFT1" task="GO" target="employee.jsp"></Action>
    <Action label="Call" type="OPTIONS" task="CALL" number="<%=rset.getString("PHONE")%>"></Action>
    </SimpleText>

    Is EMPNO really a string field and not a numeric field? Your query is like
    ... where EMPNO='1949'
    and should it perhaps be
    ... where EMPNO=1949
    ?

  • Can Drop Ship Warehouse be Utilized for Commission Only Business?

    Our company has a small percentage of business where we act as a broker only.  We process the customer orders, send the vendor POs and monitor the shipments, but we do not pay the vendor or collect the payment from the customer.  The customer pays the vendor and then our company collects a commission from the vendor.
    The documentation in the help file for drop ship warehouse seems to imply that this scenario is possible:
    Drop Ship
    Select this option to define the warehouse as a drop ship warehouse. Use when the company does not manage inventory, but receives commission for every order.
    I have reviewed some webinars on Drop Ship warehouse.  The scenarios shown culminated in creating A/P and A/R invoices which is not what we want to do.  We are aiming for a Cashless transaction with commission being collected.
    I have setup the drop ship items to have commission by item with the percentage in the Item Master.
    Is this scenario possible in SAP B!?  We have ver. 8.82 PL 05.
    Thank you in advance.
    Julie

    Hi Julie
    try this:
    - one drop ship warehouse.
    - items with commisions, all with warehouse by default.
    - for these items you can create two prices lists, one with the sales prices and another with sales prices plus your commision.
    - create a sales order; when your customer receives it you have to close.
    - create a query to show you all closed sales orders between two dates, and the lines with two prices and the difference.
    - now you know your commisions.
    Kind regards.
    Agustin Marcos Cividanes

  • PO Query report

    Hi Guys
    I wanted to created my own Purchase order report (EKPO, EKBE) with vendor, how do I link it to the vendor?
    Pls advise.

    Newbie,
    You are right, some reports cannot be created through query.  This, however, is not one of them.  I have create dozens of queries linking PO header, PO item, PO Schedule, and Vendor Master tables.
    You evidently have some logical error in the construction of your query, or in your selection criteria.  It is tough to troubleshoot such errors from a distance.
    It is pretty evident that you do not have a lot of experience using query.  I believe that it would be in your best interest to either give this task to a query expert in your company, or commission your developers to create a Z program that meets all of your business requirements.
    Regards,
    DB49

  • How to calculate overwrighting commission to the third party

    hi,
    sap gurus,
    here is the scenario:
    my sold to party is different
    and
    ship to, bill to and pyr is different.
    but
    the order will be on sold to - ie on third party.
    and
    the rest are the same ie - delivery, billing, payment is from the party to whom we have delivered, billed, and paid.
    and
    after the party paying the full amount then we have to
    calculate over writing commission to the party ie sold to.
    how to calculate that commission.
    hint: we hav to think from Partner Determination Procedure perspective and requesting to find a solution for that.
    this is specifically only TRANSACTION SPECIFIC.
    BUT NOT PERIOD SPECIFIC.
    help me on this.
    regrds,
    balaji.t
    09990019711
    and

    Hi
    yopu can make use of existing query in APD and update a Direct Update DSO and then a cube , then u can define your new query on the new Cube with required Keyfigure values .
    Rajesh

Maybe you are looking for

  • Urgent help:Populate Manager field in AD process from

    Hi All, I have been trying to populate AD Manager field in process from. I have a custom pre pop adapter that fetches DN from the AD. The DN fetched has an escape character which i am removing it in custom code. The pre pop adapter populates Manager

  • GRC 10.0 - Auto Approve default roles

    Hello All, Could you please help out me in the below scenarios.      1) We have maintained default roles in NBWC- Access Management - Default roles.      Also set the parameter 2038 to Yes- Auto approve roles without approver. In MSMP we have maintai

  • Updated Nvidia Drivers? (W510)

    Can I get updated Lenovo approved NVidia driver somewhere for the W510? Basically the installed version is 268.24 and the version on NVidia's web site is 296.70, which is about if not more than an year old... Can someone also tell me, what functional

  • Mac OS X upgrade from V. 10.5.8 to 10.7 or higher ?

    how can I upgrade my iMac (8.1 2008 or 2009 model) from Mac OS X V. 10.5.8 to 10.7 or higher ? I bought a new printer which I want to connect which requires 10.7 or higher. thx !!

  • LMS 4.1 Device Package Update

    Hi, I'm having problems updating packages for my new install of LMS Prime 4.1 and hoped someone here could help in diagnosing why. I've attached the psu.log file. Thanks in advance.