Prepare  sql for the output style

I got a table, which has 3 columns, date(DATE), total_currency_value(NUMBER), currency_code(VARCHAR2). There are only 2 values allowed for currency_code :USD, EURO.
Table:
Date total_currency_value currency_code
10-11-2005 2050 USD
10-11-2005 1200 EURO
10-15-2005 1700 USD
10-15-2005 3100 EURO
Now, I wonder how the SQL be prepared to get output it in the following pattern?
Date total_currency_USD total_currency_EURO
10-11-2005 2050 1200
10-15-2005 1700 3100
Thanks for your inputs !

The MAX will return only the largest transaction for each currency for each day. As long a there will never be more then one record for a currency for a day, then it will work. However if there may be multiple records per day, then you need SUM not MAX.
SQL> SELECT * FROM t;
TRANS_DT  CURR        AMT
21-OCT-05 EURO        500
21-OCT-05 USD         600
21-OCT-05 USD        1500
22-OCT-05 EURO       1000
23-OCT-05 USD         700
SQL> SELECT trans_dt,
  2         MAX(DECODE(currency, 'USD', amt, NULL)) total_currency_USD,
  3         MAX(DECODE(currency, 'EURO', amt, NULL)) total_currency_EURO
  4  FROM t
  5  GROUP BY trans_dt;
TRANS_DT  TOTAL_CURRENCY_USD TOTAL_CURRENCY_EURO
21-OCT-05               1500                 500
22-OCT-05                                   1000
23-OCT-05                700
SQL> SELECT trans_dt,
  2         SUM(DECODE(currency, 'USD', amt, NULL)) total_currency_USD,
  3         SUM(DECODE(currency, 'EURO', amt, NULL)) total_currency_EURO
  4  FROM t
  5  GROUP BY trans_dt;
TRANS_DT  TOTAL_CURRENCY_USD TOTAL_CURRENCY_EURO
21-OCT-05               2100                 500
22-OCT-05                                   1000
23-OCT-05                700John

Similar Messages

  • Find the SAP Script name for the Output type RD00 and Appli V3

    Hi Gurus,
    My requirement was to copy the Std SAP Script for the output type RD00 and application name V3 and to do some modification.
    Please any one suggest me how to find the Std SAP script based on the above Output type and Appl ?
    Regards
    paul

    Hi,
    The script Name is LB_BIL_INVOICE
    You can find byNACE>V3>Output Types>RD00-->Processing Routines
    In thje output type Press Change button and select New entries.
    Regards
    Sandipan
    Edited by: Sandipan Ghosh on Mar 31, 2008 12:06 PM

  • Does anyone recommend a good graphic utility to prepare files for the web?

    Does anyone recommend a good graphic utility to prepare files for the web?

    GraphicConverter as noted by Don, or Photoshop Elements are the favourites. Both will allow comprehensive editing, and save for web facilities including reducing the .jpg quality to shrink file size without making the picture smaller.
    There is a free application calld Gimp (open source) but I don't know how good it is or whether it's updated for Lion.

  • I get "overLIB 4.10 or later is required for the CSS Style Plugin" every time I open certain sites, could you tell me what I need to do for this? Thank you.

    I get "overLIB 4.10 or later is required for the CSS Style Plugin" on certain websites, could you please advice me as to what to do to stop this window from popping up?
    Thank you

    Troubleshooting Plugins
    https://support.mozilla.com/en-US/kb/Troubleshooting%20plugins
    Check and tell if its working.

  • SQL for dates output

    SQL pasted below is expected to return dates output in format shown,
    with weekday begining 'MONDAY'. The SQL can be ran by creating
    a dummy table 'CAL_MONTHS' with one number column with around 200 null rows.
    The SQL I have written works fine up to the month and week level but it gets
    messed up when trying to print the dates/days for the particular week.
    I would greatly appreciate any help.
    OUTPUT format I am trying to get:
    Month: JAN-2007
    ================
    Week NO. 1
    Week-Day Date Day
    Monday 1/1 01-JAN-07 01
    Tuesday 2/1 02-JAN-07 02
    Wednesday 3/1 03-JAN-07 03
    Thursday 4/1 04-JAN-07 04
    Friday 5/1 05-JAN-07 05
    Saturday 6/1 06-JAN-07 06
    Sunday 7/1 07-JAN-07 07
    Week NO. 2
    Week-Day Date Day
    Monday 8/1 08-JAN-07 08
    Tuesday 9/1 09-JAN-07 09
    Wednesday 10/1 10-JAN-07 10
    Thursday 11/1 11-JAN-07 11
    Friday 12/1 12-JAN-07 12
    Saturday 13/1 13-JAN-07 13
    Sunday 14/1 14-JAN-07 14 AND SO ON........
    Week NO. 3
    Week-Day Date Day
    Week NO. 4
    Week-Day Date Day
    Week NO. 5
    Week-Day Date Day
    Following is the SQL
    set serveroutput on
    begin
    for xx in(
    SELECT months v_months, to_date('01-'||months,'DD-MON-YYYY') v_dt
    FROM ( SELECT distinct TO_CHAR(days,'MON-YYYY') months
    FROM (SELECT to_date('01/01/2007','dd/mm/yyyy') + (ROWNUM-1) days
    FROM cal_months
    WHERE ROWNUM <= to_number(to_date('01/03/2007','dd/mm/yyyy') - to_date('01/01/2007','dd/mm/yyyy')) +1)
    ORDER BY to_date('01-'||months,'DD-MON-YYYY')) loop
    dbms_output.put_line(chr(10));
    dbms_output.put_line('Month: '||xx.v_months);
    dbms_output.put_line(' ================ ');
    for xy in(
    SELECT distinct
    TO_CHAR(TO_DATE(ROWNUM||'-'||xx.v_months,'DD-MON-YYYY') ,'IW') -
    TO_CHAR(TRUNC(TO_DATE(ROWNUM||'-'||xx.v_months,'DD-MON-YYYY') ,'MM'),'IW')+1 week_no
    FROM cal_months
    WHERE ROWNUM <= TO_CHAR(LAST_DAY(TO_DATE('01-'||xx.v_months,'DD-MON-YYYY')),'DD')) loop
    --dbms_output.put_line(chr(10));
    dbms_output.put_line(' Week NO. '||xy.week_no);
    dbms_output.put_line(' ---------- ');
    dbms_output.put_line(' Week-Day Date Day');
    dbms_output.put_line(' ------------------------------------------ ');
    for zz in(
    SELECT
    TO_CHAR((TO_DATE('01-'||xx.v_months,'DD-MON-YYYY') -
    DECODE(TO_CHAR(TO_DATE('01-'||xx.v_months,'DD-MON-YYYY'),'Dy'),
    TO_CHAR(TO_DATE('01-JAN-2007','DD-MON-YYYY'),'Dy'), 0,
    TO_CHAR(TO_DATE('02-JAN-2007','DD-MON-YYYY'),'Dy'), 1,
    TO_CHAR(TO_DATE('03-JAN-2007','DD-MON-YYYY'),'Dy'), 2,
    TO_CHAR(TO_DATE('04-JAN-2007','DD-MON-YYYY'),'Dy'), 3,
    TO_CHAR(TO_DATE('05-JAN-2007','DD-MON-YYYY'),'Dy'), 4,
    TO_CHAR(TO_DATE('06-JAN-2007','DD-MON-YYYY'),'Dy'),5,
    TO_CHAR(TO_DATE('07-JAN-2007','DD-MON-YYYY'),'Dy'), 6)) + (ROWNUM-1) ,'FMDay dd/mm') datee,
    '' day, to_date('') the_date
    FROM cal_months
    WHERE ROWNUM <= DECODE(TO_CHAR(TO_DATE('01-'||xx.v_months,'DD-MON-YYYY'),'Dy'),
    TO_CHAR(TO_DATE('01-JAN-2007','DD-MON-YYYY'),'Dy'), 0,
    TO_CHAR(TO_DATE('02-JAN-2007','DD-MON-YYYY'),'Dy'), 1,
    TO_CHAR(TO_DATE('03-JAN-2007','DD-MON-YYYY'),'Dy'), 2,
    TO_CHAR(TO_DATE('04-JAN-2007','DD-MON-YYYY'),'Dy'), 3,
    TO_CHAR(TO_DATE('05-JAN-2007','DD-MON-YYYY'),'Dy'), 4,
    TO_CHAR(TO_DATE('06-JAN-2007','DD-MON-YYYY'),'Dy'),5,
    TO_CHAR(TO_DATE('07-JAN-2007','DD-MON-YYYY'),'Dy'),6)
    UNION ALL
    SELECT
    TO_CHAR(TO_DATE(ROWNUM||'-'||xx.v_months,'DD-MON-YYYY'),'FMDay dd/mm') datee,
    TO_CHAR(TO_DATE(ROWNUM||'-'||xx.v_months,'DD-MON-YYYY'),'dd') day,
    TO_DATE(ROWNUM||'-'||xx.v_months,'DD-MON-YYYY') the_date
    FROM cal_months
    WHERE
    ROWNUM <= TO_CHAR(LAST_DAY(TO_DATE('01-'||xx.v_months,'DD-MON-YYYY')),'DD')
    and
    TO_CHAR(TO_DATE('01-'||xx.v_months,'DD-MON-YYYY'),'MON-YYYY') = xx.v_months
    and
    TO_CHAR(TO_DATE(ROWNUM||'-'||xx.v_months,'DD-MON-YYYY') ,'IW') -
    TO_CHAR(TRUNC(TO_DATE(ROWNUM||'-'||xx.v_months,'DD-MON-YYYY') ,'MM'),'IW')+1 = xy.week_no
    ) loop
    dbms_output.put_line(zz.datee||' '||zz.the_date||' '||zz.day); end loop;
    end loop;
    end loop;
    end;

    Try that:
    With weeks of month
    declare
    vyear number:=2007;
    vmes number := 9;
    vdays number;
    week_day number:=0;
    num_day number:=0;
    fx date;
    begin
    vdays := to_char(last_day(to_date(vmes, 'mm')), 'dd');
    dbms_output.put_line(to_char(to_date(vmes, 'mm'), 'Mon') || '-' || vyear);
    for j in 1..vdays loop
         fx := to_date(lpad(j,2,0) || lpad(vmes,2,0) || vyear, 'ddmmyyyy');
    if to_char(fx, 'w')!= week_day then
         week_day := to_char(fx, 'w');
         dbms_output.put_line('Week No.'|| week_day);
         dbms_output.put_line('-----------');          
         dbms_output.put_line('Week_Day     Date     Day');
         dbms_output.put_line('---------------------------');
    end if;
         num_day := to_char(fx, 'd');
         dbms_output.put_line(
              to_char(fx, 'Day') || chr(9) ||
              to_char(fx, 'dd/mm') || chr(9) ||
              to_char(fx, 'dd-Mon-yy') || chr(9) ||
              to_char(fx, 'dd')
    end loop;
    end;
    Sep-2007
    Week No.1
    Week_Day Date Day
    Saturday 01/09 01-Sep-07 01
    Sunday 02/09 02-Sep-07 02
    Monday 03/09 03-Sep-07 03
    Tuesday 04/09 04-Sep-07 04
    Wednesday 05/09 05-Sep-07 05
    Thursday 06/09 06-Sep-07 06
    Friday 07/09 07-Sep-07 07
    Week No.2
    Week_Day Date Day
    Saturday 08/09 08-Sep-07 08
    Sunday 09/09 09-Sep-07 09
    Monday 10/09 10-Sep-07 10
    Tuesday 11/09 11-Sep-07 11
    Wednesday 12/09 12-Sep-07 12
    Thursday 13/09 13-Sep-07 13
    Friday 14/09 14-Sep-07 14
    Week No.3
    Week_Day Date Day
    Saturday 15/09 15-Sep-07 15
    Sunday 16/09 16-Sep-07 16
    Monday 17/09 17-Sep-07 17
    Tuesday 18/09 18-Sep-07 18
    Wednesday 19/09 19-Sep-07 19
    Thursday 20/09 20-Sep-07 20
    Friday 21/09 21-Sep-07 21
    Week No.4
    Week_Day Date Day
    Saturday 22/09 22-Sep-07 22
    Sunday 23/09 23-Sep-07 23
    Monday 24/09 24-Sep-07 24
    Tuesday 25/09 25-Sep-07 25
    Wednesday 26/09 26-Sep-07 26
    Thursday 27/09 27-Sep-07 27
    Friday 28/09 28-Sep-07 28
    Week No.5
    Week_Day Date Day
    Saturday 29/09 29-Sep-07 29
    Sunday 30/09 30-Sep-07 30
    With weeks of years
    declare
    vyear number:=2007;
    vmes number := 9;
    vdays number;
    week_day number:=0;
    num_day number:=0;
    fx date;
    begin
    vdays := to_char(last_day(to_date(vmes, 'mm')), 'dd');
    dbms_output.put_line(to_char(to_date(vmes, 'mm'), 'Mon') || '-' || vyear);
    for j in 1..vdays loop
         fx := to_date(lpad(j,2,0) || lpad(vmes,2,0) || vyear, 'ddmmyyyy');
    if to_char(fx, 'ww')!= week_day then
         week_day := to_char(fx, 'ww');
         dbms_output.put_line('Week No.'|| week_day);
         dbms_output.put_line('-----------');          
         dbms_output.put_line('Week_Day     Date     Day');
         dbms_output.put_line('---------------------------');
    end if;
         num_day := to_char(fx, 'd');
         dbms_output.put_line(
              to_char(fx, 'Day') || chr(9) ||
              to_char(fx, 'dd/mm') || chr(9) ||
              to_char(fx, 'dd-Mon-yy') || chr(9) ||
              to_char(fx, 'dd')
    end loop;
    end;
    Sep-2007
    Week No.35
    Week_Day Date Day
    Saturday 01/09 01-Sep-07 01
    Sunday 02/09 02-Sep-07 02
    Week No.36
    Week_Day Date Day
    Monday 03/09 03-Sep-07 03
    Tuesday 04/09 04-Sep-07 04
    Wednesday 05/09 05-Sep-07 05
    Thursday 06/09 06-Sep-07 06
    Friday 07/09 07-Sep-07 07
    Saturday 08/09 08-Sep-07 08
    Sunday 09/09 09-Sep-07 09
    Week No.37
    Week_Day Date Day
    Monday 10/09 10-Sep-07 10
    Tuesday 11/09 11-Sep-07 11
    Wednesday 12/09 12-Sep-07 12
    Thursday 13/09 13-Sep-07 13
    Friday 14/09 14-Sep-07 14
    Saturday 15/09 15-Sep-07 15
    Sunday 16/09 16-Sep-07 16
    Week No.38
    Week_Day Date Day
    Monday 17/09 17-Sep-07 17
    Tuesday 18/09 18-Sep-07 18
    Wednesday 19/09 19-Sep-07 19
    Thursday 20/09 20-Sep-07 20
    Friday 21/09 21-Sep-07 21
    Saturday 22/09 22-Sep-07 22
    Sunday 23/09 23-Sep-07 23
    Week No.39
    Week_Day Date Day
    Monday 24/09 24-Sep-07 24
    Tuesday 25/09 25-Sep-07 25
    Wednesday 26/09 26-Sep-07 26
    Thursday 27/09 27-Sep-07 27
    Friday 28/09 28-Sep-07 28
    Saturday 29/09 29-Sep-07 29
    Sunday 30/09 30-Sep-07 30

  • Ref cursor stopped returning values for the output.

    Hi Everyone,
    My DB version is
    BANNER                                                        
    Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bi
    PL/SQL Release 10.2.0.1.0 - Production                          
    CORE 10.2.0.1.0 Production                                        
    TNS for Linux: Version 10.2.0.1.0 - Production                  
    NLSRTL Version 10.2.0.1.0 - Production  
    Please do have a look at the code, and let me know where I've gone wrong, because select query is fetching data. Previously procedure was returning values too through ref cursor. Please correct me where I've gone wrong.
    create or replace
    PROCEDURE
    SPL_SPN_MISSING_EMR_AOE_DTL (IN_PATIENT_ID            NUMBER,
                                 IN_FACILITY_ID           NUMBER,
                                 IN_DRAW_DT               DATE,
                                 IN_REQUISITION_NUMBER    ORDER_REQUISITION_HEADER.REQUISITION_NUMBER%TYPE,
                                 IN_CORP_ACRONYM          CORPORATION.CORPORATION_ACRONYM%TYPE,
                                 IN_ABCDEF_MRN           PATIENT.ABCDEF_MRN%TYPE,
                                 IN_ACCOUNT_NUMBER        FACILITY_ACCOUNT_DETAIL.ACCOUNT_NUMBER%TYPE,
                                 IN_HLAB_NUM              FACILITY_ACCOUNT_DETAIL.HLAB_NUM%TYPE,
                                 OV_COMMENTS              OUT   VARCHAR2,
                                 OR_QUES_AND_ANS          OUT   SYS_REFCURSOR) AS                               
    *  Copyright (C) 2013 ABCDEF Laboratories
    *  All Rights Reserved
    *  This Work Contains Trade Secrets And Confidential Material Of
    *  ABCDEF Laboratories., And Its Use Of Disclosure In Whole Or In Part
    *  Without Express Written Permission Of ABCDEF Laboratories Is Prohibited.
    *  Company              : ABCDEF Laboratories
    *  Project              : ABCDEF Scorpion
    *  Name                 : SPL_SPN_MISSING_EMR_AOE_DTL
    * In Parameters         : In_Patient_Id            Number
    *                         In_Facility_Id           Number
    *                         In_Draw_Dt               Date
    *                         In_Requisition_Number    Order_Requisition_Header.Requisition_Number%Type,
    *                         In_Corp_Acronym          Corporation.Corporation_Acronym%Type
    *                         In_ABCDEF_Mrn           Patient.ABCDEF_Mrn%Type
    *                         In_Account_Number        Facility_Account_Detail.Account_Number%Type
    *                         In_Hlab_Num              Facility_Account_Detail.Hlab_Num%Type
    * Out Parameters        : OV_COMMENTS           Out   Varchar2
    *                         OR_QUES_AND_ANS       Out   Sys_Refcursor
    * Description           : This Procedure Will Fetch The Mising Emr Aoe Detail And Provide
    *                         Necessary Comments As Well.
    * Modification History  :
    *   Date       Version No.        Author                 Description
    * 21/01/2014      1.0            ABCDEF               Initial Version  
    * 27/01/2014      1.1            ABCDEF               Restricted the output for duplicate questions
    *                                                     and answers, partially answered AOE. Also renamed
    *                                                     the output variable names.
        CC_PACKAGE_NAME             CONSTANT VARCHAR2(50)  := 'SPL_SPN_MISSING_EMR_AOE_DTL';   
        CC_PROCEDURE_NAME           CONSTANT VARCHAR2(50)  := 'SPL_SPN_MISSING_EMR_AOE_DTL';
        VC_AVL_PAT_QUES             VARCHAR2(1000);
        VC_DUP_PAT_QUES             VARCHAR2(1000);
        VC_ACTUAL_QUES              VARCHAR2(1000);
        VC_ACTUAL_QUES_CNT          NUMBER:= 0;
        VR_QUES_AND_ANS             SYS_REFCURSOR;
        VN_AVL_PAT_QUES_CNT         NUMBER := 0;
        VN_DUP_PAT_QUES_CNT         NUMBER := 0;
        VN_EXACT_PAT_ID_CNT         NUMBER := 0;
        VN_DUPL_PAT_ID              NUMBER := 0;
        VN_EXTERNAL_ID              PATIENT.EXTERNAL_ID%TYPE;
        VC_OBX_QUES                 VARCHAR2(1000);
        VC_OBX_QUES_CNT             NUMBER := 0;
        VN_OBX_QUES_CNT             NUMBER := 0;
        PAT_EXTERNAL_ID             PATIENT.EXTERNAL_ID%TYPE;
        VC_EXACT_BOOLEAN_VAL        VARCHAR2(10) := 'FALSE';
        VC_EXACT_PAR_BOOLEAN_VAL    VARCHAR2(10) := 'FALSE';
        VC_DUPL_BOOLEAN_VAL         VARCHAR2(10) := 'FALSE';
        VC_DUPL_PAR_BOOLEAN_VAL     VARCHAR2(10) := 'FALSE';
        VC_REJECTED_BOOLEAN_VAL     VARCHAR2(10) := 'FALSE';
        VC_REJECTED_PAR_BOOLEAN_VAL VARCHAR2(10) := 'FALSE';
        VC_COMMENTS                 VARCHAR2(100);
        VC_PAR_COMMENTS             VARCHAR2(100);
        VC_RETURN_EXACT_PAT         CHAR(1) := 'N';
        VC_RETURN_DUPL_PAT          CHAR(1) := 'N';
        VC_RETURN_REJECT_PAT        CHAR(1) := 'N';
        VC_CHK_FOR_EXT_ID           CHAR(1) := 'N';
        VN_MAX_MSG_ID               INTERFACE_A04_OBX_SEGMENT.MSG_ID%TYPE;
        VN_MAX_COUNT                NUMBER := 0;
        VN_ITERATION_RUN            NUMBER := 0;
    BEGIN
       SPL_SPN_ERROR_LOGGING_SPK.INFO_PROC
                      (IC_PACKAGE_NAME    => 'SPL_SPN_MISSING_EMR_AOE_DTL'
                      ,IC_PROCEDURE_NAME  => 'SPL_SPN_MISSING_EMR_AOE_DTL'
                      ,IN_BATCH_ID        => '100'
                      ,IC_MESSAGE_TEXT    => 'Start of the procedure with Patient_Id:'||IN_PATIENT_ID||' Facility_Id:'||IN_FACILITY_ID||
                                             ' Draw_Dt:'||IN_DRAW_DT||' Requisition_Number:'||IN_REQUISITION_NUMBER||' Corp_Acronym:'||IN_CORP_ACRONYM||
                                             ' ABCDEF_Mrn:'||IN_ABCDEF_MRN||' Account_Number:'||IN_ACCOUNT_NUMBER||' Hlab_Num:'||IN_HLAB_NUM);
        <<AOE_TEST_LOOP>>
        FOR AOE_REC IN (SELECT ORD.TEST_ID
                            FROM ORDER_REQUISITION_DETAIL ORD
                           WHERE ORD.REQUISITION_HDR_ID = (SELECT ORH.REQUISITION_HDR_ID
                                                             FROM ORDER_REQUISITION_HEADER ORH
                                                            WHERE ORH.REQUISITION_NUMBER = IN_REQUISITION_NUMBER)
                            AND ORD.TEST_CODE IN (SELECT TEST_CODE FROM INTERFACE_ADT_AOE_MASTER WHERE SOURCE_SYSTEM = IN_CORP_ACRONYM))
            LOOP
                VN_ITERATION_RUN := VN_ITERATION_RUN + 1;
                SELECT COUNT(DISTINCT PATIENT_ID)
                INTO VN_EXACT_PAT_ID_CNT
                FROM EMR_ADTAOE_DTL
                WHERE PATIENT_ID  = IN_PATIENT_ID
                AND   TEST_ID = AOE_REC.TEST_ID
                AND   FACILITY_ID = IN_FACILITY_ID   
                AND   (DRAW_DATE   = IN_DRAW_DT
                    OR DRAW_DATE   = TO_DATE('2999/12/31','YYYY/MM/DD'))
                AND   SOURCE_SYSTEM = IN_CORP_ACRONYM ;
                --Collecting all questions in interface_adt_aoe_master
                SELECT STRAGG(SUB1.QUESTION_CODE), COUNT(SUB1.QUESTION_CODE)
                INTO VC_ACTUAL_QUES, VC_ACTUAL_QUES_CNT
                FROM (SELECT DISTINCT QUESTION_CODE FROM INTERFACE_ADT_AOE_MASTER
                      WHERE TEST_CODE = (SELECT TEST_CODE FROM TEST WHERE TEST_ID = AOE_REC.TEST_ID)
                      AND   SOURCE_SYSTEM = IN_CORP_ACRONYM
                      ORDER BY QUESTION_CODE) SUB1;
                 SPL_SPN_ERROR_LOGGING_SPK.INFO_PROC
                              (IC_PACKAGE_NAME    => 'SPL_SPN_MISSING_EMR_AOE_DTL'
                              ,IC_PROCEDURE_NAME  => 'SPL_SPN_MISSING_EMR_AOE_DTL'
                              ,IN_BATCH_ID        => '100'
                              ,IC_MESSAGE_TEXT    => 'vc_actual_ques:'||VC_ACTUAL_QUES ||
                                                     ' vn_exact_pat_id_cnt:'||VN_EXACT_PAT_ID_CNT||
                                                     ' aoe_rec.test_id:'||AOE_REC.TEST_ID||
                                                     ' VN_ITERATION_RUN:'||VN_ITERATION_RUN);
                <<MAIN_IF_BLOCK>>
                IF
                    VN_EXACT_PAT_ID_CNT = 1 AND
                    VN_ITERATION_RUN    >= 1 THEN               
                    --Collecting avaliable questions in emr_adtaoe_dtl               
                    SELECT STRAGG(SUB.QUESTION_CODE), COUNT(DISTINCT SUB.QUESTION_CODE)
                    INTO VC_AVL_PAT_QUES, VN_AVL_PAT_QUES_CNT
                    FROM (SELECT DISTINCT QUESTION_CODE FROM EMR_ADTAOE_DTL
                          WHERE TEST_ID = AOE_REC.TEST_ID
                          AND   PATIENT_ID  = IN_PATIENT_ID
                          AND   FACILITY_ID = IN_FACILITY_ID
                          AND   (DRAW_DATE   = IN_DRAW_DT
                              OR DRAW_DATE   = TO_DATE('2999/12/31','YYYY/MM/DD'))
                          AND   SOURCE_SYSTEM = IN_CORP_ACRONYM
                          AND   ANSWER IS NOT NULL
                          ORDER BY QUESTION_CODE) SUB;
                    SPL_SPN_ERROR_LOGGING_SPK.INFO_PROC
                      (IC_PACKAGE_NAME    => 'SPL_SPN_MISSING_EMR_AOE_DTL'
                      ,IC_PROCEDURE_NAME  => 'SPL_SPN_MISSING_EMR_AOE_DTL'
                      ,IN_BATCH_ID        => '100'
                      ,IC_MESSAGE_TEXT    => 'vc_avl_pat_ques:'||VC_AVL_PAT_QUES||
                                             ' vn_avl_pat_ques_cnt:'||VN_AVL_PAT_QUES_CNT);
                    <<CASE_1_AND_2>>
                    IF
                        VC_AVL_PAT_QUES = VC_ACTUAL_QUES THEN
                        VC_EXACT_BOOLEAN_VAL := 'TRUE';
                        VC_COMMENTS := 'AOE AVAILABLE';
                    ELSIF--<<case_1_and_2>>
                        (VC_AVL_PAT_QUES != VC_ACTUAL_QUES OR VC_AVL_PAT_QUES IS NULL) AND
                        VN_AVL_PAT_QUES_CNT >= 0 THEN
                        VC_EXACT_PAR_BOOLEAN_VAL := 'TRUE';
                        VC_PAR_COMMENTS := 'PARTIAL AOE AVAILABLE';
                    END IF;--<<case_1_and_2>>
                ELSIF
                    VN_EXACT_PAT_ID_CNT = 0 AND
                    VN_ITERATION_RUN    > 1 THEN 
                    VC_EXACT_PAR_BOOLEAN_VAL := 'TRUE';
                    VC_PAR_COMMENTS := 'PARTIAL AOE AVAILABLE';
                ELSIF--<<Main_if_block>>
                    VN_EXACT_PAT_ID_CNT = 0 THEN
                    <<DUPL_PAT_LOOP>>
                    FOR PAT_ID_REC IN(SELECT DISTINCT PATIENT_ID
                                      FROM PATIENT P
                                      WHERE P.ABCDEF_MRN = IN_ABCDEF_MRN
                                      AND EXISTS(SELECT 1 FROM EMR_ADTAOE_DTL EAD
                                                 WHERE EAD.PATIENT_ID  = P.PATIENT_ID
                                                 AND   EAD.TEST_ID     = AOE_REC.TEST_ID
                                                 AND   EAD.FACILITY_ID = IN_FACILITY_ID
                                                 AND  (EAD.DRAW_DATE  = IN_DRAW_DT
                                                    OR EAD.DRAW_DATE  = TO_DATE('2999/12/31','YYYY/MM/DD'))
                                                 AND   EAD.SOURCE_SYSTEM   = IN_CORP_ACRONYM)
                                      AND P.PATIENT_ID != IN_PATIENT_ID)
                    LOOP
                        --Collecting avaliable questions in emr_adtaoe_dtl
                        SELECT STRAGG(SUB.QUESTION_CODE), COUNT(QUESTION_CODE)
                        INTO VC_DUP_PAT_QUES, VN_DUP_PAT_QUES_CNT
                        FROM (SELECT QUESTION_CODE FROM EMR_ADTAOE_DTL   
                               WHERE TEST_ID     = AOE_REC.TEST_ID
                               AND   PATIENT_ID  = PAT_ID_REC.PATIENT_ID
                               AND   FACILITY_ID = IN_FACILITY_ID
                               AND   (DRAW_DATE   = IN_DRAW_DT
                                   OR DRAW_DATE   = TO_DATE('2999/12/31','YYYY/MM/DD'))
                               AND   SOURCE_SYSTEM = IN_CORP_ACRONYM
                               AND   ANSWER IS NOT NULL
                               ORDER BY QUESTION_CODE) SUB;
                        <<CASE_3_AND_4>>
                        IF 
                            VC_DUP_PAT_QUES = VC_ACTUAL_QUES THEN
                            VC_DUPL_BOOLEAN_VAL  := 'TRUE';
                            VC_COMMENTS := 'AOE AVAILABLE FOR DUPLICATE PATIENT';
                        ELSIF
                            VC_DUP_PAT_QUES != VC_ACTUAL_QUES AND
                            VN_DUP_PAT_QUES_CNT >= 0 THEN
                            VC_DUPL_PAR_BOOLEAN_VAL := 'TRUE';
                            VC_PAR_COMMENTS := 'PARTIAL AOE AVAILABLE FOR DUPLICATE PATIENT';
                        END IF;--<<case_3_and_4>>
                        VN_DUPL_PAT_ID := PAT_ID_REC.PATIENT_ID;
                        SPL_SPN_ERROR_LOGGING_SPK.INFO_PROC
                                  (IC_PACKAGE_NAME    => 'SPL_SPN_MISSING_EMR_AOE_DTL'
                                  ,IC_PROCEDURE_NAME    => 'SPL_SPN_MISSING_EMR_AOE_DTL'
                                  ,IN_BATCH_ID        => '100'
                                  ,IC_MESSAGE_TEXT    => 'vc_dup_pat_ques:'||VC_DUP_PAT_QUES||
                                                         ' vn_dup_pat_ques_cnt:'||VN_DUP_PAT_QUES_CNT||
                                                         ' VC_COMMENTS:'||VC_COMMENTS||
                                                         ' VC_PAR_COMMENTS:'||VC_PAR_COMMENTS);
                    END LOOP DUPL_PAT_LOOP;
                    VC_CHK_FOR_EXT_ID := 'Y';
                    IF
                      VC_CHK_FOR_EXT_ID = 'Y' THEN
                      <<EXTERNAL_ID_LOOP>>
                      FOR P_PAT_EXT_ID_REC IN (SELECT DISTINCT P.EXTERNAL_ID
                                                 FROM PATIENT P
                                                WHERE P.ABCDEF_MRN = IN_ABCDEF_MRN
                                                  AND P.EXTERNAL_ID IS NOT NULL)
                      LOOP 
                          INSERT INTO TT_A04_OBX_QUES_ANS_DTL
                          (SELECT IAOBX.MSG_ID, IAOBX.OBSERVATION_IDENTIFIER, IAOBX.OBSERVATION_VALUE, IAM.UOM
                            FROM INTERFACE_A04_OBX_SEGMENT IAOBX, INTERFACE_ADT_AOE_MASTER IAM
                            WHERE IAOBX.OBSERVATION_IDENTIFIER = IAM.QUESTION_CODE
                            AND   (IAOBX.OBSERVATION_DTM  = TO_CHAR(IN_DRAW_DT,'YYYYMMDD')
                                OR IAOBX.OBSERVATION_DTM = TO_CHAR(TO_DATE('2999/12/31','YYYY/MM/DD'),'YYYYMMDD'))
                            AND   IAOBX.MSG_ID IN (SELECT IPID.MSG_ID
                                                     FROM   INTERFACE_A04_PID_SEGMENT IPID
                                                    WHERE   IPID.PATIENT_ID_EXTERNAL  = P_PAT_EXT_ID_REC.EXTERNAL_ID
                                                      AND   IPID.MSG_ID IN (SELECT IMSH.MSG_ID
                                                                             FROM  INTERFACE_A04_MSH_SEGMENT IMSH
                                                                             WHERE (TRIM('W' FROM SUBSTR(IMSH.SENDING_FACILITY,5,LENGTH(IMSH.SENDING_FACILITY))) = IN_ACCOUNT_NUMBER
                                                                                 OR SUBSTR(IMSH.SENDING_FACILITY,2,LENGTH(IMSH.SENDING_FACILITY))    = IN_HLAB_NUM))));
                          BEGIN
                            SELECT STRAGG(SUB3.OBSERVATION_IDENTIFIER), COUNT(OBSERVATION_IDENTIFIER)
                            INTO VC_OBX_QUES, VC_OBX_QUES_CNT
                            FROM (SELECT DISTINCT OBSERVATION_IDENTIFIER
                                  FROM TT_A04_OBX_QUES_ANS_DTL
                                  ORDER BY OBSERVATION_IDENTIFIER)SUB3;
                             IF
                                VC_OBX_QUES = VC_ACTUAL_QUES THEN
                                VC_COMMENTS := 'AOE RECEIVED IN A REJECTED ADT';
                                VC_REJECTED_BOOLEAN_VAL := 'TRUE';
                             ELSIF
                                VC_OBX_QUES != VC_ACTUAL_QUES AND
                                VC_OBX_QUES_CNT > 0 THEN
                                VC_PAR_COMMENTS := 'PARTIAL AOE RECEIVED IN A REJECTED ADT';
                                VC_REJECTED_PAR_BOOLEAN_VAL := 'TRUE';
                             END IF;
                            VN_EXTERNAL_ID := P_PAT_EXT_ID_REC.EXTERNAL_ID;
                        EXCEPTION
                          WHEN NO_DATA_FOUND THEN
                            VC_REJECTED_BOOLEAN_VAL := 'FALSE';
                            VC_REJECTED_PAR_BOOLEAN_VAL := 'FALSE';
                        END;
                         SPL_SPN_ERROR_LOGGING_SPK.INFO_PROC
                                    (IC_PACKAGE_NAME    => 'SPL_SPN_MISSING_EMR_AOE_DTL'
                                    ,IC_PROCEDURE_NAME    => 'SPL_SPN_MISSING_EMR_AOE_DTL'
                                    ,IN_BATCH_ID        => '100'
                                    ,IC_MESSAGE_TEXT    => 'vc_obx_ques:'||VC_OBX_QUES||
                                                           ' vc_obx_ques_cnt:'||VC_OBX_QUES_CNT);
                      END LOOP EXTERNAL_ID_LOOP;
                    END IF;
                END IF;--<<Main_if_block>>
          END LOOP AOE_TEST_LOOP;
      --Returning output as per the execution result.
      IF
         VC_EXACT_BOOLEAN_VAL = 'TRUE' AND
         VC_EXACT_PAR_BOOLEAN_VAL = 'FALSE' THEN
         OV_COMMENTS := VC_COMMENTS;
         VC_DUPL_BOOLEAN_VAL         := NULL;
         VC_DUPL_PAR_BOOLEAN_VAL     := NULL;
         VC_REJECTED_BOOLEAN_VAL     := NULL;
         VC_REJECTED_PAR_BOOLEAN_VAL := NULL;
         VC_RETURN_EXACT_PAT := 'Y';
      ELSIF
         --VC_EXACT_BOOLEAN_VAL = 'TRUE' AND
         VC_EXACT_PAR_BOOLEAN_VAL = 'TRUE' THEN
         OV_COMMENTS := VC_PAR_COMMENTS;
         VC_DUPL_BOOLEAN_VAL         := NULL;
         VC_DUPL_PAR_BOOLEAN_VAL     := NULL;
         VC_REJECTED_BOOLEAN_VAL     := NULL;
         VC_REJECTED_PAR_BOOLEAN_VAL := NULL;
         VC_RETURN_EXACT_PAT := 'Y';
      END IF;
      IF
        VC_RETURN_EXACT_PAT = 'Y' THEN
        --Returning result set (OV_COMMENTS,Question and Answer) for the exact patient.(Case 1 (AOE) and 2 (PARTIAL AOE))
        SELECT MAX (SUB.COUNT_QUES_ANS)
        INTO VN_MAX_COUNT FROM (SELECT COUNT(*) OVER (PARTITION BY EAD.QUESTION_CODE, EAD.ANSWER) AS COUNT_QUES_ANS
                                FROM  EMR_ADTAOE_DTL EAD , INTERFACE_ADT_AOE_MASTER IAM, TEST T
                                WHERE T.TEST_ID = EAD.TEST_ID
                                AND   IAM.TEST_CODE = T.TEST_CODE
                                AND   EAD.SOURCE_SYSTEM = IAM.SOURCE_SYSTEM
                                AND   EAD.QUESTION_CODE = IAM.QUESTION_CODE
                                AND   EAD.PATIENT_ID    = IN_PATIENT_ID
                                AND   EAD.FACILITY_ID   = IN_FACILITY_ID
                                AND   (TRUNC(EAD.DRAW_DATE)   = IN_DRAW_DT
                                      OR TRUNC(EAD.DRAW_DATE) = TRUNC(TO_DATE('12-31-2999','mm-dd-yyyy')))
                                AND   EAD.SOURCE_SYSTEM = IN_REQUISITION_NUMBER) SUB;
         IF
            VN_MAX_COUNT > 1 THEN
            SPL_SPN_ERROR_LOGGING_SPK.INFO_PROC
                                    (IC_PACKAGE_NAME    => 'SPL_SPN_MISSING_EMR_AOE_DTL'
                                    ,IC_PROCEDURE_NAME  => 'SPL_SPN_MISSING_EMR_AOE_DTL'
                                    ,IN_BATCH_ID        => '100'
                                    ,IC_MESSAGE_TEXT    => 'exact patient duplicate scenario'||' vn_max_count:'||VN_MAX_COUNT);
            OPEN VR_QUES_AND_ANS FOR                                 
            SELECT DISTINCT IAM.QUESTION_CODE,
                  (SELECT DISTINCT CASE
                                   WHEN EAD.ANSWER IS NULL THEN NULL
                                   WHEN LENGTH(TRIM(TRANSLATE(EAD.ANSWER, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', ' '))) IS NULL THEN EAD.ANSWER
                                   ELSE TO_CHAR(TRUNC(EAD.ANSWER *  DECODE(UPPER(IAM.UOM), 'KGS', 2.20462,1),2))
                                   END
                    FROM  EMR_ADTAOE_DTL EAD , TEST T
                    WHERE T.TEST_ID = EAD.TEST_ID
                    AND   IAM.TEST_CODE = T.TEST_CODE
                    AND   EAD.SOURCE_SYSTEM = IAM.SOURCE_SYSTEM
                    AND   EAD.QUESTION_CODE = IAM.QUESTION_CODE
                    AND   EAD.PATIENT_ID    = IN_PATIENT_ID
                    AND   EAD.FACILITY_ID   = IN_FACILITY_ID
                    AND   (TRUNC(EAD.DRAW_DATE)    = IN_DRAW_DT
                            OR TRUNC(EAD.DRAW_DATE) = TRUNC(TO_DATE('12-31-2999','mm-dd-yyyy')))
                    AND   EAD.SOURCE_SYSTEM = IN_CORP_ACRONYM
                    AND   EAD.ANSWER IS NOT NULL
                    AND   EAD.STATUS = DECODE(IAM.MATCH_TYPE, 'AT', EAD.STATUS, 'N')
                    ) AS ANSWER
            FROM INTERFACE_ADT_AOE_MASTER IAM
            WHERE IAM.SOURCE_SYSTEM = IN_CORP_ACRONYM
            AND IAM.TEST_CODE IN  (SELECT ORD.TEST_CODE
                                     FROM ORDER_REQUISITION_DETAIL ORD
                                    WHERE ORD.REQUISITION_HDR_ID = (SELECT ORH.REQUISITION_HDR_ID
                                                                      FROM ORDER_REQUISITION_HEADER ORH
                                                                     WHERE ORH.REQUISITION_NUMBER = IN_REQUISITION_NUMBER)   
                                    AND EXISTS (SELECT 1 FROM EMR_ADTAOE_DTL EAD1, INTERFACE_ADT_AOE_MASTER IAM1, TEST T1
                                                 WHERE  ORD.TEST_ID = EAD1.TEST_ID
                                                  AND   IAM1.TEST_CODE = T1.TEST_CODE
                                                  AND   EAD1.SOURCE_SYSTEM = IAM1.SOURCE_SYSTEM
                                                  AND   EAD1.QUESTION_CODE = IAM1.QUESTION_CODE
                                                  AND   EAD1.PATIENT_ID    = IN_PATIENT_ID
                                                  AND   EAD1.FACILITY_ID   = IN_FACILITY_ID
                                                  AND   (TRUNC(EAD1.DRAW_DATE)    = IN_DRAW_DT
                                                        OR TRUNC(EAD1.DRAW_DATE) = TRUNC(TO_DATE('12-31-2999','mm-dd-yyyy')))
                                                  AND   EAD1.SOURCE_SYSTEM = IN_CORP_ACRONYM
                                                  AND   EAD1.ANSWER IS NOT NULL
                                                  AND   EAD1.STATUS = DECODE(IAM1.MATCH_TYPE, 'AT', EAD1.STATUS, 'N')));
         ELSIF
           VN_MAX_COUNT = 1 THEN
           SPL_SPN_ERROR_LOGGING_SPK.INFO_PROC
                                    (IC_PACKAGE_NAME    => 'SPL_SPN_MISSING_EMR_AOE_DTL'
                                    ,IC_PROCEDURE_NAME  => 'SPL_SPN_MISSING_EMR_AOE_DTL'
                                    ,IN_BATCH_ID        => '100'
                                    ,IC_MESSAGE_TEXT    => 'exact patient unique scenario'||' vn_max_count:'||VN_MAX_COUNT);
           OPEN VR_QUES_AND_ANS FOR                                 
           SELECT DISTINCT IAM.QUESTION_CODE,
                  (SELECT DISTINCT CASE
                                   WHEN EAD.ANSWER IS NULL THEN NULL
                                   WHEN LENGTH(TRIM(TRANSLATE(EAD.ANSWER, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', ' '))) IS NULL THEN EAD.ANSWER
                                   ELSE TO_CHAR(TRUNC(EAD.ANSWER *  DECODE(UPPER(IAM.UOM), 'KGS', 2.20462,1),2))
                                   END
                    FROM  EMR_ADTAOE_DTL EAD , TEST T
                    WHERE T.TEST_ID = EAD.TEST_ID
                    AND   IAM.TEST_CODE = T.TEST_CODE
                    AND   EAD.SOURCE_SYSTEM = IAM.SOURCE_SYSTEM
                    AND   EAD.QUESTION_CODE = IAM.QUESTION_CODE
                    AND   EAD.PATIENT_ID    = IN_PATIENT_ID
                    AND   EAD.FACILITY_ID   = IN_FACILITY_ID
                    AND   (TRUNC(EAD.DRAW_DATE)    = IN_DRAW_DT
                            OR TRUNC(EAD.DRAW_DATE) = TRUNC(TO_DATE('12-31-2999','mm-dd-yyyy')))
                    AND   EAD.SOURCE_SYSTEM = IN_CORP_ACRONYM
                    AND   EAD.ANSWER IS NOT NULL
                    AND   EAD.STATUS = DECODE(IAM.MATCH_TYPE, 'AT', EAD.STATUS, 'N')
                    ) AS ANSWER
            FROM INTERFACE_ADT_AOE_MASTER IAM
            WHERE IAM.SOURCE_SYSTEM = IN_CORP_ACRONYM
            AND IAM.TEST_CODE IN  (SELECT ORD.TEST_CODE
                                     FROM ORDER_REQUISITION_DETAIL ORD
                                    WHERE ORD.REQUISITION_HDR_ID = (SELECT ORH.REQUISITION_HDR_ID
                                                                      FROM ORDER_REQUISITION_HEADER ORH
                                                                     WHERE ORH.REQUISITION_NUMBER = IN_REQUISITION_NUMBER));
         END IF;                           
         OR_QUES_AND_ANS := VR_QUES_AND_ANS;
        SPL_SPN_ERROR_LOGGING_SPK.INFO_PROC
                      (IC_PACKAGE_NAME    => 'SPL_SPN_MISSING_EMR_AOE_DTL'
                      ,IC_PROCEDURE_NAME  => 'SPL_SPN_MISSING_EMR_AOE_DTL'
                      ,IN_BATCH_ID        => '100'
                      ,IC_MESSAGE_TEXT    => 'vc_exact_boolean_val:'||VC_EXACT_BOOLEAN_VAL||
                                             ' vc_exact_par_boolean_val:'||VC_EXACT_PAR_BOOLEAN_VAL||
                                             ' OV_COMMENTS:'||OV_COMMENTS);
      END IF;               
      IF
          VC_DUPL_BOOLEAN_VAL = 'TRUE' AND
          VC_DUPL_PAR_BOOLEAN_VAL = 'FALSE' THEN
          OV_COMMENTS := VC_COMMENTS;
          VC_EXACT_BOOLEAN_VAL        := NULL;
          VC_EXACT_PAR_BOOLEAN_VAL    := NULL;
          VC_REJECTED_BOOLEAN_VAL     := NULL;
          VC_REJECTED_PAR_BOOLEAN_VAL := NULL;
          VC_RETURN_DUPL_PAT := 'Y';
      ELSIF
         --VC_DUPL_BOOLEAN_VAL = 'TRUE' AND
         VC_DUPL_PAR_BOOLEAN_VAL = 'TRUE' THEN
         OV_COMMENTS := VC_PAR_COMMENTS;
         VC_EXACT_BOOLEAN_VAL        := NULL;
         VC_EXACT_PAR_BOOLEAN_VAL    := NULL;
         VC_REJECTED_BOOLEAN_VAL     := NULL;
         VC_REJECTED_PAR_BOOLEAN_VAL := NULL;
         VC_RETURN_DUPL_PAT := 'Y';
      END IF;
      IF
        VC_RETURN_DUPL_PAT = 'Y' THEN
        --Returning result set (OV_COMMENTS,Question and Answer) for the duplicate patient.(Case 3 (AOE) and 4 (PARTIAL AOE))
        SELECT MAX (SUB.COUNT_QUES_ANS)
        INTO VN_MAX_COUNT FROM (SELECT COUNT(*) OVER (PARTITION BY EAD.QUESTION_CODE, EAD.ANSWER) AS COUNT_QUES_ANS
                                FROM  EMR_ADTAOE_DTL EAD , INTERFACE_ADT_AOE_MASTER IAM, TEST T
                                WHERE T.TEST_ID = EAD.TEST_ID
                                AND   IAM.TEST_CODE = T.TEST_CODE
                                AND   EAD.SOURCE_SYSTEM = IAM.SOURCE_SYSTEM
                                AND   EAD.QUESTION_CODE = IAM.QUESTION_CODE
                                AND   EAD.PATIENT_ID    = VN_DUPL_PAT_ID
                                AND   EAD.FACILITY_ID   = IN_FACILITY_ID
                                AND   (TRUNC(EAD.DRAW_DATE)   = IN_DRAW_DT
                                      OR TRUNC(EAD.DRAW_DATE) = TRUNC(TO_DATE('12-31-2999','mm-dd-yyyy')))
                                AND   EAD.SOURCE_SYSTEM = IN_REQUISITION_NUMBER) SUB;
         IF
            VN_MAX_COUNT > 1 THEN
            SPL_SPN_ERROR_LOGGING_SPK.INFO_PROC
                                    (IC_PACKAGE_NAME    => 'SPL_SPN_MISSING_EMR_AOE_DTL'
                                    ,IC_PROCEDURE_NAME  => 'SPL_SPN_MISSING_EMR_AOE_DTL'
                                    ,IN_BATCH_ID        => '100'
                                    ,IC_MESSAGE_TEXT    => 'duplicate patient duplicate scenario'||' vn_max_count:'||VN_MAX_COUNT);
            OPEN VR_QUES_AND_ANS FOR                                 
            SELECT DISTINCT IAM.QUESTION_CODE,
                  (SELECT DISTINCT CASE
                                   WHEN EAD.ANSWER IS NULL THEN NULL
                                   WHEN LENGTH(TRIM(TRANSLATE(EAD.ANSWER, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', ' '))) IS NULL THEN EAD.ANSWER
                                   ELSE TO_CHAR(TRUNC(EAD.ANSWER *  DECODE(UPPER(IAM.UOM), 'KGS', 2.20462,1),2))
                                   END
                    FROM  EMR_ADTAOE_DTL EAD , TEST T
                    WHERE T.TEST_ID = EAD.TEST_ID
                    AND   IAM.TEST_CODE = T.TEST_CODE
                    AND   EAD.SOURCE_SYSTEM = IAM.SOURCE_SYSTEM
                    AND   EAD.QUESTION_CODE = IAM.QUESTION_CODE
                    AND   EAD.PATIENT_ID    = VN_DUPL_PAT_ID
                    AND   EAD.FACILITY_ID   = IN_FACILITY_ID
                    AND   (TRUNC(EAD.DRAW_DATE)    = IN_DRAW_DT
                            OR TRUNC(EAD.DRAW_DATE) = TRUNC(TO_DATE('12-31-2999','mm-dd-yyyy')))
                    AND   EAD.SOURCE_SYSTEM = IN_CORP_ACRONYM
                    AND   EAD.ANSWER IS NOT NULL
                    AND   EAD.STATUS = DECODE(IAM.MATCH_TYPE, 'AT', EAD.STATUS, 'N')
                    ) AS ANSWER
            FROM INTERFACE_ADT_AOE_MASTER IAM
            WHERE IAM.SOURCE_SYSTEM = IN_CORP_ACRONYM
            AND IAM.TEST_CODE IN  (SELECT ORD.TEST_CODE
                                     FROM ORDER_REQUISITION_DETAIL ORD
                                    WHERE ORD.REQUISITION_HDR_ID = (SELECT ORH.REQUISITION_HDR_ID
                                                                      FROM ORDER_REQUISITION_HEADER ORH
                                                                     WHERE ORH.REQUISITION_NUMBER = IN_REQUISITION_NUMBER)   
                                    AND EXISTS (SELECT 1 FROM EMR_ADTAOE_DTL EAD1, INTERFACE_ADT_AOE_MASTER IAM1, TEST T1
                                                 WHERE  ORD.TEST_ID = EAD1.TEST_ID
                                                  AND   IAM1.TEST_CODE = T1.TEST_CODE
                                                  AND   EAD1.SOURCE_SYSTEM = IAM1.SOURCE_SYSTEM
                                                  AND   EAD1.QUESTION_CODE = IAM1.QUESTION_CODE
                                                  AND   EAD1.PATIENT_ID    = VN_DUPL_PAT_ID
                                                  AND   EAD1.FACILITY_ID   = IN_FACILITY_ID
                                                  AND   (TRUNC(EAD1.DRAW_DATE)    = IN_DRAW_DT
                                                        OR TRUNC(EAD1.DRAW_DATE) = TRUNC(TO_DATE('12-31-2999','mm-dd-yyyy')))
                                                  AND   EAD1.SOURCE_SYSTEM = IN_CORP_ACRONYM
                                                  AND   EAD1.ANSWER IS NOT NULL
                                                  AND   EAD1.STATUS = DECODE(IAM1.MATCH_TYPE, 'AT', EAD1.STATUS, 'N')));
         ELSIF
           VN_MAX_COUNT = 1 THEN
            SPL_SPN_ERROR_LOGGING_SPK.INFO_PROC
                                    (IC_PACKAGE_NAME    => 'SPL_SPN_MISSING_EMR_AOE_DTL'
                                    ,IC_PROCEDURE_NAME  => 'SPL_SPN_MISSING_EMR_AOE_DTL'
                                    ,IN_BATCH_ID        => '100'
                                    ,IC_MESSAGE_TEXT    => 'duplicate patient unique scenario'||' vn_max_count:'||VN_MAX_COUNT);
            OPEN VR_QUES_AND_ANS FOR                                 
            SELECT DISTINCT IAM.QUESTION_CODE,
                  (SELECT DISTINCT CASE
                                   WHEN EAD.ANSWER IS NULL THEN NULL
                                   WHEN LENGTH(TRIM(TRANSLATE(EAD.ANSWER, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', ' '))) IS NULL THEN EAD.ANSWER
                                   ELSE TO_CHAR(TRUNC(EAD.ANSWER *  DECODE(UPPER(IAM.UOM), 'KGS', 2.20462,1),2))
                                   END
                    FROM  EMR_ADTAOE_DTL EAD , TEST T
                    WHERE T.TEST_ID = EAD.TEST_ID
                    AND   IAM.TEST_CODE = T.TEST_CODE
                    AND   EAD.SOURCE_SYSTEM = IAM.SOURCE_SYSTEM
                    AND   EAD.QUESTION_CODE = IAM.QUESTION_CODE
                    AND   EAD.PATIENT_ID    = VN_DUPL_PAT_ID
                    AND   EAD.FACILITY_ID   = IN_FACILITY_ID
                    AND   (TRUNC(EAD.DRAW_DATE)    = IN_DRAW_DT
                            OR TRUNC(EAD.DRAW_DATE) = TRUNC(TO_DATE('12-31-2999','mm-dd-yyyy')))
                    AND   EAD.SOURCE_SYSTEM = IN_CORP_ACRONYM
                    AND   EAD.ANSWER IS NOT NULL
                    AND   EAD.STATUS = DECODE(IAM.MATCH_TYPE, 'AT', EAD.STATUS, 'N')
                    ) AS ANSWER
            FROM INTERFACE_ADT_AOE_MASTER IAM
            WHERE IAM.SOURCE_SYSTEM = IN_CORP_ACRONYM
            AND IAM.TEST_CODE IN  (SELECT ORD.TEST_CODE
                                     FROM ORDER_REQUISITION_DETAIL ORD
                                    WHERE ORD.REQUISITION_HDR_ID = (SELECT ORH.REQUISITION_HDR_ID
                                                                      FROM ORDER_REQUISITION_HEADER ORH
                                                                     WHERE ORH.REQUISITION_NUMBER = IN_REQUISITION_NUMBER));
         END IF; 
        OR_QUES_AND_ANS := VR_QUES_AND_ANS;
        SPL_SPN_ERROR_LOGGING_SPK.INFO_PROC
                      (IC_PACKAGE_NAME    => 'SPL_SPN_MISSING_EMR_AOE_DTL'
                      ,IC_PROCEDURE_NAME  => 'SPL_SPN_MISSING_EMR_AOE_DTL'
                      ,IN_BATCH_ID        => '100'
                      ,IC_MESSAGE_TEXT    => 'vc_dup_pat_ques:'||VC_DUP_PAT_QUES||
                                             ' vc_dupl_boolean_val:'||VC_DUPL_BOOLEAN_VAL||
                                             ' vc_dupl_par_boolean_val:'||VC_DUPL_PAR_BOOLEAN_VAL||
                                             ' OV_COMMENTS:'||OV_COMMENTS);
      END IF;               
      IF
         VC_REJECTED_BOOLEAN_VAL = 'TRUE' AND
         VC_REJECTED_PAR_BOOLEAN_VAL = 'FALSE' THEN
         OV_COMMENTS := VC_COMMENTS;
         VC_EXACT_BOOLEAN_VAL        := NULL;
         VC_EXACT_PAR_BOOLEAN_VAL    := NULL;
         VC_DUPL_BOOLEAN_VAL         := NULL;
         VC_DUPL_PAR_BOOLEAN_VAL     := NULL;
         VC_RETURN_REJECT_PAT := 'Y';
      ELSIF
         --VC_REJECTED_BOOLEAN_VAL = 'FALSE' AND
         VC_REJECTED_PAR_BOOLEAN_VAL = 'TRUE' THEN
         OV_COMMENTS := VC_PAR_COMMENTS;
         VC_EXACT_BOOLEAN_VAL        := NULL;
         VC_EXACT_PAR_BOOLEAN_VAL    := NULL;
         VC_DUPL_BOOLEAN_VAL         := NULL;
         VC_DUPL_PAR_BOOLEAN_VAL     := NULL;
         VC_RETURN_REJECT_PAT := 'Y';
      ELSIF
         VC_REJECTED_BOOLEAN_VAL = 'FALSE' AND
         VC_REJECTED_PAR_BOOLEAN_VAL = 'FALSE' THEN
         --Returning result set (OV_COMMENTS) for the rejected ADT.(Case 7)
         OV_COMMENTS := 'AOE NOT RECEIVED IN ADT';
         OR_QUES_AND_ANS := NULL;
         SPL_SPN_ERROR_LOGGING_SPK.INFO_PROC
                        (IC_PACKAGE_NAME    => 'SPL_SPN_MISSING_EMR_AOE_DTL'
                        ,IC_PROCEDURE_NAME  => 'SPL_SPN_MISSING_EMR_AOE_DTL'
                        ,IN_BATCH_ID        => '100'
                        ,IC_MESSAGE_TEXT    => 'vc_obx_ques:'||VC_OBX_QUES||
                                               ' vc_rejected_boolean_val:'||VC_REJECTED_BOOLEAN_VAL||
                                               ' vc_rejected_par_boolean_val:'||VC_REJECTED_PAR_BOOLEAN_VAL||
                                               ' OV_COMMENTS:'||OV_COMMENTS);
         VC_EXACT_BOOLEAN_VAL        := NULL;
         VC_EXACT_PAR_BOOLEAN_VAL    := NULL;
         VC_DUPL_BOOLEAN_VAL         := NULL;
         VC_DUPL_PAR_BOOLEAN_VAL     := NULL;
      END IF;
      IF
        VC_RETURN_REJECT_PAT = 'Y' THEN
        --Returning result set (OV_COMMENTS,Question and Answer) for the rejected ADT.(Case 5 (AOE) and 6 (PARTIAL AOE))
        --In case of multiple external id with same patient, facility and draw date; the lastest record should be picked.
        SELECT MAX(MSG_ID) INTO VN_MAX_MSG_ID FROM TT_A04_OBX_QUES_ANS_DTL;
        OPEN VR_QUES_AND_ANS FOR
        SELECT DISTINCT IAM.QUESTION_CODE,
                       (SELECT DISTINCT
                         CASE
                            WHEN TOBX.OBSERVATION_VALUE IS NULL THEN NULL
                            WHEN LENGTH(TRIM(TRANSLATE(TOBX.OBSERVATION_VALUE, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', ' '))) IS NULL THEN TOBX.OBSERVATION_VALUE
                            ELSE TO_CHAR(TRUNC(TOBX.OBSERVATION_VALUE *  DECODE(UPPER(TOBX.UOM), 'KGS', 2.20462,1),2))
                         END
                         FROM TT_A04_OBX_QUES_ANS_DTL TOBX
                        WHERE TOBX.OBSERVATION_IDENTIFIER = IAM.QUESTION_CODE
                          AND TOBX.MSG_ID = VN_MAX_MSG_ID) AS ANSWER
         FROM INTERFACE_ADT_AOE_MASTER IAM
        WHERE SOURCE_SYSTEM = IN_CORP_ACRONYM;
        OR_QUES_AND_ANS := VR_QUES_AND_ANS;
        SPL_SPN_ERROR_LOGGING_SPK.INFO_PROC
                        (IC_PACKAGE_NAME    => 'SPL_SPN_MISSING_EMR_AOE_DTL'
                        ,IC_PROCEDURE_NAME  => 'SPL_SPN_MISSING_EMR_AOE_DTL'
                        ,IN_BATCH_ID        => '100'
                        ,IC_MESSAGE_TEXT    => 'vc_rejected_boolean_val:'||VC_REJECTED_BOOLEAN_VAL||
                                               ' vc_rejected_par_boolean_val:'||VC_REJECTED_PAR_BOOLEAN_VAL||
                                               ' OV_COMMENTS:'||OV_COMMENTS);
      END IF;
       SPL_SPN_ERROR_LOGGING_SPK.INFO_PROC
                        (IC_PACKAGE_NAME    => 'SPL_SPN_MISSING_EMR_AOE_DTL'
                        ,IC_PROCEDURE_NAME  => 'SPL_SPN_MISSING_EMR_AOE_DTL'
                        ,IN_BATCH_ID        => '100'
                        ,IC_MESSAGE_TEXT    => 'End of the procedure with Patient_Id:'||IN_PATIENT_ID||' Facility_Id:'||IN_FACILITY_ID||
                                               ' Draw_Dt:'||IN_DRAW_DT||' Requisition_Number:'||IN_REQUISITION_NUMBER||' Corp_Acronym:'||IN_CORP_ACRONYM||
                                               ' ABCDEF_Mrn:'||IN_ABCDEF_MRN||' Account_Number:'||IN_ACCOUNT_NUMBER||' Hlab_Num:'||IN_HLAB_NUM);
    EXCEPTION
      WHEN NO_DATA_FOUND THEN
        SPL_SPN_ERROR_LOGGING_SPK.ERROR_PROC
                        (IC_PACKAGE_NAME    => 'SPL_SPN_MISSING_EMR_AOE_DTL'
                        ,IC_PROCEDURE_NAME  => 'SPL_SPN_MISSING_EMR_AOE_DTL'
                        ,IN_BATCH_ID        => '100'
                        ,IC_MESSAGE_TEXT    => SQLERRM);
      WHEN OTHERS THEN
        SPL_SPN_ERROR_LOGGING_SPK.ERROR_PROC
                        (IC_PACKAGE_NAME    => 'SPL_SPN_MISSING_EMR_AOE_DTL'
                        ,IC_PROCEDURE_NAME  => 'SPL_SPN_MISSING_EMR_AOE_DTL'
                        ,IN_BATCH_ID        => '100'
                        ,IC_MESSAGE_TEXT    => SQLERRM);
    END SPL_SPN_MISSING_EMR_AOE_DTL;
    Regards,
    BS2012.

    Hey Guys,
    I'm sorry, that I troubled you all. But I found the issue and solved it.
    The actual problem is residing at that max of that partition by query. I had a misconception that this query will always return a value which is positive number like 1,2 etc.
    But sometimes it's returning null as well. So the ref cursor is fetching nothing. Now I've modified my code and everything is working fine. Thanks for your help and support.
    Regards,
    BS2012.

  • Hi can any prepare TS for the FS ?ITS URGENT

    1.0     Functional Spec Header
    1.1     Business Requirement
    The management structure for reporting is currently maintained in Hyperion by the Financial Analysis and Planning group.  This management structure is critical throughout Cessna for managing the business.  The interface is needed to download the management structure hierarchy from Hyperion and load to SAP as a cost center group.
    1.2     Purpose/Objectives/Reason for Need
    The purpose of this interface is to ensure the management structure in SAP remains in sync with the management structure in Hyperion.  This interface will eliminate the need for manual changes to both Hyperion and SAP and also reduces the chance for error to occur when both systems are updated.  This interface will save time when making changes to the management structure.
    There is no record retention requirement for the management structure in Hyperion.
    1.3     Assumptions
    The management structure for reporting will managed by Financial Analysis and Planning and a process will be in place to coordinate changes to the structure.  This interface will be run automatically daily.
    1.4     Alternatives
    If the interface doesn’t exist, then changes to the management structure in Hyperion and SAP will have to be done separately and manually in both systems.  This will increase the chance of error that could result in the management structure being different in Hyperion and SAP causing confusion and unnecessary reconciliations.
    1.5     Similar FRICE Item
    None found
    2.0     Security Requirements
    2.1     User profiles allowed to use this development
    N/A
    It is not known at this time what role this transaction will reside.  Financial Analysis and Planning will be responsible for maintaining the management structure in Hyperion but Finance management has not decided what Finance group will be responsible for the upload into SAP.
    2.2     Authorizations Included
    Controlling Area = 1000
    Access granted to project team.
    There are standard transactions available to view and maintain cost center groups in SAP.  This ability to change groups will be restricted to a small group of people.  Many users will be able to display the structure and use it in reporting.
    This is not ITAR sensitive data.
    [Below the transaction level, what auth objects should this development be controlled by?  (plant, company code, etc.)]
    3.0     Functional Requirements
    3.1     Report/Form
    3.1.1     Input
    [Electronic picture(s) of selection screen and screen flow including success/error messages, icons, colors.]
    3.1.2     Processing
    [Electronic text and picture of processing steps, including if/case logic, authority checks and runtime issues.  A good way to show this is with flow charts or dummied up screen shots, including arrows and text to tell the story.]
    3.1.3     Output
    [Electronic picture of desired output, including sort, totals, hotspots, drill-down and other functionality like ALV.]
    3.1.4     Example Data
    [Demo of example data moving thru each step of processing, including usual, exception and error cases.]
    3.2     Enhancement/Modification
    3.2.1     Input/New Screens
    [Electronic picture(s) of input and/or new screen(s) and screen flow including success/error messages, icons, colors.]
    3.2.2     Processing
    [Electronic text and picture of both current and requested processing steps, including if/case logic, authority checks and runtime issues.  A good way to show this is with flow charts or dummied up screen shots, including arrows and text to tell the story.]
    3.2.3     Expected Results
    [Data to be created/updated/deleted.]
    3.2.4     Example Data
    [Demo of example data moving thru each step of processing, including usual, exception and error cases.]
    3.3     Interface/Conversion
    3.3.1     Source
    The source data for the management structure is maintained in Hyperion.  Currently, the management structure data is extracted from Hyperion using a XML file.  A XML file can be utilized to upload the structure into SAP as cost center groups.  John Shelton (phone 316-517-4260) and Mike LaBarge (phone 316-517-3887) are the SME’s for the Hyperion management structure.  The file will be stored in a format and location so the interface in SAP can run to check for the file.  If an updated file is found the interface will execute and update SAP.  If no file or an old file is found, the interface will not execute.
    [Electronic text and picture of source system as it pertains to requested interface/conversion, including details.]
    3.3.2     Translation
    The entire management structure hierarchy should be loaded into SAP overwriting whatever previously existed in the cost center groups.  The cost center group should contain all active cost centers.  There are additional alias fields in Hyperion which can be populated with the cost center group name.  The field length for cost center groups in SAP is 10 and group name will always start with CM_. This can also be downloaded to excel in addition to the management level name with will become the cost center group description field in SAP.  Management levels 3, 4, and 5 in Hyperion will be loaded as cost center groups in SAP.  There is a relationship between each of these management levels: 
    Hierarchy for Management Structure:
               Management Level 3
                         Management Level 4
                                  Management Level 5
    Level 3 is the top level. Level 4 is linked to 3 and level 5 is linked to 4. 
    An email should be automatically generated when the update has run and should be sent to the assigned Finance group responsible for the SAP management structure regardless of error status.
    [Electronic text and picture of translation steps, including if/case logic, authority checks and runtime issues.  A good way to show this is with flow charts or dummied up screen shots, including arrows and text to tell the story.]
    3.3.3     Target
    Daily the interface should check for a file to upload to SAP.  If no file or an existing file is found, the interface will stop processing.  If a new file is found the interface should execute and update the cost center group in SAP.  The cost center group name will not change (CM_MGTHIER).  The new file should overwrite the existing hierarchy in SAP.  This cost center group should contain all active cost centers in SAP and no cost center can appear more then once in the structure.  To validate this logic a completeness and ambiguity check should be completed after the management structure is loaded into SAP. 
    The completeness check in SAP is a feature in the standard transaction that will check all the cost centers assigned to the group against the active cost centers in master data table in SAP, (Table CSKS, Field KOSTL).
    The ambiguity check is a feature in the standard transaction that will check for duplicate records in the hierarchy.   This could be either the group name, or the cost center value.  It returns a report of the results and the user can manually adjust the cost center group to remove the ambiguity inconsistencies.  This program should be used when the interface loads a new management cost center group.  The hierarchy structure will need to be locked while the update is running.
    The function module K_HIERARCHY_TABLES_READ in SAP maintains the parent / child relationships of cost center groups, sub-groups, and cost centers.  This functional module can be utilized when loading the hierarchy data from the Hyperion extract file. 
    There are also a few BAPI’s available for loading the hierarchy;
    BAPI_COSTCENTERGROUP_ADDNODE
    BAPI_COSTCENTERGROUP_CREATE
    BAPI_COSTCENTERGROUP_GETDETAIL
    BAPI_COSTCENTERGROUP_GETLIST
    The following IDOC’s  can also be used for loading the hierarchy;
    IDOC_INPUT_COSTCENTERGROUP_ADD
    IDOC_INPUT_COSTCENTERGROUP_CRE
    The technical decision for how to load the hierarchy will come from the technical team.  The Functional Modules, BAPI’s, and IDOC’s mentioned above are for reference and can evaluated during the development of the technical spec.
    Example of SAP Cost Center Group Hierarchy:
    Ambiguity and Completeness Check:
    Transaction code KSH1.  Enter cost center group name in field and follow menu path: extras> check and help functions
    [Electronic text and picture of target system as it pertains to requested interface/conversion, including details.]
    3.3.4     Example Data
    [Demo of example data moving thru each step of processing, including usual, exception and error cases.]
    3.3.5     Error Handling
    The detail log should state the following:
         Number of records converted successfully
         Number of records sent to the error report
         Details of the errors – what caused the errors?
    If the completion check finds missing cost centers, or the ambiguity check finds duplicate records and an email should be sent to a group defined by Finance for the given error conditions.  These issues can be researched and corrected by a user with access to create/maintain cost center groups.
    If there is an error in processing the file (i.e. IDOC error), the interface should stop and return an error message to be researched by a technical resource who monitors interface activity.
    There are no required fields or conditional inputs when creating cost center groups.  If the file is formatted correctly the interface should process without incident.  Errors that occur because of duplicate or missing records can be addressed through ambiguity and completeness checks and be corrected by a user with access to the standard transaction.
    An email should be automatically generated when the update has run and should be sent to the assigned Finance group responsible for the SAP management structure regardless of error status.
    [FMEA (Failure Modes and Effects Analysis) on possible run conditions and how to address them.]
    4.0     Electronic Attachments/Documentation
    [Required for Functional: 1) Unit Test Plan, 2) Related BPPs or Instructional Pertinent Functional Info]
    Document Name     Location
    Field mapping file     Hierarchy data is not maintained in a table in SAP.  The functional module K_HIERARCHY_TABLES_READ maintains the relationships of the group including the hierarchy level and parent/child relationship.
    Unit Test Plan     There are approximately 1,000 active cost centers at Cessna.   The Unit Test plan can send a sample of the data, (one or two nodes and associated cost centers).  The full file is available and can used for a more robust unit test. 
    Sample Data                  
    FIN0116 - Hyperion to SAP Management Structure.vsd     Cessna3\cessnaim\Prod\Projects\Specifications\D2 Interface_Summaries\
    5.0     Technical  Requirements
    5.1     Report/Form
    5.1.1     Technical Objects
    [Tables, APIs, structures, EDI segments, data elements, domains, indexes, function Modules]
    5.1.2     Technical Strategy
    [Outline processing steps: include 5.1.2 items with fields, selection/join conditions, perf, err handling, control]
    5.1.3     Production Support
    [Batch: electronic job flow with technical names]
    5.2     Enhancement/Modification
    5.2.1     Technical Objects
    [Tables, APIs, structures, EDI segments, data elements, domains, indexes, function Modules, user exits]
    5.2.2     Technical Strategy
    [Outline processing steps: include 5.1.2 items with fields, selection/join conditions, perf, err handling, control]
    5.2.3     Production Support
    [Only include info not already found in spec]
    5.3     Interface/Conversion
    5.3.1     Source/Middleware/Target (WBI/Middleware Technical Implementation Details)
    WBI will call the BAPI (RFC function module) from middle ware and populates the data into BAPI.
              Interface Overview
                   This section describes the detailed interface design with all the required information regarding the source 
                   system, WBI Components and the destination application of the FIN0116 Hyperion Mgmt Structure to SAP
                   The FIN0116 Hyperion Mgmt Structure to SAP integrates management structure data from the source
                   system (Hyperion) to the target system (SAP) in near real-time. This section describes detailed information
                   regarding the WBI Components and its Connectivity.
              Interface Assumptions
    1.     Hyperion mgmt structure XML file will be placed in the directory where WBI have access to read and archive.
    2.     WBI (Middleware) is going to have FTP get access and FTP service account to the Hyperion File System.
    3.     All Hyperion XML files placed in the directory are going to have unique file name (Ex: HyperionFile_MMDDYYYY.xml)
            Interface E2E Flow
    Step 1     
    Hyperion mgmt structure XML data file will be placed in E:\Hyperion\SAP\Event directory on Hyperion Server..
    Step 2     
    The CES_FIN01_JText_POLConnector will be polling on the E:\Hyperion\SAP\Event directory, which resides on Hyperion file system; whenever there is a new file in the directory, the connector will process that file to WBI Server and Archive file to E:\Hyperion\SAP\Archive directory.
    Step 3     
    The CES_FIN01_JText_POLConnector will send the XML document to Interchange server (WBI).
    Step 4     
    Interchange Server (WBI) will process the XML data and map the Hyperion Mgmt data to SAP BAPI. WBI will send the SAP BAPI formatted mgmt structure data to ASD_CES_SAPFIN1_UPRConnector Agent.
    Step 5     
    The ASD_CES_SAPFIN1_UPRConnector Agent will call ZC_BAPI_COSTCENTERGRP_MANGMNT and pass mgmt data to it.
    Step 6     
    Interchange server (WBI) will receive a response from SAP application and the response can be either a success or a failure/Error.
    Step 7     
    If the transaction is success, do nothing end success the process.
    Step 8     
    If the transaction is failed in SAP, SAP will send the return object to WBI server.
    If error information received from SAP via return object or the transaction is failed in WBI (Middleware), WBI is going to send an error email notification to business email distribution list.
        WBI Components
         Please refer the attached interface spread sheet.
        Interface Mapping Document
       Please refer section 4.0 for mapping document.
         Error Handling and Logging
              Successful Transactions:-
          Once WBI receives a success return code from SAP, WBI will end the transaction as End Success.
    System Failure Transactions:-
    Step 1     Any ICS component is down on production server.
    Business Process/Data Failure Transactions:-
    Step 1     Error while executing Collaboration (Business Logic) or Mapping of Lawson data to SAP format
    WBI will send an Email Notification to Business Email Distribution List.
    Step 2     WBI Received a TYPE = W or E from SAP in return structure.
    SAP system should be able to raise an error and send an email to Business Email Distribution List
    SAP SAMPLE RETURN OBJECT STRUCTURE To WBI:-
    sap_return = 1
    TYPE = S
    ID = MM
    NUMBER = 90104
    MESSAGE = The Cost Center Group 90104 has been successfully created
    LOG_NO = CxBlank
    LOG_MSG_NO = 000000
    MESSAGE_V1 =
    MESSAGE_V2 = CxBlank
    MESSAGE_V3 = CxBlank
    MESSAGE_V4 = CxBlank
    PARAMETER = CxBlank
    ROW = 0
    FIELD = CxBlank
    SYSTEM = SD6CLINT223
    ObjectEventId = CxIgnore
    From the return object for the field “TYPE” the following are the possible values that SAP is returning.
    Type     Meaning
    S     Success
    I     Information
    W     Warning
    E     Error
    For all Warning or Error messages received from SAP, WBI needs to send an Email notification to the Email distribution List mentioned in Section bellow.
    Email Distribution Information
    EMAIL ADDRESS     Successful Transactions     System Failure Transactions     Business Process/Data Failure Transactions
      WBI Performance Considerations
        Collaboration General Properties
    Property Name     Value     Notes
    Maximum number of concurrent events     1     The GBO size is going be huge for this collaboration, so we want it to process 1 at a time, to minimize the use of system resources.
    Recovery Mode     Deferred     By setting the Recovery Mode to ‘Deferred’, it will increase the ICS performance and reduce the ICS startup time. For more questions, please refer WBI documentation.
    Max Event Capacity     1     We don’t want this collaboration to process more than 1 event at any given time, so we set this value to 1.
    CES_FIN01_JText_POL Connector Properties
    Property Name     Value     Notes
    AgentConnections     1     It is a system default value, and for daily batch process interfaces, don’t need more than 1 agent connections
    ConcurrentEventTriggeredFlows     4     As of now this connector will be used by 4 interfaces.
    ControllerEventSequencing     true     This is a default and not much of a use for this interface
    Max Event Capacity     8     To give buffer to the connector, we just doubled the ConcurrentEventTriggerFlows.
    Poll Frequency     10000     As of now, we defined this parameter to poll every 10 sec, once we move the interface to production we can change the Poll Frequency to 10 min or 30 min depends on the requirement.
    Poll Quantity     3     Though we define Poll Quantity to 3, we are not expecting more than 1 at anytime.
    JvmMinHeapSize     1m     System Default, need to be tuned based on interface performance.
    JvmMaxHeapSize     256m     System Default, need to be tuned based on interface performance.
    JvmMaxNativeStackSize     128k     System Default, need to be tuned based on interface performance.
    ASD_CES SAPFIN1UPR Connector Properties
    Property Name     Value     Notes
    AgentConnections     1     It is a system default value, and for daily batch process interfaces, don’t need more than 1 agent connections
    ControllerStoreAndForwardMode     true     By setting this value to true, if the SAP connector agent to SAP is down, then the transaction will wait until the agent is restored and once it restored, connector will successfully complete the transaction
    JvmMinHeapSize     1m     System Default, need to be tuned based on interface performance.
    JvmMaxHeapSize     256m     System Default, need to be tuned based on interface performance.
    JvmMaxNativeStackSize     128k     System Default, need to be tuned based on interface performance.
    5.3.2     Processing/Translation (SAP Technical Details)
    [Outline processing steps: include 5.3.2 items with fields, selection/join conditions, perf, err handling, control]
    Assumptions:
    1.     All data that is received by RFC Function Module is pre-converted and ready to upload to SAP.
    2.     A set of records will be populated to RFC function module table.
    3.     The Main Cost center group name will be ‘CM_MGTHIER’ and it will be a constant.
    4.     Cost center group names will be provided along with cost center groups.
    5.     Controlling Area is assumed to be '1000'.
    6.     If an invalid cost center is found, Cost center group will not be created or modified and the error message will be returned along with the invalid cost center.
    Process Flow:
    1.     Create new RFC function module ‘ZC_BAPI_COSTCENTERGRP_MANGMNT’ in SE37 transaction with importing parameters includes a table with all the fields in the input file structure.
    2.     Source code written in this function module to create cost center groups in ‘KSH1’ transaction using the BAPI ‘BAPI_COSTCENTERGROUP_CREATE’.  
    3.     If Cost center repeats error message will be displayed through RETURN parameter.
    4.     Errors generated while cost center group creation, will be displayed as the Return table in the output of the RFC function module.
    Program Structure and processing:
    1.     Create a new  RFC function module ‘ZC_COSTCENTERGRP_MANGMNT’ with below parameters
    Parameters     Type     Description
    Exporting          
    RETURN     BAPIRET2     Return Parameter
    Tables          
    CCGRP     ZCSF_CCGRP     Cost Center Groups
    2.     Pass the contents of table CCGRP into another internal table IT_CCGRP where group names come first.
    3.     Sort internal table IT_CCGRP by MGMT3_NAM, MGMT4_NAM and MGMT5_NAM fields.
    4.     Loop at table IT_CCGRP into a work area WA_CCGRP.
    &#61607;     If Cost center is not initial, Select KOSTL from CSKS table into a variable V_KOSTL where KOSTL = WA_CCGRP-CCID.
    &#61607;     If SY-SUBRC is equal to zero, then pass the following fields to the BAPI structure
    WA_ HIERARCHYVALUES-VALFROM = WA_CCGRP-CCID.
    WA_ HIERARCHYVALUES-VALTO      = WA_CCGRP-CCID.
    Append WA_ HIERARCHYVALUES to IT_ HIERARCHYVALUES.
    &#61607;     Else, populate an error message saying ' Cost center groups contain invalid Cost Centers' into RETURN table. And exit from the loop.
    &#61607;     At FIRST,  do the following,
    a.     Pass the following fields to create Cost center group ‘Cessna Management structure’ initially.
    WA_HIERARCHYNODES-GROUPNAME = ‘CM_MGTHIER’
    WA_HIERARCHYNODES- HIERLEVEL = ‘0’
    WA_HIERARCHYNODES- VALCOUNT = ‘0’
    WA_HIERARCHYNODES- DESCRIPT = ‘Cessna Management Structure’
    Append WA_HIERARCHYNODES to IT_HIERARCHYNODES.
    &#61607;     At new of MGMT3_NAM_NAM field,  do the following,
    a.     Pass the following fields, to create Management level 3 group
    WA_HIERARCHYNODES-GROUPNAME = WA_CCGRP-MGMT3_NAM
    WA_HIERARCHYNODES- HIERLEVEL = ‘1’
    WA_HIERARCHYNODES- VALCOUNT = ‘0’
    WA_HIERARCHYNODES- DESCRIPT = WA_CCGRP-MGMT3_DES
    Append WA_HIERARCHYNODES to IT_HIERARCHYNODES.
    &#61607;     At new of MGMT4_NAM field,  do the following,
    a.     Pass the following fields, to create Management level 4 group
    WA_HIERARCHYNODES-GROUPNAME = WA_CCGRP-MGMT4_NAM
    WA_HIERARCHYNODES- HIERLEVEL = ‘2’
    WA_HIERARCHYNODES- VALCOUNT = ‘0’
    WA_HIERARCHYNODES- DESCRIPT = WA_CCGRP-MGMT4_DES
    Append WA_HIERARCHYNODES to IT_HIERARCHYNODES.
    &#61607;     ADD V_VALCOUNT = V_VALCOUNT + 1.
    &#61607;     At end of MGMT5_NAM field,  do the following,
    a.     Pass the following fields, to create Management level 5 group
    WA_HIERARCHYNODES-GROUPNAME = WA_CCGRP-MGMT4_NAM
    WA_HIERARCHYNODES- HIERLEVEL = ‘3’.
    WA_HIERARCHYNODES- VALCOUNT = V_VALCOUNT.
    WA_HIERARCHYNODES- DESCRIPT = WA_CCGRP-MGMT5_DES
    Append WA_HIERARCHYNODES to IT_HIERARCHYNODES.
    &#61607;     At LAST,  do the following,
    a.     Call BAPI ' BAPI_COSTCENTERGROUP_CREATE' by passing the below parameters.
    CALL FUNCTION 'BAPI_COSTCENTERGROUP_CREATE'
      EXPORTING
        CONTROLLINGAREAIMP       = '1000'
      IMPORTING
         GROUPNAME                        = GROUPNAME
         RETURN                                 = RETURN
      TABLES
        HIERARCHYNODES           = IT_HIERARCHYNODES
        HIERARCHYVALUES          = IT_HIERARCHYVALUES.
    5.3.3     Technical Objects
    [Tables, APIs, structures, EDI segments, data elements, domains, indexes, function Modules, user exits, BAPIs]
    Function Modules:
    ‘ZC_COSTCENTERGRP_MANGMNT'
    ‘BAPI_COSTCENTERGROUP_CREATE’
    ‘BAPI_TRANSACTION_COMMIT’
    Tables: EKPO, CSKS     
    Structure: ‘ZCSF_CCGRP’
    FIELD NAME     DATA ELEMENT     DOMAIN     DATA TYPE     LENGTH     FIELD  DESCRIPTION
    MGMT3_NAM     ZCMGMT_N     GRPNAME     CHAR     15     Management level 3 Name
    MGMT3_DES     ZCMGMT_D     TEXT40     CHAR     40     Management level 3 Description
    MGMT4_NAM     ZCMGMT_N     GRPNAME     CHAR     15     Management level 4 Name
    MGMT4_DES     ZCMGMT_D     TEXT40     CHAR     40     Management level 4  Description
    MGMT5_NAM     ZCMGMT_N     GRPNAME     CHAR     15     Management level 5 Name
    MGMT5_DES     ZCMGMT_D     TEXT40     CHAR     40     Management level 5  Description
    CCID     KOSTL     KOSTL     CHAR     10     Cost Center
    CCDES     KLTXT     TEXT40     CHAR     40     Cost center Description
    5.3.4     Technical Overview and Strategy
    [Performance, error handling, control]
    Error Handling:
    Errors generated will be displayed as the Return table in the output of the RFC function module, when
    1.     Cost center in invalid.
    2.     Cost center group name repeats.
    3.     Cost Center repeats.
    5.3.5     Production Support
    [Describe scenarios in which the interface components should/should not run. (Source/Middleware/Target systems down, etc.)]
    6.0     Technical Development Objects
    [Include development objects that would be required in order for the business to be able to provide production support.]
    Package/Dev Class: ZCK_INT
    RFC Function Module Name: ZC_COSTCENTERGRP_MANGMNT
    Function Group Name: ZCFMC_COSTCENTERGRP_MANGMNT
    Structure: ZCSF_CCGRP

    SDN is the place to discuss technical problems..
    Please avoid such weird post.
    G@urav.

  • Safari Ver 5.1.10 Fix For The "Old Style" Google Problem...

    @ The mods/ Admins
    I'm not sure if this is the correct place to post this but I cannot seem to find the thread where people were discussing the recent problem Google introduced by forcing some versions of Safari to revert back to their old style Google layout and format...
    I was told by a moderator (Zack T.) that I could post my "Fix/ Solution" to this problem here on the site but I can't find the original thread for this. So I am posting the "Fix" here as I'm still getting inundated with emails from people here and from Googles "help" forums asking me for this solution...
    Could you please if possible leave this thread available for those people running Safari Ver 5.1.10 so that they can try for themselves this "Fix" without having to contact me personally over it, or can you (if needed) move this post to the appropriate thread...
    Thank you...
    The following is a "Fix/ Solution" that I have created that solves the problem for users of Safari Ver 5.1.10  that Google introduced recently where they now block older version of Safari from using the "Modern Style" layout and features of Google which they had been used to...
    You can still use the "Modern Style" Google with Safari 5.1.10 via the "Develop/ User Agent/ Other" menu to switch to a "User Agent" that allows you to use the "Modern Google" however, there is no way to make this as the permanent "Default User Agent" in Safari 5.1.10 and it has to be done for each new tab you open and every time you startup Safari... which is not exactly good or helpful...
    That's where this "Fix" solves that for you. This fix will make sure Safari 5.1.10 starts up and uses a custom "User Agent" that allows you to continue to use the "Modern Style" Google and not have to constantly change the "User Agent" via the "Develop" menu...
    It also has the benefit over other methods that are about of using FireFox "User Agents" in that this fix creates a Mac specific "User agent" that means you get the correct pages from whatever it is you are accessing on the internet (The FireFox one causes some changes to graphics and page layout when used on a Mac)...
    As long as you are certain you are using Safari Version 5.1.10 on a Mac running OSX 10.6.8 (Snow Leopard) and they are all fully updated as far as they can be then this fix should work for you (it already has for several thousand other Safari 5.1. 10 users whom have tried it)...
    INSTRUCTIONS.... Safari Version 5.1.10 Fix To Restore The "Modern Style" Google...
    IMPORTANT !!! --- MAKE SURE SAFARI ISN"T RUNNING ---
    Download the following DMG which contains the "Fix" for Safari Ver 5.1.10...
    http://www.mediafire.com/download/7wsl4n5siu7cphw/Safari_Ver_5.1.10_Google_Fix.d mg
    When you open the DMG file you will see a window that looks like this...
    IMPORTANT --- MAKE SURE SAFARI ISN"T RUNNING ---
    STEP 1: Double click on the folder called "A" to open it...
    STEP 2: From the new window that opens from folder "A"  find the file called "Safari" and drag
    it to your Desktop screen to make a copy of it (this is both for safekeeping and in case the "fix"
    doesn't work for you so that you can still restore the original file)...
    STEP 3: Drag the file from the downloaded DMG window called "Safari" onto the folder in the
    same window called "A"...
    Now start Safari as you would normally and if the fix has worked you should once again be seeing the
    "Modern" look Google once again. You should copy/ move the original "Safari" file you copied to your
    Desktop screen to a safe place for storage (Downloads or Documents for example) in case you ever
    need or want to restore the original file to Safari at some pint in the future...
    IMPORTANT:- If you're still seeing the old version of Google in Safari after trying this fix then
    unfortunately it hasn't worked for you and you MUST replace/ put back the
    original "Safari" file you copied to your Desktop screen...
    This is simple to do and is achieved by simply dragging the original "Safari"
    file you copied to your Desktop screen onto the "A" folder in the "Safari Fix"
    window...
    Happy Googling - MadFranko008 (2014)

    I followed instructions from Carolyn Smith in another thread (see below) - but Safari did not start anyway. After that I discovered that Safari started when starting from /Program/-folder but not from Docks on the desktop.
    So - throw away the old icon on the desktop and make a new one.
    /Vesno
    Carolyn Samit San Francisco Bay Area
    Re: Safari quit unexpectedly after my last update, What do I do? 
    Mar 13, 2012 7:15 PM (in response to Mac Engineer)
    Hi...
    Quit Safari.
    Go to ~/Library/Safari
    Move these files from the Safari folder to the Trash.
    History.plist
    LastSession.plist
    TopSites.plist
    WebpageIcons.db
    Now go to ~/Library/Caches/com.apple.Safari/Cache.db
    Move the Cache.db file to and the Webpage Previews folder to the Trash.
    Relaunch Safari.
    ~ (Tilde) character represents the Home folder.
    edited by:  cs
    Re: Safari quit unexpectedly after my last update, What do I do? 

  • Validating against schema file for the output XML file

    Hi,
      I am using XSLT for mapping. The output message is generated according to the mappings but it is not validate aganist schema of target . I am using xsd file from external defination section as target. Can any body help me in this regard.
    Thanks,
    Mallikarjun.M

    hi,
    if you talk about the schema of a target message type
    than validation only works if you use graphical
    message mapping
    not with: xslt,java, abap
    Regards,
    michal
    <a href="/people/michal.krawczyk2/blog/2005/06/28/xipi-faq-frequently-asked-questions">XI FAQ - Frequently Asked Questions</a>

  • New stroke options for the layer style "Stroke"

    Hi,
    The new stroke options are fantastic where you can edit gaps, align and corners. And I love the ability to add layer styles to groups which makes it much easier to work with separate parts in a group that should be treated as a common object.
    BUT! Why haven't you updated the stroke (layer style) options to include these new awesome stroke features? I would love to be able to make dashed strokes as a layer style that can be applied to groups, and I don't see why this should be excluded as an option.
    Thanks for an otherwise great application!
    On twitter: @uxhannes

    We are happy that you like the new features in CS6.   You can request new features from your ideas here: http://feedback.photoshop.com/photoshop_family  and people can vote on them.
    Note: A shape layer stroke is a vector-based stroke and is applied only to shape layers. This is very different from the layer syle stroke.
    You can control the settings for this stroke in the options bar for the vector tools (Shape, Pen, Path Selection, Direct Selection). This stroke is an attribute of the shape layer and will not cause the fx icon to display on the layer in the Layers panel.
    A layer style stroke is a pixel-based stroke and can be applied to any layer that accepts layer styles (including shape layers). The settings for this stroke are controlled via the Layer Styles dialog.
    Pattie

  • Trying to find out the sql for the below 3 values

    HI Experts,
    I am trying to find the sql that can give me the values for the below three values. can some one Help me out getting these ?
    Free buffer waits (%)
    Local write wait (%)
    Latch: cache buffer chains (%)
    Actually these are the metrics which are available in OEM for the DB releases up to 9i. Post 9i releases , these metrics are obsoleted.
    So, trying to find the sql for these and use them as an UDM for the 10g and 11g DB's
    Thanks in Advance.
    Thanks,
    Naveen kumar.

    And is there any why to find using what sql the metrci is formed ?

  • Dynamic Names for the Outputs

    Hi,
    I was wondering if it would be possible to name the PDF outputs dynamically?
    Say for example, I have a tag in the XML <TemplateName>ABC</TemplateName>. Can I have the output PDF with the name 'ABC'?
    And
    Is it possible to explicitly specifiy the name 'ABC' somewhere in the INI file so that the outputs generated will be multiple versions for 'ABC' (like ABC001, ABC002 etc)?
    Many Thanks,
    Phew

    Phew,
    As mentioned earlier, in order to rename the file you have two steps:
    1) Make the input data value available to genprint - this is normally done by creating a global variable.
    2) Configure the PDF print driver. Depending on the version of Documaker you are using you can refer to one of the following manuals:
    a) 11.5 - Using the PDF Print Driver - http://docs.oracle.com/cd/E16256_01/pdf_book.pdf (see section "Generating Separate Print Files")
    b) 12.x - Printers Reference - http://docs.oracle.com/cd/E22582_01/printers_rg.pdf (see section "Generating Separate Print Files")
    Essentially you will configure the INI like so:
    < BatchPrint >
    PDF = ~FUNCTION .PDF
    Where ~FUNCTION is an INI Built-in function like one of these:
    ~DALRUN {function name} - executes a DAL function to return a string which is used to name the file.
    ~DALVAR {variable name} - returns the value of a DAL variable which is used to name the file.
    Don't forget the space after the built-in function before the static bit of the filename...
    Best,
    Andy

  • Preparing video for the web...I am lost

    Hello all,
    I had a project that began in imovie 06. It is an hour long production that i wan to prepare for use on a web site. I know that an hour long video is asking a lot of a web audience but the work is unique in that it is a poet reading a very long poem. I want to get this right for the few people who will actually want to see this thing.
    My workflow is as follows. Share the video from iMovie 06 with expert settings set to Quicktime. High quality 480 x 360 letterboxed AAc 128. The resulting hour long video is 360mb
    I open that video in Quicktime 7.6.4 then I copy and paste the first 15 min to a new player. From that new player I Export for Web and create the three standard versions. The problem is that the desktop version is 105mb and iPhone versions is 108mb. Both are bigger than the section of the movie that i started with 90MB. This suggests to me that there is a lot wrong with my workflow.
    Any suggestions would be greatly appreciated.

    Re-read your last paragraph for the obvious clues to your troubles. Going from 90 MB to a larger file size means you are "up-sampling" previously compressed data.
    Even though your 12 GB file seems absurdly large now it will become highly compressed when using the "Export for Web" feature of QuickTime Player Pro.
    Do some simple "one minute" test files from your DV source file. Compare settings (pen and paper) and dimensions and audio quality. Ask some questions about the source file. Do you really need "stereo" sound when "mono" would be half as large? AAC audio is good but do you need 128 when 64 would be half as large in file size?
    Is this a "talking head" (little motion) video track? Could you replace the video track with some still image files and still achieve your goal?
    Just something to think over.

  • Issue with SQL for the XMLTABLE

    Hi ,
    Here is what I want to Achieve :
    This is my XSD :
    <?xml version="1.0" encoding="UTF-8"?>
    <xs:schema xmlns="http://my-company.com/namespace" xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://my-company.com/namespace" elementFormDefault="qualified" attributeFormDefault="unqualified">
         <xs:element name="NOTE" type="NOTEType">
              <xs:annotation>
                   <xs:documentation>Root Element</xs:documentation>
              </xs:annotation>
         </xs:element>
         <xs:complexType name="NOTEType">
              <xs:sequence>
                   <xs:element name="TO" type="SENDERTYPE"/>
                   <xs:element name="FROM" type="RECEIVERTYPE"/>
                   <xs:element name="HEADING" type="HEADINGTYPE"/>
                   <xs:element name="BODY" type="xs:string"/>
              </xs:sequence>
         </xs:complexType>
         <xs:complexType name="SENDERTYPE">
              <xs:sequence>
                   <xs:element name="COMPANY" type="xs:string"/>
                   <xs:element name="INDIVIDUAL" type="xs:string" maxOccurs="unbounded"/>
                   <xs:element name="ORGANIZATION" type="xs:string"/>
                   <xs:element name="DEPARTMENT" type="xs:string" maxOccurs="unbounded"/>
              </xs:sequence>
         </xs:complexType>
         <xs:complexType name="RECEIVERTYPE">
              <xs:sequence>
                   <xs:element name="COMPANY" type="xs:string"/>
                   <xs:element name="INDIVIDUAL" type="xs:string" maxOccurs="unbounded"/>
                   <xs:element name="ORGANIZATION" type="xs:string"/>
                   <xs:element name="DEPARTMENT" type="xs:string" maxOccurs="unbounded"/>
              </xs:sequence>
         </xs:complexType>
         <xs:complexType name="HEADINGTYPE">
              <xs:sequence>
                   <xs:element name="SINGLELINE">
                        <xs:simpleType>
                             <xs:restriction base="xs:string">
                                  <xs:maxLength value="200"/>
                             </xs:restriction>
                        </xs:simpleType>
                   </xs:element>
                   <xs:element name="MULTILINE" type="xs:string"/>
              </xs:sequence>
         </xs:complexType>
    </xs:schema>
    This is my XML Document : (I Have 3 ,more similar Similar XML Files in the NOTES table)
    <?xml version="1.0" encoding="UTF-8"?>
    <NOTE xmlns="http://my-company.com/namespace" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://my-company.com/namespace file:///C:/Documents%20and%20Settings/saoa/Desktop/MY%20WORK/XML/NOTE.xsd">
         <TO>
              <COMPANY>United Guaranty</COMPANY>
              <INDIVIDUAL/>
              <ORGANIZATION/>
              <DEPARTMENT/>
         </TO>
         <FROM>
              <COMPANY/>
              <INDIVIDUAL>Aniket Sao</INDIVIDUAL>
              <INDIVIDUAL>Monit Sao</INDIVIDUAL>
              <INDIVIDUAL>Yeshwant Sao</INDIVIDUAL>
              <INDIVIDUAL>Dashrath Sao</INDIVIDUAL>
              <ORGANIZATION/>
              <DEPARTMENT/>
         </FROM>
         <HEADING>
              <SINGLELINE>Just Testing XML</SINGLELINE>
              <MULTILINE/>
         </HEADING>
         <BODY>This is just to test of the XML works fine</BODY>
    </NOTE>
    The Output which I'm trying to get is
    NOTESID -     TOCOMPANY -     TOINDIVIDUAL -     TOORGANIZATION -     TODEPARTMENT-     FROMCOMPANY-     FROMINDIVIDUAL-     FROMORGANIZATION-     FROMDEPARTMENT-     SINGLEHEADING-     MULTIHEADING-     BODY-
    1-     United Guaranty-     NULL-     NULL-     NULL-     NULL-     Aniket Sao-     NULL-     NULL-     Just Testing XML-     NULL-     This is just to test of the XML works fine-
    2-     United Guaranty-     NULL-     NULL-     NULL-     NULL-     Monit Sao-     NULL-     NULL-     Just Testing XML-     NULL-     This is just to test of the XML works fine-
    3-     United Guaranty-     NULL-     NULL-     NULL-     NULL-     Yeshwant Sao-     NULL-     NULL-     Just Testing XML-     NULL-     This is just to test of the XML works fine
    4-     United Guaranty-     NULL-     NULL-     NULL-     NULL-     Dashrath Sao-     NULL-     NULL-     Just Testing XML-     NULL-     This is just to test of the XML works fine
    Here is the Query I Fire :
    SELECT
    NOTES2."TO",
    NOTES2."FROM",
    NOTES2."HEADING",
    NOTES2."BODY"
    FROM NOTES,
    XMLTABLE('/NOTE'
    PASSING NOTES.NOTESXMLCOL
    COLUMNS
    "TO" varchar2(50) PATH '/NOTE/TO',
    "FROM" varchar2(50) PATH '/NOTE/FROM',
    "HEADING" varchar2(50) PATH '/NOTE/HEADING',
    "BODY" varchar2(300) PATH '/NOTE/BODY')
    NOTES2;
    This is the Result I get
    TO FROM HEADING BODY
    United Guaranty      Aniket SaoMonit SaoYeshwant SaoDashrath Sao     Just Testing XML     This is just to test of the XML works fine
    I want to split up the Multiple occurance of the node into different rows. how to do that ?
    I Event tried this ;
    SELECT NOTESID NOTES,
    NOTES2."TOCOMPANY",
    NOTES2."TOINDIVIDUAL",
    NOTES2."TOORGANIZATION",
    NOTES2."TODEPARTMENT",
    NOTES2."FROMCOMPANY",
    NOTES2."FROMINDIVIDUAL",
    NOTES2."FROMORGANIZATION",
    NOTES2."FROMDEPARTMENT",
    NOTES2."SINGLEHEADING",
    NOTES2."MULTIHEADING",
    NOTES2."BODY"
    FROM NOTES,
    XMLTABLE('/NOTE'
    PASSING NOTES.NOTESXMLCOL
    COLUMNS
    "TOCOMPANY" varchar2(50) PATH '/NOTE/TO/COMPANY',
    "TOINDIVIDUAL" varchar2(50) PATH '/NOTE/TO/INDIVIDUAL',
    "TOORGANIZATION" varchar2(50) PATH '/NOTE/TO/ORGANIZATION',
    "TODEPARTMENT" varchar2(50) PATH '/NOTE/TO/DEPARTMENT',
    "FROMCOMPANY" varchar2(50) PATH '/NOTE/FROM/COMPANY',
    "FROMINDIVIDUAL" varchar2(50) PATH '/NOTE/FROM/INDIVIDUAL',
    "FROMORGANIZATION" varchar2(50) PATH '/NOTE/FROM/ORGANIZATION',
    "FROMDEPARTMENT" varchar2(50) PATH '/NOTE/FROM/DEPARTMENT',
    "SINGLEHEADING" varchar2(50) PATH '/NOTE/HEADING/SINGLELINE',
    "MULTIHEADING" varchar2(50) PATH '/NOTE/HEADING/MULTILINE',
    "BODY" varchar2(300) PATH '/NOTE/BODY')
    NOTES2;
    I Get
    ORA-19279: XPTY0004 - XQuery dynamic type mismatch: expected singleton sequence - got multi-item sequence
    19279. 00000 - "XQuery dynamic type mismatch: expected singleton sequence - got multi-item sequence"
    *Cause:    The XQuery sequence passed in had more than one item.
    *Action:   Correct the XQuery expression to return a single item sequence.
    Please help.
    Thanks,
    Aniket

    Hi,
    Note for next time : Oracle XML-related questions are best posted in the {forum:id=34} forum.
    The exact database version would be appreciated too.
    Repeating elements are typically handled by adding a nested XMLTable to shred them into relational rows :
    SELECT x1.to_company
         , x1.to_individual
         , x1.to_organization
         , x1.to_department
         , x1.from_company
         , x2.from_individual
         , x1.from_organization
         , x1.from_department
         , x1.single_heading
         , x1.multi_heading
         , x1.body
    FROM notes t
       , XMLTable(
           XMLNamespaces(default 'http://my-company.com/namespace')
         , '/NOTE'
           passing t.notesxmlcol
           columns
             to_company        varchar2(50)  PATH 'TO/COMPANY'
           , to_individual     varchar2(50)  PATH 'TO/INDIVIDUAL'
           , to_organization   varchar2(50)  PATH 'TO/ORGANIZATION'
           , to_department     varchar2(50)  PATH 'TO/DEPARTMENT'
           , from_company      varchar2(50)  PATH 'FROM/COMPANY'
           , from_individuals  xmltype       PATH 'FROM/INDIVIDUAL'
           , from_organization varchar2(50)  PATH 'FROM/ORGANIZATION'
           , from_department   varchar2(50)  PATH 'FROM/DEPARTMENT'
           , single_heading    varchar2(50)  PATH 'HEADING/SINGLELINE'
           , multi_heading     varchar2(50)  PATH 'HEADING/MULTILINE'
           , body              varchar2(300) PATH 'BODY'
         ) x1
       , XMLTable(
           XMLNamespaces(default 'http://my-company.com/namespace')
         , '/INDIVIDUAL'
           passing x1.from_individuals
           columns
             from_individual   varchar2(50)  PATH 'text()'
         ) x2
    ;I guess it's probably not your actual schema, but having unwrapped unbounded elements in the middle of the document doesn't make it a good candidate for a relational output.
    For example, what output would you require if, at the same time, there are multiple occurrences of FROM/DEPARTMENT, FROM/INDIVIDUAL, TO/DEPARTMENT and TO/INDIVIDUAL?

  • Is EO necessary for the Item Style「MessageFileUpload」on EBS 12.1.3?

    Hello experts,
    When using Item Style「MessageFileUpload」,if the file which is being uploaded
    exists ,the file name with an anchor will be rended and the file can be previewed
    by click it.But the customer found that EO should be added for the VO associated with
    Item Style「OAMessageFileUpload」.If EO is removed,the file will be opened as a blank file.
    So is EO necessary for Item Style「MessageFileUpload」?
    Thank you in advance.
    Best regards,
    Wang
    Edited by: user593662 on May 16, 2012 1:06 AM

    Hi,
    You need to save the file and for that you need the EO.
    Thanks
    Anoop

Maybe you are looking for