Unicode Project Procedure

We are about to embark on a combined upgrade and unicode conversion project. However, I am unsure about exactly which procedure to adopt. SAP's guide recommends creating an "ABAP Preparation System" being an upgraded copy of Production which has been unicode'd. In this system they say you correct all your unicode non-compliant custom code and then create a single transport of all the corrections which is then included in the upgrade of subsequent systems.
However, another approach says to use the "ABAP Preparation System" to simply generate a list of all your unicode non-compliant custom code which you then correct in your 4.6C DEV prior to upgrading it.
My final thought is could you not simply upgrade and covernt DEV and then fix in place all your unicode non-compliant custom code in place, eliminating the need for the "ABAP Preparation System"?
What approach do those undertaking or who have completed a CU & UC project?
Regards,
Tom Maggs

Dear Tom,
I'm doing the conversion with CU&UC procedure for SAP 4.6C. We decided for CU&UC because the system is MDMP (more than one codepage in TCPDB). If you have a single code page you can use the standard procedure: upgrade and then unicode conversion. The first time that I made the upgrade I used the standard procedure applying note 838403 to came back to single codepage, but you can do the standard procedure also if your system is MDMP. The scope of the first run was only test the upgrade procedure, give to developers the environment to modify programs to unicode enabled and test unicode conversion procedure.
You have to use the CU&UC in production otherwise downtime would be unacceptable.
I can't use our development, to do the first run because it last more than 2 months and we can't remain without development for long time.
Regards
Giuseppe

Similar Messages

  • Unicode conversion procedures

    Hi,
    Where can we found documentation on unicode conversion procedures?
    Regards,
    Sam

    I found it,everything is available @ https://websmp105.sap-ag.de/unicode@sap.
    Regards,
    Sam

  • Support project procedure

    Hi Guys,
    Iam new to SAP BI World and now Iam working on support project  , At our client there are there servers i.e Dev. server, Quality Server and Production server,
      I want the detail procedure that, If I get a Ticket how should I handle, I mean to ask, In which server v have to do changes and in which server  we have to test( I mean Unit testing) and when we have to go for UAT( User Acceptance Test) and when  v have to transport to Production.
    Anothe question Is, will there be any data in Dev. Server or not.
    Pls give me detail step by step procedure.
    Suitable solution will be Regarded with healthy points.
    Reagards...
    BW World

    Hi,
    Normally we use the three tier architecture. Dev Box > QA Box > Prod Box.
    All the Developments, Break fixes and enhancements are done in Dev Box and then tested in QA Box and later transported to Prod Box. Normally we do employ only a single Dev box. But in a particular scenario we used a diff independent Dev box exclusively for a new development as requested by business.But the QA Box and Prod Box will be the same finally.
    But we may come up with a Pre-Prod if needed later on (if we feel that are some effects on current prod loads).
    Yes there will be some data in Dev and Assurance.But it may not be up to date. It may be some test data also.
    Thanks,
    JituK

  • OBPM 10.3.2 Project Procedures from ScreenFlows

    I have defined a new Procedure called calculateRoute in a folder called Procedures within Processes tree in my project.
    I used the Project - New - Procedure wizard.
    The procedure has input and output arguments.
    I would to know is it possible to invoke the procedure from within a automatic activity within a Screenflow.
    Same question - this time from within a Process.
    Many Thanks for your responses.
    TR

    You could invoke your procedure from a process by adding an Automatic activity in the process and invoking it from there.
    Screenflow is a different story. You could add an Automatic task in the screenflow but cannot invoke a procedure from this.

  • 4.6 C to ECC 6.0 Upgrade Project Timeline Sheet in MPP format

    Dear all,
    We are now proposing our customer for the 4.6c to ECC 6.0 Upgrade.
    Our customer is currently in 4.6c/oracle 9i/HPUX 11 i. He wants to move to ECC 6.0.
    If you have the project timeline for the above Technical Upgrade, can you pl send it to me.
    If you don't have in MPP format atleast send me the Work Breakdown structure with timelines.
    I shall modity the same to our customer and submit
    Thanks & Regards
    Senthil
    [email protected]

    Preparation Phase* 6 days
    Kick Off Meeting 1 day
    Upgrade Project Procedures Preparation 1 day
    Prepare Upgrade Project Plan 1 day
    Technical Requirements Assessment 3 days
    Assess Training needs of Key-users & End-users 1 day
    Prepare Detailed Basis Activity List for DEV, QA & PRD 1 day
    Business Blueprint Phase 6 days
    Develop System Landscape Upgrade Plan 1 day
    Functional Requirement Checklist 1 day
    ABAP Development check list 1 day
    Develop detailed Training Procedures & Documentation for Key Users & End Users 1 day
    Identify Testing Scope & Scenarios 1 day
    Identify Authorizations Conversion to Roles for SAP ECC 6.0 2 days
    Develop Documents as per Basis Activity List 1 day
    Develop Authorization Matrix for Activity Groups to Roles Conversion 2 days
    Prepare Upgrade Deliverables Checklist 1 day
    Realization Phase 28 days
    Installation of Solution Manager 3.2 System 1 day
    Creation of New Development System for Upgrade Project (Homogenous System Copy - PRD) 2 days
    Upgrade to AIX & Oracle 10g, SAP ECC 6.0 on New Development Server 3 days
    Upgrade Frontend Software 4 days
    Perform SPAU & SPDD Corrections 5 days
    Perform ABAP Development & Corrections 10 days Perform Authorizations Conversions and corrections after upgrade 8 days
    Perform Upgrade Testing for each Application Module 7 days
    Perform Unit & Integration Testing 6 days
    Perform Training to Key Users & End Users (Generic & Specific) 3 days
    Upgrade to AIX, Oracle 10g, SAP ECC 6.0 on Quality System 1 day
    Homogenous System Copy of PRD to New Quality & Upgrade to AIX, Oracle 10g & SAP ECC 6.0 2 days Perform Testing in Quality System 3 days
    Testing by end users on Quality System 1 day
    Production Realization & Go-Live Phase 6 days
    Upgrade to Production System Operating System to AIX (after close of business hours - 23:00) 1 day
    Oracle Upgrade to 10g (after close of business hours - 23:00) 1 day
    SAP Release Upgrade to ECC 6.0(Downtime Minimized - Downtime occurs in non-business hours) 2 days
    User Acceptance Testing 1 day
    Production System Go-Live 1 day
    Post Go-Live Support 14 days
    Post Go-Live Support 14 days Note: This is high level plan subject to change during Business Blue Print Phase 0 days
    This is taken from a post in Ittoolbox, May be this is generic. Hope you can tailor this to meet your requirements.

  • Hundreds of errors when loading Java WEBDynpro project .

    Hello all,
    Almost a year ago, we built some custom webdynpro iviews. Until now everything works fine, but the customer has requested some minor changes .
    So I connected to the dev server and loaded the track we had created for this project. The problem is that when we create a project from the DTR, in order to edit it, we get a load of errors, which were ofcourse not occurring when we compiled the project .
    For example, this is an error in my Custom Controller "ZHRCOS_P0002_CONTR"
    The code was automatically generated by the system when it was created, so if I try to change anything I get the message "This Code is Derived, do you really want to change it?"
    inside the code there is the function
    infoRecords = GCIContext.createModelNode("Records", true, CMICardinality.MANY, CMICardinality.ZERO_TO_ONE, true, ... etc .
    There I get the message
    "CMICardinality.MANY cannot be resolved"
    I would think that some necessary packages were not loaded during the "Create project" procedure, although I loaded all the dependencies .
    But, what I actually see, is that the class <CMICardinality> exists, only that instead of having the constant <MANY>, it has the constant <CARDINALITY_MANY> .
    This is something I cannot understand, because the Dynpros were compiled almost one year ago and they are still working fine. Why do I get those problems ?

    Thank you both, but I have already tried these approaches. I also tried with other projects and I have the same problem .
    Also I noticed that the visual editor seems to have a problem, but I do not know if it is connected to the above .
    "Unhandled event loop exception"
    I have changed my NWDS to 7.2, but I don't think that the studio version would have any impact on the building of the webdynpro.
    Edited by: Markos Daskalakis on Nov 2, 2010 3:51 PM

  • Technical upgrade from 4.6c to 6.0ecc with unicode conversion

    Hi Experts,
    Can you explain me technical upgrade from 4.6c to 6.0ecc with Unicode conversion.
    if u got any notes pls send it to [email protected]
    vijay

    Check these links. Search SDN  with Term "Upgradation" you will get lot of links
    http://help.sap.com/saphelp_nw04/helpdata/en/16/4b3c88170e11d6999d00508b6b8b11/frameset.htm
    http://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/f0f9f37c-be11-2a10-3baf-d5d7de5fb78d
    http://www.sdn.sap.com/irj/sdn/wiki?path=/display/unicode/system%2blandscape%2bconversion
    http://www.sdn.sap.com/irj/sdn/wiki?path=/display/unicode/project%2bplanning%2b-%2bmdmp%2bsystem
    http://www.sdn.sap.com/irj/sdn/wiki?path=/display/unicode/communication%2binterfaces
    Message was edited by: Jason Lax (Removed link to deleted content)

  • Data errors/changes in unicode database Once all code is unicode compliant

    Hi All,
    This is regarding unicode project.
    We have currently made all the programs unicode complaint
    and the database we are using is not unicode database.
    We are moving now the entire code to the Unicode database system.
    1>Could anyone tell what kind of data errors that might be encountered due to this new database system.
    2>What kind of data changes regarding the format/data we might observe in the output files generated.
    Any expertise and experiences in the similar upgradation will be very helpful..
    Thank you all in advance

    Hi Kumar,
    each code page encodes characters into a binary representation. ASCII is may be the best known. It encode 128 characters with seven bits. The first 32 characters are control characters for printers and terminals like carriage return and bell. Then there are some special characters like Space and Comma followed by digits and the characters of the roman alphabet in upper case and lower case representation. Unicode is another code page which is defined in unicode standard documentation. Because unicode characters are wider than one byte (the current standard contains almost 100.000 characters) there are different encoding used in applications. The most used encoding is probably UTF-8 which is used by DB2 and Oracle. MaxDB uses UTF-16 which uses much more space for most used characters. Languages use characters from a code page to build words. You may have multiple code pages in one system (MDMP) or a unicode system which supports all languages on a single code page.
    I hope this help you to understand the difference between a code page and a language. May be you check out the links [http://www.asciitable.com|http://www.asciitable.com] and [http://unicode.org|http://unicode.org].
    Best regards
    Ralph

  • Unicode Type Conversion Error

    Hi Friend,
    I am working in UNICODE project,i need one help,
    I have one error .
    Actually, im using one structure(Z0028) and passing values to internal table.
    At that time i shows one error.
    Actually,this error is due to type conversion problem.
    In that structure,i ve one packed datatype ,so, if i select
    unicode check it shows error.
    I will sent example prg and error also.
    Please give some solution to slove.
    REPORT  YPRG1                                   .
    TABLES: Z0028.
    DATA:I_Z0028 TYPE Z0028 OCCURS 0 WITH HEADER LINE .
    SELECT * FROM Z0028 INTO TABLE I_Z0028 .
    IF SY-SUBRC <> 0 .
      WRITE:/ ' NO DATA'.
    ENDIF.
      LOOP AT I_Z0028.
        WRITE:/ I_Z0028.
      ENDLOOP.
    Regards,
    Kalidas.T

    Hi,
    Display fields
    do like this..
    REPORT YPRG1 .
    TABLES: Z0028.
    DATA:I_Z0028 TYPE Z0028 OCCURS 0 WITH HEADER LINE .
    SELECT * FROM Z0028 INTO TABLE I_Z0028 .
    IF SY-SUBRC 0 .
    WRITE:/ ' NO DATA'.
    ENDIF.
    LOOP AT I_Z0028.
    WRITE:/ I_Z0028-field1,
                  I_Z0028-field2
    I_Z0028-field3.
    ENDLOOP.
    Regards,
    Prashant

  • Unicode Conversion approach

    HI All
    During Unicode approach isit possible to do the conversion of custom and standard program to unicode and make the system live and later on do the data conversion with business downtime.
    The reason i am asking so as to reduce the business down time. We are going for CU&UC and donot want a long business downtime.
    Let me know if there are any approach where we can do the data conversion in the later phase.
    Thanks
    Rajat Sarkar

    Hi,
    please have a look at:
    http://service.sap.com/~form/sapnet?_SHORTKEY=01100035870000380759&_OBJECT=011000358700000620342009E
    > Page 21
    Excerpt begin:
    1) Start release >= SAP NetWeaver AS 6.20
    > UCCHECK can be run before or during Unicode conversion
    2) Start release <= 4.6C (CU&UC or TU&UC*)
    > Execute the whole UCCHECK procedure in the SBX Unicode system
    > Upgrade the DEV system to SAP ERP 6.0 (Non-Unicode or Unicode) and execute UCCHECK (Additional Maintenance System necessary)
    Excerpt End.
    Therefore if you have a 4.6c system (or lower) as source system, then the Unicode enabling procedure (UCCHECK) cannot be separated from the actual Unicode conversion (Export / Import). In case of NW 6.20 or higher, you can do most of the enabling before the conversion (you will still need a rework after the conversion).
    Best regards,
    Nils Buerckel

  • Mutually incovertible issue in unicode

    hi
    i am workin on a unicode project.In a certain set of programs i am gettin an error as mutually inconvertible.
    <b><u>eg. error</u></b>
    "XVBRK" and "ARC_BUFFER-SEGMENT" are not mutually convertible in a Unicode program.
    here xvbrk is like vbrk and contains more than 100 fields and i hve 15 errors to deal of same kind.
    so anyone can help me with any technique to do this.

    at what line of code does this error occur. Are "XVBRK" and "ARC_BUFFER-SEGMENT"  of the same type.

  • Project - reg.,

    Hi, guru's,
    Can anybody clarify to ,what to answer for a question, what will you do when you start a project as a MM consultant / what will you do at the beginning of a project?
    Please answer
    thanks in advance
    tulja singh.

    Pls refer to the ASAP methodology doc. there u can find the role of any functional consultant
    the brief is as under-
    1.Project Preparation:
    •Initial Project Planning
    •Project Procedures
    •Training
    •Project Kickoff
    •Technical Requirements
    •Quality Check
    2.Business Blueprint
    •Project Management
    •Organizational Change Management
    •Training
    •Develop System Environment
    •Organizational Structure Definition
    •Business Process Analysis
    •Business Process Defintion
    •Quality Check
    3.Realization
    •Project Management
    •Organizational Change Management
    •Training
    •Baseline Configuration and Confirmation
    •System Management
    •Final Configuration and Confirmation
    •Develop Programs, Interfaces etc.
    •Final Integration Test
    •Quality Check
    4.Final Preparation
    •Project Management
    •Training
    •System Management
    •Detailed Project Planning
    •Cutover
    •Quality Check
    5. Go Live & Support
    •Production Support
    •Project End
    Continuous Improvement
    Sheetal

  • Unicode X type length

    Hi
    I have requirement for type conversion in unicode project.
    I have a struct used in overlay statement
    OVERLAY B0004 WITH SREP ONLY REPLSET.
    but in unicode only char type structure need to use for ONLY [pattern].
    here what should be length of line0, line1.......
    or how to convert the hot coded data into Char type variable?
    Please help me....
    DATA: BEGIN OF REPLSET,
          LINE0(16) TYPE X VALUE '000102030405060708090A0B0C0D0E0F',
          LINE1(16) TYPE X VALUE '101112131415161718191A1B1C1D1E1F',
          LINE2(02) TYPE X VALUE '2227',
          LINE7(01) TYPE X VALUE '7F',
          LINE8(13) TYPE X VALUE '8182838485868788898B8D8E8F',
          LINE9(14) TYPE X VALUE '909192939495969798999B9D9E9F',
          LINEA(11) TYPE X VALUE 'A0A4A6A8A9AAABACADAEAF',
          LINEB(15) TYPE X VALUE 'B0B1B2B3B4B5B6B7B8B9BABBBCBDBE',
          LINED(01) TYPE X VALUE 'DF',
    END OF REPLSET.

    Can we use like this:
    DATA: BEGIN OF REPLSET,
          LINE0(16) TYPE c VALUE cl_abap_char_utilities=>horizontal_tab
    VALUE '000102030405060708090A0B0C0D0E0F',
          LINE1(16) TYPE c VALUE cl_abap_char_utilities=>horizontal_tab VALUE '101112131415161718191A1B1C1D1E1F',
          LINE2(02) TYPE c VALUE cl_abap_char_utilities=>horizontal_tab VALUE '2227',
          LINE7(01) TYPE c VALUE cl_abap_char_utilities=>horizontal_tab VALUE '7F',
          LINE8(13) TYPE c VALUE cl_abap_char_utilities=>horizontal_tab VALUE '8182838485868788898B8D8E8F',
          LINE9(14) TYPE c VALUE cl_abap_char_utilities=>horizontal_tab VALUE '909192939495969798999B9D9E9F',
          LINEA(11) TYPE c VALUE cl_abap_char_utilities=>horizontal_tab VALUE 'A0A4A6A8A9AAABACADAEAF',
          LINEB(15) TYPE c VALUE cl_abap_char_utilities=>horizontal_tab VALUE 'B0B1B2B3B4B5B6B7B8B9BABBBCBDBE',
          LINED(01) TYPE c VALUE cl_abap_char_utilities=>horizontal_tab VALUE 'DF',
    END OF REPLSET.
    Do I need to change length here?
    please help me

  • ORA-06502: PL/SQL: numeric or value error: Bulk bind: Error in define

    Hi All,
    Getting aforesaid error while executing a procedure.
    I have a procedure which takes 7 paramneters and have 13 IN OUT parameters. all the IN OUT parameters are PLSQL tables of number and varchar2.
    I Have checked there are no not null columns this procedure is just seelcting these values and assigning it to plsql table.
    Regards
    Manish

    Thanks for the reply.
    This is the procedure which returns the list of projects
    PROCEDURE DS$2342_PROC
    (P_PROJECT_ID_ARR IN DS$REF.TT_PRO_ID
    ,P_PAGE_NO IN NUMBER
    ,P_RECORDS_PER_PAGE IN NUMBER
    ,P_USER_ID IN USERS.ID%TYPE
    ,P_SORT_ORDER IN VARCHAR2
    ,P_PSE_ID IN PORTAL_SERVICES.ID%TYPE
    ,P_LAST_ACCESSED_DATE IN VARCHAR2
    ,O_PRO_ALL_ID_ARRAY IN OUT DS$REF.TT_PRO_ID
    ,O_PRO_ID_ARRAY IN OUT DS$REF.TT_PRO_ID
    ,O_NAME_ARRAY IN OUT DS$REF.TT_VARCHAR2
    ,O_TYPE_OF_WORK_ARRAY IN OUT DS$REF.TT_VARCHAR2
    ,O_STAGE_ARRAY IN OUT DS$REF.TT_VARCHAR2
    ,O_LOC_ARRAY IN OUT DS$REF.TT_VARCHAR2
    ,O_CURRENCY_ARRAY IN OUT DS$REF.TT_VARCHAR2
    ,O_VALUE_ARRAY IN OUT DS$REF.TT_NUMBER
    ,O_DISPLAY_VALUE_ARRAY IN OUT DS$REF.TT_VARCHAR2
    ,O_LATEST_UPDATED_DATE_ARRAY IN OUT DS$REF.TT_VARCHAR2
    ,O_FLAG_ARRAY IN OUT DS$REF.TT_VARCHAR2
    ,O_LOCATION IN OUT DS$REF.TT_VARCHAR2
    IS
    BEGIN
    DECLARE
    List of parameters
    1.p_project_id_arr Projects id.
    2.p_page_no Page number.
    3.p_records_per_page Records per page.
    4.p_user_id User id.
    5.p_sort_order Sorting by column.
    6.p_pse_id Portal service id.
    7.p_last_accessed_date User last accessed date
    Output parameters
    1. o_pro_all_id_array Project id array
    2. o_pro_id_array Project id array as per records to be displayed
    3. o_name_array Project title array
    4. o_type_of_work_array Project type of work array
    5. o_stage_array Project stage array
    6. o_loc_array Project location array
    7. o_currency_array Project currency array
    8. o_value_array Project values array
    9. o_display_value_array Project display values array
    10. o_latest_updated_date_array Project latest updated date
    11. o_flag_array Flags for new and updated watch icon, project notes, download leads
    12. o_location Location
    v_status CONSTANT EXTRACT_BATCH_HEADERS.STATUS%TYPE := 'OPN';
    CURSOR c_psc(qp_pse_id PORTAL_SERVICES.ID%TYPE) IS
    SELECT DISTINCT psc.LOCATION_REPORTING_LEVEL
    FROM PORTAL_SCS psc
    WHERE psc.START_DATE <= SYSDATE
    AND ( psc.END_DATE IS NULL
    OR psc.END_DATE > SYSDATE )
    AND psc.LOCATION_REPORTING_LEVEL IS NOT NULL
    AND psc.PSE_ID = qp_pse_id;
    CURSOR c_projects_name_order_asc IS
    SELECT pro.ID id
    FROM PROJECTS pro,
    TMP_PROJECTS tmp
    WHERE pro.ID = tmp.PRO_ID
    ORDER BY pro.NAME;
    CURSOR c_projects_name_order_desc IS
    SELECT pro.ID id
    FROM PROJECTS pro,
    TMP_PROJECTS tmp
    WHERE pro.ID = tmp.PRO_ID
    ORDER BY pro.NAME DESC;
    CURSOR c_projects_work_order_asc IS
    SELECT pro.ID id
    FROM PROJECTS pro,
    TMP_PROJECTS tmp
    WHERE pro.ID = tmp.PRO_ID
    ORDER BY TYPE_OF_WORK;
    CURSOR c_projects_work_order_desc IS
    SELECT pro.ID id
    FROM PROJECTS pro,
    TMP_PROJECTS tmp
    WHERE pro.ID = tmp.PRO_ID
    ORDER BY TYPE_OF_WORK DESC;
    CURSOR c_projects_stage_order_asc IS
    SELECT pro.ID id
    FROM PROJECTS pro,
    TMP_PROJECTS tmp
    WHERE pro.ID = tmp.PRO_ID
    ORDER BY pro.STAGE;
    CURSOR c_projects_stage_order_desc IS
    SELECT pro.ID id
    FROM PROJECTS pro,
         TMP_PROJECTS tmp
    WHERE pro.ID = tmp.PRO_ID
    ORDER BY pro.STAGE DESC;
    /* Cursor changed by Tushar on 08/02/2005 */
    CURSOR c_projects_loc_order_asc (cp_location PORTAL_SCS.LOCATION_REPORTING_LEVEL%TYPE) IS
    SELECT pro.ID id,
    DECODE(cp_location,'T',NVL(pro.ADDRESS_LINE_3,pro.ADDRESS_LINE_4)
    ,'C',pro.ADDRESS_LINE_4) location
    FROM PROJECTS pro,
    TMP_PROJECTS tmp
    WHERE pro.ID = tmp.PRO_ID
    -- ORDER BY DECODE(cp_location,'T',NVL(pro.ADDRESS_LINE_3,pro.ADDRESS_LINE_4)
    -- ,'C',pro.ADDRESS_LINE_4),
    ORDER BY DECODE(cp_location
    ,'T',NVL(pro.ADDRESS_LINE_3,pro.ADDRESS_LINE_4)
    ,'C',pro.ADDRESS_LINE_4)||', '||
    SUBSTR(POST_CODE,1,DECODE(LTRIM(INSTR(POST_CODE,' ')),0,
    LENGTH(POST_CODE),LTRIM(INSTR(POST_CODE,' ')))),
    TRUNC(pro.LATEST_UPDATED_DATE) DESC,
    pro.VALUE DESC,
    pro.ID DESC;
    /* Cursor changed by Tushar on 08/02/2005 */
    CURSOR c_projects_loc_order_desc (cp_location PORTAL_SCS.LOCATION_REPORTING_LEVEL%TYPE) IS
    SELECT pro.ID id,
    DECODE(cp_location,'T',NVL(pro.ADDRESS_LINE_3,pro.ADDRESS_LINE_4)
    ,'C',pro.ADDRESS_LINE_4) location
    FROM PROJECTS pro,
    TMP_PROJECTS tmp
    WHERE pro.ID = tmp.PRO_ID
    -- ORDER BY DECODE(cp_location,'T',NVL(pro.ADDRESS_LINE_3,pro.ADDRESS_LINE_4)
    -- ,'C',pro.ADDRESS_LINE_4),
    ORDER BY DECODE(cp_location
    ,'T',NVL(pro.ADDRESS_LINE_3,pro.ADDRESS_LINE_4)
    ,'C',pro.ADDRESS_LINE_4)||', '||
    SUBSTR(POST_CODE,1,DECODE(LTRIM(INSTR(POST_CODE,' ')),0,
    LENGTH(POST_CODE),LTRIM(INSTR(POST_CODE,' ')))) DESC,
    TRUNC(pro.LATEST_UPDATED_DATE) DESC,
    pro.VALUE DESC,
    pro.ID DESC;
    /* Cursor changed by Tushar on 08/02/2005 */
    CURSOR c_projects_value_order_asc(cp_location PORTAL_SCS.LOCATION_REPORTING_LEVEL%TYPE) IS
    SELECT pro.ID id,
    DECODE(cp_location,'T',NVL(pro.ADDRESS_LINE_3,pro.ADDRESS_LINE_4)
    ,'C',pro.ADDRESS_LINE_4) location
    FROM PROJECTS pro,
    TMP_PROJECTS tmp
    WHERE pro.ID = tmp.PRO_ID
    ORDER BY pro.VALUE,
    TRUNC(pro.LATEST_UPDATED_DATE),
    -- DECODE(cp_location,'T',NVL(pro.ADDRESS_LINE_3,pro.ADDRESS_LINE_4)
    -- ,'C',pro.ADDRESS_LINE_4),
    DECODE(cp_location
    ,'T',NVL(pro.ADDRESS_LINE_3,pro.ADDRESS_LINE_4)
    ,'C',pro.ADDRESS_LINE_4)||', '||
    SUBSTR(POST_CODE,1,DECODE(LTRIM(INSTR(POST_CODE,' ')),0,
    LENGTH(POST_CODE),LTRIM(INSTR(POST_CODE,' ')))),
    pro.ID DESC;
    /* Cursor changed by Tushar on 08/02/2005 */
    CURSOR c_projects_value_order_desc(cp_location PORTAL_SCS.LOCATION_REPORTING_LEVEL%TYPE) IS
    SELECT pro.ID id,
    DECODE(cp_location,'T',NVL(pro.ADDRESS_LINE_3,pro.ADDRESS_LINE_4)
    ,'C',pro.ADDRESS_LINE_4) location
    FROM PROJECTS pro,
    TMP_PROJECTS tmp
    WHERE pro.ID = tmp.PRO_ID
    ORDER BY pro.VALUE DESC,
    TRUNC(pro.LATEST_UPDATED_DATE) DESC,
    -- DECODE(cp_location,'T',NVL(pro.ADDRESS_LINE_3,pro.ADDRESS_LINE_4)
    -- ,'C',pro.ADDRESS_LINE_4),
    DECODE(cp_location
    ,'T',NVL(pro.ADDRESS_LINE_3,pro.ADDRESS_LINE_4)
    ,'C',pro.ADDRESS_LINE_4)||', '||
    SUBSTR(POST_CODE,1,DECODE(LTRIM(INSTR(POST_CODE,' ')),0,
    LENGTH(POST_CODE),LTRIM(INSTR(POST_CODE,' ')))),
    pro.ID DESC;
    /* Cursor changed by Tushar on 08/02/2005 */
    CURSOR c_projects_lud_order_asc(cp_location PORTAL_SCS.LOCATION_REPORTING_LEVEL%TYPE) IS
    SELECT pro.ID id,
    DECODE(cp_location,'T',NVL(pro.ADDRESS_LINE_3,pro.ADDRESS_LINE_4)
    ,'C',pro.ADDRESS_LINE_4) location
    FROM PROJECTS pro,
    TMP_PROJECTS tmp
    WHERE pro.ID = tmp.PRO_ID
    ORDER BY TRUNC(pro.LATEST_UPDATED_DATE),
    pro.VALUE DESC,
    -- DECODE(cp_location,'T',NVL(pro.ADDRESS_LINE_3,pro.ADDRESS_LINE_4)
    -- ,'C',pro.ADDRESS_LINE_4),
    DECODE(cp_location
    ,'T',NVL(pro.ADDRESS_LINE_3,pro.ADDRESS_LINE_4)
    ,'C',pro.ADDRESS_LINE_4)||', '||
    SUBSTR(POST_CODE,1,DECODE(LTRIM(INSTR(POST_CODE,' ')),0,
    LENGTH(POST_CODE),LTRIM(INSTR(POST_CODE,' ')))),
    pro.ID DESC;
    /* Cursor changed by Tushar on 08/02/2005 */
    CURSOR c_projects_lud_order_desc(cp_location PORTAL_SCS.LOCATION_REPORTING_LEVEL%TYPE) IS
    SELECT pro.ID id,
    DECODE(cp_location,'T',NVL(pro.ADDRESS_LINE_3,pro.ADDRESS_LINE_4)
    ,'C',pro.ADDRESS_LINE_4) location
    FROM PROJECTS pro,
    TMP_PROJECTS tmp
    WHERE pro.ID = tmp.PRO_ID
    ORDER BY TRUNC(pro.LATEST_UPDATED_DATE) DESC,
    pro.VALUE DESC,
    -- DECODE(cp_location,'T',NVL(pro.ADDRESS_LINE_3,pro.ADDRESS_LINE_4)
    -- ,'C',pro.ADDRESS_LINE_4),
    DECODE(cp_location
    ,'T',NVL(pro.ADDRESS_LINE_3,pro.ADDRESS_LINE_4)
    ,'C',pro.ADDRESS_LINE_4)||', '||
    SUBSTR(POST_CODE,1,DECODE(LTRIM(INSTR(POST_CODE,' ')),0,
    LENGTH(POST_CODE),LTRIM(INSTR(POST_CODE,' ')))),
    pro.ID DESC;
    /*Cursors for project details depending on order by clause */
    /* Cursor for order by name ascending */
    CURSOR c_pro_sum_name_asc(cp_pse_id PORTAL_SERVICES.ID%TYPE,
    cp_user_id USERS.ID%TYPE,
    cp_status EXTRACT_BATCH_HEADERS.STATUS%TYPE,
    cp_loc_lvl PORTAL_SCS.LOCATION_REPORTING_LEVEL%TYPE,
    cp_last_accessed_date USERS.LAST_ACCESSED_DATE%TYPE ) IS
    SELECT pro.ID id,
    pro.NAME name,
    pro.TYPE_OF_WORK type_of_work,
    pro.STAGE stage,
    DECODE(cp_loc_lvl
    ,'T',NVL(pro.ADDRESS_LINE_3,pro.ADDRESS_LINE_4)
    ,'C',pro.ADDRESS_LINE_4)||', '||
    SUBSTR(POST_CODE,1,DECODE(LTRIM(INSTR(POST_CODE,' ')),0,
    LENGTH(POST_CODE),LTRIM(INSTR(POST_CODE,' ')))) location,
    pro.Currency currency,
    pro.VALUE value,
    pro.DISPLAY_VALUE display_value,
    TO_CHAR(pro.LATEST_UPDATED_DATE,'DD/MM/YYYY') latest_updated_date,
    DECODE(pro.LATEST_UPDATED_DATE, pro.CREATED_DATE,
    'true','false')
    ||'~'||DECODE(SIGN(cp_last_accessed_date -
    TRUNC(pro.LATEST_UPDATED_DATE)
    ),0,'true'
    ,-1,'true'
    ,1,'false')
    ||'~'||DECODE(wrt_rec.wrt_pro_id,NULL,'false','true')
    ||'~'||DECODE(pne_rec.pne_pro_id,NULL,'false','true')
    ||'~'||DECODE(ebr_rec.ebr_status,cp_status,'true','false') flags
    FROM PROJECTS pro,
    TMP_PROJECTS tmp,
    (SELECT wrt.PRO_ID wrt_pro_id
    FROM WATCH_REQUESTS wrt,
    TMP_PROJECTS tmp_sub
    WHERE wrt.VIEWED_DATE IS NULL
    AND wrt.PSR_PSN_PSE_ID = cp_pse_id
    AND wrt.PSR_USR_ID = cp_user_id
    AND tmp_sub.PRO_ID = wrt.PRO_ID
    GROUP BY wrt.PRO_ID) wrt_rec,
    (SELECT pne.PRO_ID pne_pro_id
    FROM PROJECT_NOTES pne,
    TMP_PROJECTS tmp_pne
    WHERE pne.USR_ID = cp_user_id
    AND tmp_pne.PRO_ID = pne.PRO_ID) pne_rec,
    (SELECT ebr.STATUS ebr_status,
    ebp.PRO_ID ebp_pro_id
    FROM EXTRACT_BATCH_HEADERS ebr,
    EXTRACT_BATCH_PROJECTS ebp,
    TMP_PROJECTS tmp_ebr
    WHERE ebr.ID = ebp.EBR_ID
    AND ebp.PRO_ID = tmp_ebr.PRO_ID
    AND ebr.USR_ID = cp_user_id
    AND ebr.STATUS = cp_status) ebr_rec
    WHERE pro.ID = tmp.PRO_ID
    AND pro.ID = wrt_rec.wrt_pro_id(+)
    AND pro.ID = pne_rec.pne_pro_id(+)
    AND pro.ID = ebr_rec.ebp_pro_id(+)
    ORDER BY pro.NAME;
    /* Cursor for order by name descending */
    CURSOR c_pro_sum_name_dsc(cp_pse_id PORTAL_SERVICES.ID%TYPE,
    cp_user_id USERS.ID%TYPE,
    cp_status EXTRACT_BATCH_HEADERS.STATUS%TYPE,
    cp_loc_lvl PORTAL_SCS.LOCATION_REPORTING_LEVEL%TYPE,
    cp_last_accessed_date USERS.LAST_ACCESSED_DATE%TYPE ) IS
    SELECT pro.ID id,
    pro.NAME name,
    pro.TYPE_OF_WORK type_of_work,
    pro.STAGE stage,
    DECODE(cp_loc_lvl
    ,'T',NVL(pro.ADDRESS_LINE_3,pro.ADDRESS_LINE_4)
    ,'C',pro.ADDRESS_LINE_4)||', '||
    SUBSTR(POST_CODE,1,DECODE(LTRIM(INSTR(POST_CODE,' ')),0,
    LENGTH(POST_CODE),LTRIM(INSTR(POST_CODE,' ')))) location,
    pro.Currency currency,
    pro.VALUE value,
    pro.DISPLAY_VALUE display_value,
    TO_CHAR(pro.LATEST_UPDATED_DATE,'DD/MM/YYYY') latest_updated_date,
    DECODE(pro.LATEST_UPDATED_DATE, pro.CREATED_DATE,
    'true','false')
    ||'~'||DECODE(SIGN(cp_last_accessed_date -
    TRUNC(pro.LATEST_UPDATED_DATE)
    ),0,'true'
    ,-1,'true'
    ,1,'false')
    ||'~'||DECODE(wrt_rec.wrt_pro_id,NULL,'false','true')
    ||'~'||DECODE(pne_rec.pne_pro_id,NULL,'false','true')
    ||'~'||DECODE(ebr_rec.ebr_status,cp_status,'true','false') flags
    FROM PROJECTS pro,
    TMP_PROJECTS tmp,
    (SELECT wrt.PRO_ID wrt_pro_id
    FROM WATCH_REQUESTS wrt,
    TMP_PROJECTS tmp_sub
    WHERE wrt.VIEWED_DATE IS NULL
    AND wrt.PSR_PSN_PSE_ID = cp_pse_id
    AND wrt.PSR_USR_ID = cp_user_id
    AND tmp_sub.PRO_ID = wrt.PRO_ID
    GROUP BY wrt.PRO_ID) wrt_rec,
    (SELECT pne.PRO_ID pne_pro_id
    FROM PROJECT_NOTES pne,
    TMP_PROJECTS tmp_pne
    WHERE pne.USR_ID = cp_user_id
    AND tmp_pne.PRO_ID = pne.PRO_ID) pne_rec,
    (SELECT ebr.STATUS ebr_status,
    ebp.PRO_ID ebp_pro_id
    FROM EXTRACT_BATCH_HEADERS ebr,
    EXTRACT_BATCH_PROJECTS ebp,
    TMP_PROJECTS tmp_ebr
    WHERE ebr.ID = ebp.EBR_ID
    AND ebp.PRO_ID = tmp_ebr.PRO_ID
    AND ebr.USR_ID = cp_user_id
    AND ebr.STATUS = cp_status) ebr_rec
    WHERE pro.ID = tmp.PRO_ID
    AND pro.ID = wrt_rec.wrt_pro_id(+)
    AND pro.ID = pne_rec.pne_pro_id(+)
    AND pro.ID = ebr_rec.ebp_pro_id(+)
    ORDER BY pro.NAME DESC;
    /* Cursor for order by TYPE_OF_WORK asc*/
    CURSOR c_pro_sum_work_asc(cp_pse_id PORTAL_SERVICES.ID%TYPE,
    cp_user_id USERS.ID%TYPE,
    cp_status EXTRACT_BATCH_HEADERS.STATUS%TYPE,
    cp_loc_lvl PORTAL_SCS.LOCATION_REPORTING_LEVEL%TYPE,
    cp_last_accessed_date USERS.LAST_ACCESSED_DATE%TYPE ) IS
    SELECT pro.ID id,
    pro.NAME name,
    pro.TYPE_OF_WORK type_of_work,
    pro.STAGE stage,
    DECODE(cp_loc_lvl
    ,'T',NVL(pro.ADDRESS_LINE_3,pro.ADDRESS_LINE_4)
    ,'C',pro.ADDRESS_LINE_4)||', '||
    SUBSTR(POST_CODE,1,DECODE(LTRIM(INSTR(POST_CODE,' ')),0,
    LENGTH(POST_CODE),LTRIM(INSTR(POST_CODE,' ')))) location,
    pro.Currency currency,
    pro.VALUE value,
    pro.DISPLAY_VALUE display_value,
    TO_CHAR(pro.LATEST_UPDATED_DATE,'DD/MM/YYYY') latest_updated_date,
    DECODE(pro.LATEST_UPDATED_DATE, pro.CREATED_DATE,
    'true','false')
    ||'~'||DECODE(SIGN(cp_last_accessed_date -
    TRUNC(pro.LATEST_UPDATED_DATE)
    ),0,'true'
    ,-1,'true'
    ,1,'false')
    ||'~'||DECODE(wrt_rec.wrt_pro_id,NULL,'false','true')
    ||'~'||DECODE(pne_rec.pne_pro_id,NULL,'false','true')
    ||'~'||DECODE(ebr_rec.ebr_status,cp_status,'true','false') flags
    FROM PROJECTS pro,
    TMP_PROJECTS tmp,
    (SELECT wrt.PRO_ID wrt_pro_id
    FROM WATCH_REQUESTS wrt,
    TMP_PROJECTS tmp_sub
    WHERE wrt.VIEWED_DATE IS NULL
    AND wrt.PSR_PSN_PSE_ID = cp_pse_id
    AND wrt.PSR_USR_ID = cp_user_id
    AND tmp_sub.PRO_ID = wrt.PRO_ID
    GROUP BY wrt.PRO_ID) wrt_rec,
    (SELECT pne.PRO_ID pne_pro_id
    FROM PROJECT_NOTES pne,
    TMP_PROJECTS tmp_pne
    WHERE pne.USR_ID = cp_user_id
    AND tmp_pne.PRO_ID = pne.PRO_ID) pne_rec,
    (SELECT ebr.STATUS ebr_status,
    ebp.PRO_ID ebp_pro_id
    FROM EXTRACT_BATCH_HEADERS ebr,
    EXTRACT_BATCH_PROJECTS ebp,
    TMP_PROJECTS tmp_ebr
    WHERE ebr.ID = ebp.EBR_ID
    AND ebp.PRO_ID = tmp_ebr.PRO_ID
    AND ebr.USR_ID = cp_user_id
    AND ebr.STATUS = cp_status) ebr_rec
    WHERE pro.ID = tmp.PRO_ID
    AND pro.ID = wrt_rec.wrt_pro_id(+)
    AND pro.ID = pne_rec.pne_pro_id(+)
    AND pro.ID = ebr_rec.ebp_pro_id(+)
    ORDER BY pro.TYPE_OF_WORK;
    /* Cursor for order by TYPE_OF_WORK descending */
    CURSOR c_pro_sum_work_dsc(cp_pse_id PORTAL_SERVICES.ID%TYPE,
    cp_user_id USERS.ID%TYPE,
    cp_status EXTRACT_BATCH_HEADERS.STATUS%TYPE,
    cp_loc_lvl PORTAL_SCS.LOCATION_REPORTING_LEVEL%TYPE,
    cp_last_accessed_date USERS.LAST_ACCESSED_DATE%TYPE ) IS
    SELECT pro.ID id,
    pro.NAME name,
    pro.TYPE_OF_WORK type_of_work,
    pro.STAGE stage,
    DECODE(cp_loc_lvl
    ,'T',NVL(pro.ADDRESS_LINE_3,pro.ADDRESS_LINE_4)
    ,'C',pro.ADDRESS_LINE_4)||', '||
    SUBSTR(POST_CODE,1,DECODE(LTRIM(INSTR(POST_CODE,' ')),0,
    LENGTH(POST_CODE),LTRIM(INSTR(POST_CODE,' ')))) location,
    pro.Currency currency,
    pro.VALUE value,
    pro.DISPLAY_VALUE display_value,
    TO_CHAR(pro.LATEST_UPDATED_DATE,'DD/MM/YYYY') latest_updated_date,
    DECODE(pro.LATEST_UPDATED_DATE, pro.CREATED_DATE,
    'true','false')
    ||'~'||DECODE(SIGN(cp_last_accessed_date -
    TRUNC(pro.LATEST_UPDATED_DATE)
    ),0,'true'
    ,-1,'true'
    ,1,'false')
    ||'~'||DECODE(wrt_rec.wrt_pro_id,NULL,'false','true')
    ||'~'||DECODE(pne_rec.pne_pro_id,NULL,'false','true')
    ||'~'||DECODE(ebr_rec.ebr_status,cp_status,'true','false') flags
    FROM PROJECTS pro,
    TMP_PROJECTS tmp,
    (SELECT wrt.PRO_ID wrt_pro_id
    FROM WATCH_REQUESTS wrt,
    TMP_PROJECTS tmp_sub
    WHERE wrt.VIEWED_DATE IS NULL
    AND wrt.PSR_PSN_PSE_ID = cp_pse_id
    AND wrt.PSR_USR_ID = cp_user_id
    AND tmp_sub.PRO_ID = wrt.PRO_ID
    GROUP BY wrt.PRO_ID) wrt_rec,
    (SELECT pne.PRO_ID pne_pro_id
    FROM PROJECT_NOTES pne,
    TMP_PROJECTS tmp_pne
    WHERE pne.USR_ID = cp_user_id
    AND tmp_pne.PRO_ID = pne.PRO_ID) pne_rec,
    (SELECT ebr.STATUS ebr_status,
    ebp.PRO_ID ebp_pro_id
    FROM EXTRACT_BATCH_HEADERS ebr,
    EXTRACT_BATCH_PROJECTS ebp,
    TMP_PROJECTS tmp_ebr
    WHERE ebr.ID = ebp.EBR_ID
    AND ebp.PRO_ID = tmp_ebr.PRO_ID
    AND ebr.USR_ID = cp_user_id
    AND ebr.STATUS = cp_status) ebr_rec
    WHERE pro.ID = tmp.PRO_ID
    AND pro.ID = wrt_rec.wrt_pro_id(+)
    AND pro.ID = pne_rec.pne_pro_id(+)
    AND pro.ID = ebr_rec.ebp_pro_id(+)
    ORDER BY pro.TYPE_OF_WORK DESC;
    /* Cursor for order by STAGE asc*/
    CURSOR c_pro_sum_stage_asc(cp_pse_id PORTAL_SERVICES.ID%TYPE,
    cp_user_id USERS.ID%TYPE,
    cp_status EXTRACT_BATCH_HEADERS.STATUS%TYPE,
    cp_loc_lvl PORTAL_SCS.LOCATION_REPORTING_LEVEL%TYPE,
    cp_last_accessed_date USERS.LAST_ACCESSED_DATE%TYPE ) IS
    SELECT pro.ID id,
    pro.NAME name,
    pro.TYPE_OF_WORK type_of_work,
    pro.STAGE stage,
    DECODE(cp_loc_lvl
    ,'T',NVL(pro.ADDRESS_LINE_3,pro.ADDRESS_LINE_4)
    ,'C',pro.ADDRESS_LINE_4)||', '||
    SUBSTR(POST_CODE,1,DECODE(LTRIM(INSTR(POST_CODE,' ')),0,
    LENGTH(POST_CODE),LTRIM(INSTR(POST_CODE,' ')))) location,
    pro.Currency currency,
    pro.VALUE value,
    pro.DISPLAY_VALUE display_value,
    TO_CHAR(pro.LATEST_UPDATED_DATE,'DD/MM/YYYY') latest_updated_date,
    DECODE(pro.LATEST_UPDATED_DATE, pro.CREATED_DATE,
    'true','false')
    ||'~'||DECODE(SIGN(cp_last_accessed_date -
    TRUNC(pro.LATEST_UPDATED_DATE)
    ),0,'true'
    ,-1,'true'
    ,1,'false')
    ||'~'||DECODE(wrt_rec.wrt_pro_id,NULL,'false','true')
    ||'~'||DECODE(pne_rec.pne_pro_id,NULL,'false','true')
    ||'~'||DECODE(ebr_rec.ebr_status,cp_status,'true','false') flags
    FROM PROJECTS pro,
    TMP_PROJECTS tmp,
    (SELECT wrt.PRO_ID wrt_pro_id
    FROM WATCH_REQUESTS wrt,
    TMP_PROJECTS tmp_sub
    WHERE wrt.VIEWED_DATE IS NULL
    AND wrt.PSR_PSN_PSE_ID = cp_pse_id
    AND wrt.PSR_USR_ID = cp_user_id
    AND tmp_sub.PRO_ID = wrt.PRO_ID
    GROUP BY wrt.PRO_ID) wrt_rec,
    (SELECT pne.PRO_ID pne_pro_id
    FROM PROJECT_NOTES pne,
    TMP_PROJECTS tmp_pne
    WHERE pne.USR_ID = cp_user_id
    AND tmp_pne.PRO_ID = pne.PRO_ID) pne_rec,
    (SELECT ebr.STATUS ebr_status,
    ebp.PRO_ID ebp_pro_id
    FROM EXTRACT_BATCH_HEADERS ebr,
    EXTRACT_BATCH_PROJECTS ebp,
    TMP_PROJECTS tmp_ebr
    WHERE ebr.ID = ebp.EBR_ID
    AND ebp.PRO_ID = tmp_ebr.PRO_ID
    AND ebr.USR_ID = cp_user_id
    AND ebr.STATUS = cp_status) ebr_rec
    WHERE pro.ID = tmp.PRO_ID
    AND pro.ID = wrt_rec.wrt_pro_id(+)
    AND pro.ID = pne_rec.pne_pro_id(+)
    AND pro.ID = ebr_rec.ebp_pro_id(+)
    ORDER BY pro.STAGE;
    /* Cursor for order by STAGE descending */
    CURSOR c_pro_sum_stage_dsc(cp_pse_id PORTAL_SERVICES.ID%TYPE,
    cp_user_id USERS.ID%TYPE,
    cp_status EXTRACT_BATCH_HEADERS.STATUS%TYPE,
    cp_loc_lvl PORTAL_SCS.LOCATION_REPORTING_LEVEL%TYPE,
    cp_last_accessed_date USERS.LAST_ACCESSED_DATE%TYPE ) IS
    SELECT pro.ID id,
    pro.NAME name,
    pro.TYPE_OF_WORK type_of_work,
    pro.STAGE stage,
    DECODE(cp_loc_lvl
    ,'T',NVL(pro.ADDRESS_LINE_3,pro.ADDRESS_LINE_4)
    ,'C',pro.ADDRESS_LINE_4)||', '||
    SUBSTR(POST_CODE,1,DECODE(LTRIM(INSTR(POST_CODE,' ')),0,
    LENGTH(POST_CODE),LTRIM(INSTR(POST_CODE,' ')))) location,
    pro.Currency currency,
    pro.VALUE value,
    pro.DISPLAY_VALUE display_value,
    TO_CHAR(pro.LATEST_UPDATED_DATE,'DD/MM/YYYY') latest_updated_date,
    DECODE(pro.LATEST_UPDATED_DATE, pro.CREATED_DATE,
    'true','false')
    ||'~'||DECODE(SIGN(cp_last_accessed_date -
    TRUNC(pro.LATEST_UPDATED_DATE)
    ),0,'true'
    ,-1,'true'
    ,1,'false')
    ||'~'||DECODE(wrt_rec.wrt_pro_id,NULL,'false','true')
    ||'~'||DECODE(pne_rec.pne_pro_id,NULL,'false','true')
    ||'~'||DECODE(ebr_rec.ebr_status,cp_status,'true','false') flags
    FROM PROJECTS pro,
    TMP_PROJECTS tmp,
    (SELECT wrt.PRO_ID wrt_pro_id
    FROM WATCH_REQUESTS wrt,
    TMP_PROJECTS tmp_sub
    WHERE wrt.VIEWED_DATE IS NULL
    AND wrt.PSR_PSN_PSE_ID = cp_pse_id
    AND wrt.PSR_USR_ID = cp_user_id
    AND tmp_sub.PRO_ID = wrt.PRO_ID
    GROUP BY wrt.PRO_ID) wrt_rec,
    (SELECT pne.PRO_ID pne_pro_id
    FROM PROJECT_NOTES pne,
    TMP_PROJECTS tmp_pne
    WHERE pne.USR_ID = cp_user_id
    AND tmp_pne.PRO_ID = pne.PRO_ID) pne_rec,
    (SELECT ebr.STATUS ebr_status,
    ebp.PRO_ID ebp_pro_id
    FROM EXTRACT_BATCH_HEADERS ebr,
    EXTRACT_BATCH_PROJECTS ebp,
    TMP_PROJECTS tmp_ebr
    WHERE ebr.ID = ebp.EBR_ID
    AND ebp.PRO_ID = tmp_ebr.PRO_ID
    AND ebr.USR_ID = cp_user_id
    AND ebr.STATUS = cp_status) ebr_rec
    WHERE pro.ID = tmp.PRO_ID
    AND pro.ID = wrt_rec.wrt_pro_id(+)
    AND pro.ID = pne_rec.pne_pro_id(+)
    AND pro.ID = ebr_rec.ebp_pro_id(+)
    ORDER BY pro.STAGE DESC;
    /* Cursor for order by LOCATION asc*/
    CURSOR c_pro_sum_loc_asc(cp_pse_id PORTAL_SERVICES.ID%TYPE,
    cp_user_id USERS.ID%TYPE,
    cp_status EXTRACT_BATCH_HEADERS.STATUS%TYPE,
    cp_loc_lvl PORTAL_SCS.LOCATION_REPORTING_LEVEL%TYPE,
    cp_last_accessed_date USERS.LAST_ACCESSED_DATE%TYPE ) IS
    SELECT pro.ID id,
    pro.NAME name,
    pro.TYPE_OF_WORK type_of_work,
    pro.STAGE stage,
    DECODE(cp_loc_lvl
    ,'T',NVL(pro.ADDRESS_LINE_3,pro.ADDRESS_LINE_4)
    ,'C',pro.ADDRESS_LINE_4)||', '||
    SUBSTR(POST_CODE,1,DECODE(LTRIM(INSTR(POST_CODE,' ')),0,
    LENGTH(POST_CODE),LTRIM(INSTR(POST_CODE,' ')))) location,
    pro.Currency currency,
    pro.VALUE value,
    pro.DISPLAY_VALUE display_value,
    TO_CHAR(pro.LATEST_UPDATED_DATE,'DD/MM/YYYY') latest_updated_date,
    DECODE(pro.LATEST_UPDATED_DATE, pro.CREATED_DATE,
    'true','false')
    ||'~'||DECODE(SIGN(cp_last_accessed_date -
    TRUNC(pro.LATEST_UPDATED_DATE)
    ),0,'true'
    ,-1,'true'
    ,1,'false')
    ||'~'||DECODE(wrt_rec.wrt_pro_id,NULL,'false','true')
    ||'~'||DECODE(pne_rec.pne_pro_id,NULL,'false','true')
    ||'~'||DECODE(ebr_rec.ebr_status,cp_status,'true','false') flags
    FROM PROJECTS pro,
    TMP_PROJECTS tmp,
    (SELECT wrt.PRO_ID wrt_pro_id
    FROM WATCH_REQUESTS wrt,
    TMP_PROJECTS tmp_sub
    WHERE wrt.VIEWED_DATE IS NULL
    AND wrt.PSR_PSN_PSE_ID = cp_pse_id
    AND wrt.PSR_USR_ID = cp_user_id
    AND tmp_sub.PRO_ID = wrt.PRO_ID
    GROUP BY wrt.PRO_ID) wrt_rec,
    (SELECT pne.PRO_ID pne_pro_id
    FROM PROJECT_NOTES pne,
    TMP_PROJECTS tmp_pne
    WHERE pne.USR_ID = cp_user_id
    AND tmp_pne.PRO_ID = pne.PRO_ID) pne_rec,
    (SELECT ebr.STATUS ebr_status,
    ebp.PRO_ID ebp_pro_id
    FROM EXTRACT_BATCH_HEADERS ebr,
    EXTRACT_BATCH_PROJECTS ebp,
    TMP_PROJECTS tmp_ebr
    WHERE ebr.ID = ebp.EBR_ID
    AND ebp.PRO_ID = tmp_ebr.PRO_ID
    AND ebr.USR_ID = cp_user_id
    AND ebr.STATUS = cp_status) ebr_rec
    WHERE pro.ID = tmp.PRO_ID
    AND pro.ID = wrt_rec.wrt_pro_id(+)
    AND pro.ID = pne_rec.pne_pro_id(+)
    AND pro.ID = ebr_rec.ebp_pro_id(+)
    -- ORDER BY DECODE(cp_loc_lvl
    -- ,'T',NVL(pro.ADDRESS_LINE_3,pro.ADDRESS_LINE_4)
    -- ,'C',pro.ADDRESS_LINE_4),
    ORDER BY DECODE(cp_loc_lvl
    ,'T',NVL(pro.ADDRESS_LINE_3,pro.ADDRESS_LINE_4)
    ,'C',pro.ADDRESS_LINE_4)||', '||
    SUBSTR(POST_CODE,1,DECODE(LTRIM(INSTR(POST_CODE,' ')),0,
    LENGTH(POST_CODE),LTRIM(INSTR(POST_CODE,' ')))),
    TRUNC(pro.LATEST_UPDATED_DATE)DESC,
    pro.VALUE DESC,
    pro.ID DESC;
    /* Cursor for order by LOCATION descending */
    CURSOR c_pro_sum_loc_dsc(cp_pse_id PORTAL_SERVICES.ID%TYPE,
    cp_user_id USERS.ID%TYPE,
    cp_status EXTRACT_BATCH_HEADERS.STATUS%TYPE,
    cp_loc_lvl PORTAL_SCS.LOCATION_REPORTING_LEVEL%TYPE,
    cp_last_accessed_date USERS.LAST_ACCESSED_DATE%TYPE ) IS
    SELECT pro.ID id,
    pro.NAME name,
    pro.TYPE_OF_WORK type_of_work,
    pro.STAGE stage,
    DECODE(cp_loc_lvl
    ,'T',NVL(pro.ADDRESS_LINE_3,pro.ADDRESS_LINE_4)
    ,'C',pro.ADDRESS_LINE_4)||', '||
    SUBSTR(POST_CODE,1,DECODE(LTRIM(INSTR(POST_CODE,' ')),0,
    LENGTH(POST_CODE),LTRIM(INSTR(POST_CODE,' ')))) location,
    pro.Currency currency,
    pro.VALUE value,
    pro.DISPLAY_VALUE display_value,
    TO_CHAR(pro.LATEST_UPDATED_DATE,'DD/MM/YYYY') latest_updated_date,
    DECODE(pro.LATEST_UPDATED_DATE, pro.CREATED_DATE,
    'true','false')
    ||'~'||DECODE(SIGN(cp_last_accessed_date -
    TRUNC(pro.LATEST_UPDATED_DATE)
    ),0,'true'
    ,-1,'true'
    ,1,'false')
    ||'~'||DECODE(wrt_rec.wrt_pro_id,NULL,'false','true')
    ||'~'||DECODE(pne_rec.pne_pro_id,NULL,'false','true')
    ||'~'||DECODE(ebr_rec.ebr_status,cp_status,'true','false') flags
    FROM PROJECTS pro,
    TMP_PROJECTS tmp,
    (SELECT wrt.PRO_ID wrt_pro_id
    FROM WATCH_REQUESTS wrt,
    TMP_PROJECTS tmp_sub
    WHERE wrt.VIEWED_DATE IS NULL
    AND wrt.PSR_PSN_PSE_ID = cp_pse_id
    AND wrt.PSR_USR_ID = cp_user_id
    AND tmp_sub.PRO_ID = wrt.PRO_ID
    GROUP BY wrt.PRO_ID) wrt_rec,
    (SELECT pne.PRO_ID pne_pro_id
    FROM PROJECT_NOTES pne,
    TMP_PROJECTS tmp_pne
    WHERE pne.USR_ID = cp_user_id
    AND tmp_pne.PRO_ID = pne.PRO_ID) pne_rec,
    (SELECT ebr.STATUS ebr_status,
    ebp.PRO_ID ebp_pro_id
    FROM EXTRACT_BATCH_HEADERS ebr,
    EXTRACT_BATCH_PROJECTS ebp,
    TMP_PROJECTS tmp_ebr
    WHERE ebr.ID = ebp.EBR_ID
    AND ebp.PRO_ID = tmp_ebr.PRO_ID
    AND ebr.USR_ID = cp_user_id
    AND ebr.STATUS = cp_status) ebr_rec
    WHERE pro.ID = tmp.PRO_ID
    AND pro.ID = wrt_rec.wrt_pro_id(+)
    AND pro.ID = pne_rec.pne_pro_id(+)
    AND pro.ID = ebr_rec.ebp_pro_id(+)
    -- ORDER BY DECODE(cp_loc_lvl
    -- ,'T',NVL(pro.ADDRESS_LINE_3,pro.ADDRESS_LINE_4)
    -- ,'C',pro.ADDRESS_LINE_4) DESC,
    ORDER BY DECODE(cp_loc_lvl
    ,'T',NVL(pro.ADDRESS_LINE_3,pro.ADDRESS_LINE_4)
    ,'C',pro.ADDRESS_LINE_4)||', '||
    SUBSTR(POST_CODE,1,DECODE(LTRIM(INSTR(POST_CODE,' ')),0,
    LENGTH(POST_CODE),LTRIM(INSTR(POST_CODE,' ')))) DESC,
    TRUNC(pro.LATEST_UPDATED_DATE) DESC,
    pro.VALUE DESC,
    pro.ID DESC;
    /* Cursor for order by VALUE asc*/
    CURSOR c_pro_sum_val_asc(cp_pse_id PORTAL_SERVICES.ID%TYPE,
    cp_user_id USERS.ID%TYPE,
    cp_status EXTRACT_BATCH_HEADERS.STATUS%TYPE,
    cp_loc_lvl PORTAL_SCS.LOCATION_REPORTING_LEVEL%TYPE,
    cp_last_accessed_date USERS.LAST_ACCESSED_DATE%TYPE ) IS
    SELECT pro.ID id,
    pro.NAME name,
    pro.TYPE_OF_WORK type_of_work,
    pro.STAGE stage,
    DECODE(cp_loc_lvl
    ,'T',NVL(pro.ADDRESS_LINE_3,pro.ADDRESS_LINE_4)
    ,'C',pro.ADDRESS_LINE_4)||', '||
    SUBSTR(POST_CODE,1,DECODE(LTRIM(INSTR(POST_CODE,' ')),0,
    LENGTH(POST_CODE),LTRIM(INSTR(POST_CODE,' ')))) location,
    pro.Currency currency,
    pro.VALUE value,
    pro.DISPLAY_VALUE display_value,
    TO_CHAR(pro.LATEST_UPDATED_DATE,'DD/MM/YYYY') latest_updated_date,
    DECODE(pro.LATEST_UPDATED_DATE, pro.CREATED_DATE,
    'true','false')
    ||'~'||DECODE(SIGN(cp_last_accessed_date -
    TRUNC(pro.LATEST_UPDATED_DATE)
    ),0,'true'
    ,-1,'true'
    ,1,'false')
    ||'~'||DECODE(wrt_rec.wrt_pro_id,NULL,'false','true')
    ||'~'||DECODE(pne_rec.pne_pro_id,NULL,'false','true')
    ||'~'||DECODE(ebr_rec.ebr_status,cp_status,'true','false') flags
    FROM PROJECTS pro,
    TMP_PROJECTS tmp,
    (SELECT wrt.PRO_ID wrt_pro_id
    FROM WATCH_REQUESTS wrt,
    TMP_PROJECTS tmp_sub
    WHERE wrt.VIEWED_DATE IS NULL
    AND wrt.PSR_PSN_PSE_ID = cp_pse_id
    AND wrt.PSR_USR_ID = cp_user_id
    AND tmp_sub.PRO_ID = wrt.PRO_ID
    GROUP BY wrt.PRO_ID) wrt_rec,
    (SELECT pne.PRO_ID pne_pro_id
    FROM PROJECT_NOTES pne,
    TMP_PROJECTS tmp_pne
    WHERE pne.USR_ID = cp_user_id
    AND tmp_pne.PRO_ID = pne.PRO_ID) pne_rec,
    (SELECT ebr.STATUS ebr_status,
    ebp.PRO_ID ebp_pro_id
    FROM EXTRACT_BATCH_HEADERS ebr,
    EXTRACT_BATCH_PROJECTS ebp,
    TMP_PROJECTS tmp_ebr
    WHERE ebr.ID = ebp.EBR_ID
    AND ebp.PRO_ID = tmp_ebr.PRO_ID
    AND ebr.USR_ID = cp_user_id
    AND ebr.STATUS = cp_status) ebr_rec
    WHERE pro.ID = tmp.PRO_ID
    AND pro.ID = wrt_rec.wrt_pro_id(+)
    AND pro.ID = pne_rec.pne_pro_id(+)
    AND pro.ID = ebr_rec.ebp_pro_id(+)
    ORDER BY pro.VALUE,
    TRUNC(pro.LATEST_UPDATED_DATE),
    -- DECODE(cp_loc_lvl
    -- ,'T',NVL(pro.ADDRESS_LINE_3,pro.ADDRESS_LINE_4)
    -- ,'C',pro.ADDRESS_LINE_4),
    DECODE(cp_loc_lvl
    ,'T',NVL(pro.ADDRESS_LINE_3,pro.ADDRESS_LINE_4)
    ,'C',pro.ADDRESS_LINE_4)||', '||
    SUBSTR(POST_CODE,1,DECODE(LTRIM(INSTR(POST_CODE,' ')),0,
    LENGTH(POST_CODE),LTRIM(INSTR(POST_CODE,' ')))),
    pro.ID DESC;
    /* Cursor for order by VALUE descending */
    CURSOR c_pro_sum_val_dsc(cp_pse_id PORTAL_SERVICES.ID%TYPE,
    cp_user_id USERS.ID%TYPE,
    cp_status EXTRACT_BATCH_HEADERS.STATUS%TYPE,
    cp_loc_lvl PORTAL_SCS.LOCATION_REPORTING_LEVEL%TYPE,
    cp_last_accessed_date USERS.LAST_ACCESSED_DATE%TYPE ) IS
    SELECT pro.ID id,
    pro.NAME name,
    pro.TYPE_OF_WORK type_of_work,
    pro.STAGE stage,
    DECODE(cp_loc_lvl
    ,'T',NVL(pro.ADDRESS_LINE_3,pro.ADDRESS_LINE_4)
    ,'C',pro.ADDRESS_LINE_4)||', '||
    SUBSTR(POST_CODE,1,DECODE(LTRIM(INSTR(POST_CODE,' ')),0,
    LENGTH(POST_CODE),LTRIM(INSTR(POST_CODE,' ')))) location,
    pro.Currency currency,
    pro.VALUE value,
    pro.DISPLAY_VALUE display_value,
    TO_CHAR(pro.LATEST_UPDATED_DATE,'DD/MM/YYYY') latest_updated_date,
    DECODE(pro.LATEST_UPDATED_DATE, pro.CREATED_DATE,
    'true','false')
    ||'~'||DECODE(SIGN(cp_last_accessed_date -
    TRUNC(pro.LATEST_UPDATED_DATE)
    ),0,'true'
    ,-1,'true'
    ,1,'false')
    ||'~'||DECODE(wrt_rec.wrt_pro_id,NULL,'false','true')
    ||'~'||DECODE(pne_rec.pne_pro_id,NULL,'false','true')
    ||'~'||DECODE(ebr_rec.ebr_status,cp_status,'true','false') flags
    FROM PROJECTS pro,
    TMP_PROJECTS tmp,
    (SELECT wrt.PRO_ID wrt_pro_id
    FROM WATCH_REQUESTS wrt,
    TMP_PROJECTS tmp_sub
    WHERE wrt.VIEWED_DATE IS NULL
    AND wrt.PSR_PSN_PSE_ID = cp_pse_id
    AND wrt.PSR_USR_ID = cp_user_id
    AND tmp_sub.PRO_ID = wrt.PRO_ID
    GROUP BY wrt.PRO_ID) wrt_rec,
    (SELECT pne.PRO_ID pne_pro_id
    FROM PROJECT_NOTES pne,
    TMP_PROJECTS tmp_pne
    WHERE pne.USR_ID = cp_user_id
    AND tmp_pne.PRO_ID = pne.PRO_ID) pne_rec,
    (SELECT ebr.STATUS ebr_status,
    ebp.PRO_ID ebp_pro_id
    FROM EXTRACT_BATCH_HEADERS ebr,
    EXTRACT_BATCH_PROJECTS ebp,
    TMP_PROJECTS tmp_ebr
    WHERE ebr.ID = ebp.EBR_ID
    AND ebp.PRO_ID = tmp_ebr.PRO_ID
    AND ebr.USR_ID = cp_user_id
    AND ebr.STATUS = cp_status) ebr_rec
    WHERE pro.ID = tmp.PRO_ID
    AND pro.ID = wrt_rec.wrt_pro_id(+)
    AND pro.ID = pne_rec.pne_pro_id(+)
    AND pro.ID = ebr_rec.ebp_pro_id(+)
    ORDER BY pro.VALUE DESC,
    TRUNC(pro.LATEST_UPDATED_DATE) DESC,
    -- DECODE(cp_loc_lvl
    -- ,'T',NVL(pro.ADDRESS_LINE_3,pro.ADDRESS_LINE_4)
    -- ,'C',pro.ADDRESS_LINE_4),
    DECODE(cp_loc_lvl
    ,'T',NVL(pro.ADDRESS_LINE_3,pro.ADDRESS_LINE_4)
    ,'C',pro.ADDRESS_LINE_4)||', '||
    SUBSTR(POST_CODE,1,DECODE(LTRIM(INSTR(POST_CODE,' ')),0,
    LENGTH(POST_CODE),LTRIM(INSTR(POST_CODE,' ')))),
    pro.ID DESC;
    /* Cursor for order by LATEST_UPDATED_DATE asc*/
    CURSOR c_pro_sum_lud_asc(cp_pse_id PORTAL_SERVICES.ID%TYPE,
    cp_user_id USERS.ID%TYPE,
    cp_status EXTRACT_BATCH_HEADERS.STATUS%TYPE,
    cp_loc_lvl PORTAL_SCS.LOCATION_REPORTING_LEVEL%TYPE,
    cp_last_accessed_date USERS.LAST_ACCESSED_DATE%TYPE ) IS
    SELECT pro.ID id,
    pro.NAME name,
    pro.TYPE_OF_WORK type_of_work,
    pro.STAGE stage,
    DECODE(cp_loc_lvl
    ,'T',NVL(pro.ADDRESS_LINE_3,pro.ADDRESS_LINE_4)
    ,'C',pro.ADDRESS_LINE_4)||', '||
    SUBSTR(POST_CODE,1,DECODE(LTRIM(INSTR(POST_CODE,' ')),0,
    LENGTH(POST_CODE),LTRIM(INSTR(POST_CODE,' ')))) location,
    pro.Currency currency,
    pro.VALUE value,
    pro.DISPLAY_VALUE display_value,
    TO_CHAR(pro.LATEST_UPDATED_DATE,'DD/MM/YYYY') latest_updated_date,
    DECODE(pro.LATEST_UPDATED_DATE, pro.CREATED_DATE,
    'true','false')
    ||'~'||DECODE(SIGN(cp_last_accessed_date -
    TRUNC(pro.LATEST_UPDATED_DATE)
    ),0,'true'
    ,-1,'true'
    ,1,'false')
    ||'~'||DECODE(wrt_rec.wrt_pro_id,NULL,'false','true')
    ||'~'||DECODE(pne_rec.pne_pro_id,NULL,'false','true')
    ||'~'||DECODE(ebr_rec.ebr_status,cp_status,'true','false') flags
    FROM PROJECTS pro,
    TMP_PROJECTS tmp,
    (SELECT wrt.PRO_ID wrt_pro_id
    FROM WATCH_REQUESTS wrt,
    TMP_PROJECTS tmp_sub
    WHERE wrt.VIEWED_DATE IS NULL
    AND wrt.PSR_PSN_PSE_ID = cp_pse_id
    AND wrt.PSR_USR_ID = cp_user_id
    AND tmp_sub.PRO_ID = wrt.PRO_ID
    GROUP BY wrt.PRO_ID) wrt_rec,
    (SELECT pne.PRO_ID pne_pro_id
    FROM PROJECT_NOTES pne,
    TMP_PROJECTS tmp_pne
    WHERE pne.USR_ID = cp_user_id
    AND tmp_pne.PRO_ID = pne.PRO_ID) pne_rec,
    (SELECT ebr.STATUS ebr_status,
    ebp.PRO_ID ebp_pro_id
    FROM EXTRACT_BATCH_HEADERS ebr,
    EXTRACT_BATCH_PROJECTS ebp,
    TMP_PROJECTS tmp_ebr
    WHERE ebr.ID = ebp.EBR_ID
    AND ebp.PRO_ID = tmp_ebr.PRO_ID
    AND ebr.USR_ID = cp_user_id
    AND ebr.STATUS = cp_status) ebr_rec
    WHERE pro.ID = tmp.PRO_ID
    AND pro.ID = wrt_rec.wrt_pro_id(+)
    AND pro.ID = pne_rec.pne_pro_id(+)
    AND pro.ID = ebr_rec.ebp_pro_id(+)
    ORDER BY TRUNC(pro.LATEST_UPDATED_DATE),
    pro.VALUE DESC,
    -- DECODE(cp_loc_lvl
    -- ,'T',NVL(pro.ADDRESS_LINE_3,pro.ADDRESS_LINE_4)
    -- ,'C',pro.ADDRESS_LINE_4),
    DECODE(cp_loc_lvl
    ,'T',NVL(pro.ADDRESS_LINE_3,pro.ADDRESS_LINE_4)
    ,'C',pro.ADDRESS_LINE_4)||', '||
    SUBSTR(POST_CODE,1,DECODE(LTRIM(INSTR(POST_CODE,' ')),0,
    LENGTH(POST_CODE),LTRIM(INSTR(POST_CODE,' ')))),
    pro.ID DESC;
    /* Cursor for order by LATEST_UPDATED_DATE descending*/
    CURSOR c_pro_sum_lud_dsc(cp_pse_id PORTAL_SERVICES.ID%TYPE,
    cp_user_id USERS.ID%TYPE,
    cp_status EXTRACT_BATCH_HEADERS.STATUS%TYPE,
    cp_loc_lvl PORTAL_SCS.LOCATION_REPORTING_LEVEL%TYPE,
    cp_last_accessed_date USERS.LAST_ACCESSED_DATE%TYPE ) IS
    SELECT pro.ID id,
    pro.NAME name,
    pro.TYPE_OF_WORK type_of_work,
    pro.STAGE stage,
    DECODE(cp_loc_lvl
    ,'T',NVL(pro.ADDRESS_LINE_3,pro.ADDRESS_LINE_4)
    ,'C',pro.ADDRESS_LINE_4)||', '||
    SUBSTR(POST_CODE,1,DECODE(LTRIM(INSTR(POST_CODE,' ')),0,
    LENGTH(POST_CODE),LTRIM(INSTR(POST_CODE,' ')))) location,
    pro.Currency currency,
    pro.VALUE value,
    pro.DISPLAY_VALUE display_value,
    TO_CHAR(pro.LATEST_UPDATED_DATE,'DD/MM/YYYY') latest_updated_date,
    DECODE(pro.LATEST_UPDATED_DATE, pro.CREATED_DATE,
    'true','false')
    ||'~'||DECODE(SIGN(cp_last_accessed_date -
    TRUNC(pro.LATEST_UPDATED_DATE)
    ),0,'true'
    ,-1,'true'
    ,1,'false')
    ||'~'||DECODE(wrt_rec.wrt_pro_id,NULL,'false','true')
    ||'~'||DECODE(pne_rec.pne_pro_id,NULL,'false','true')
    ||'~'||DECODE(ebr_rec.ebr_status,cp_status,'true','false') flags
    FROM PROJECTS pro,
    TMP_PROJECTS tmp,
    (SELECT wrt.PRO_ID wrt_pro_id
    FROM WATCH_REQUESTS wrt,
    TMP_PROJECTS tmp_sub
    WHERE wrt.VIEWED_DATE IS NULL
    AND wrt.PSR_PSN_PSE_ID = cp_pse_id
    AND wrt.PSR_USR_ID = cp_user_id
    AND tmp_sub.PRO_ID = wrt.PRO_ID
    GROUP BY wrt.PRO_ID) wrt_rec,
    (SELECT pne.PRO_ID pne_pro_id
    FROM PROJECT_NOTES pne,
    TMP_PROJECTS tmp_pne
    WHERE pne.USR_ID = cp_user_id
    AND tmp_pne.PRO_ID = pne.PRO_ID) pne_rec,
    (SELECT ebr.STATUS ebr_status,
    ebp.PRO_ID ebp_pro_id
    FROM EXTRACT_BATCH_HEADERS ebr,
    EXTRACT_BATCH_PROJECTS ebp,
    TMP_PROJECTS tmp_ebr
    WHERE ebr.ID = ebp.EBR_ID
    AND ebp.PRO_ID = tmp_ebr.PRO_ID
    AND ebr.USR_ID = cp_user_id
    AND ebr.STATUS = cp_status) ebr_rec
    WHERE pro.ID = tmp.PRO_ID
    AND pro.ID = wrt_rec.wrt_pro_id(+)
    AND pro.ID = pne_rec.pne_pro_id(+)
    AND pro.ID = ebr_rec.ebp_pro_id(+)
    ORDER BY TRUNC(pro.LATEST_UPDATED_DATE) DESC,
    pro.VALUE DESC,
    -- DECODE(cp_loc_lvl
    -- ,'T',NVL(pro.ADDRESS_LINE_3,pro.ADDRESS_LINE_4)
    -- ,'C',pro.ADDRESS_LINE_4),
    DECODE(cp_loc_lvl
    ,'T',NVL(pro.ADDRESS_LINE_3,pro.ADDRESS_LINE_4)
    ,'C',pro.ADDRESS_LINE_4)||', '||
    SUBSTR(POST_CODE,1,DECODE(LTRIM(INSTR(POST_CODE,' ')),0,
    LENGTH(POST_CODE),LTRIM(INSTR(POST_CODE,' ')))),
    pro.ID DESC;
    /* Local Variables */
    v_tt_pro_id DS$REF.TT_PRO_ID;
    v_first PROJECTS.ID%TYPE := p_project_id_arr.FIRST;
    v_last PROJECTS.ID%TYPE := 0;
    v_project_id_count PROJECTS.ID%TYPE := p_project_id_arr.COUNT;
    v_page_count PROJECTS.ID%TYPE := 0;
    v_delimter CONSTANT VARCHAR2(1) := '|';
    v_sort_no NUMBER;
    v_sort_order VARCHAR2(4);
    v_sort_by_column VARCHAR2(30);
    v_last_accessed_date USERS.LAST_ACCESSED_DATE%TYPE;
    v_loc_level PORTAL_SCS.LOCATION_REPORTING_LEVEL%TYPE;
    /* Variables for Error handling */
    v_location ERROR_LOGS.LOCATION%TYPE := ' :: 0';
    v_module CONSTANT VARCHAR2(25) := 'DS$234.DS$2342_PROC';
    e_user_defined_excep EXCEPTION;
    PRAGMA EXCEPTION_INIT (e_user_defined_excep, -20001);
    /* Variables for Timestamp logging */
    v_tpg_id NUMBER;
    v_start_time NUMBER;
    v_tt_location DS$REF.TT_VARCHAR2;
    BEGIN
    v_location := ' :: 1';
    /*Dynamically change the sort area size to 64 mb */
    EXECUTE IMMEDIATE 'ALTER SESSION SET SORT_AREA_SIZE = 67108864';
    v_location := ' :: 1a';
    -- Call to timestamp log procedure for logging start time.
    DS$226.DS$2261_PROC(p_usr_id => p_user_id,
    p_module_name => v_module,
    p_call_by_module => 'ds_projectlist_bl.jsp',
    p_caller_module => NULL,
    o_tpg_id => v_tpg_id,
    o_start_time => v_start_time);
    v_location := ' 1a';
    v_last_accessed_date :=TRUNC(TO_DATE(p_last_accessed_date,'DD MON YYYY HH24:MI:SS'));
    v_location := ' 2';
    v_sort_no := SUBSTR(p_sort_order,
    1,
    INSTR(p_sort_order, v_delimter,1) - 1
    v_sort_order := SUBSTR(p_sort_order,
    INSTR(p_sort_order,v_delimter,1)+ 1
    v_page_count := CEIL(((p_project_id_arr.COUNT)/p_records_per_page));
    v_location := ' 3';
    FOR j IN 1..v_page_count
    LOOP
    v_location := ' 4';
    v_first := v_first;
    v_last := v_first + (p_records_per_page - 1);
    IF (v_last >= v_project_id_count)
    THEN
    v_last := v_project_id_count;
    ELSE
    v_last := v_first + (p_records_per_page - 1);
    END IF;
    IF (j = p_page_no)
    THEN
    v_location := ' 5';
    EXIT;
    END IF;
    v_location := ' 6';
    v_first := v_last + 1;
    v_location := ' 7';
    END LOOP;
    v_location := ' 8';
    FORALL i IN v_first..v_last
    INSERT INTO TMP_PROJECTS VALUES(p_project_id_arr(i));
    FORALL i IN p_project_id_arr.FIRST..p_project_id_arr.LAST
    INSERT INTO TMP_PROJECTS VALUES(p_project_id_arr(i));
    v_location := ' 9';
    OPEN c_psc(p_pse_id);
    LOOP
    FETCH c_psc INTO v_loc_level;
    EXIT WHEN c_psc%NOTFOUND;
    IF c_psc%ROWCOUNT > 1
    THEN
    v_location := ' 10';
    CLOSE c_psc;
    RAISE_APPLICATION_ERROR(-20001,'PLS-00234201');
    END IF;
    END LOOP;
    CLOSE c_psc;
    v_location := ' 11';
    IF v_loc_level IS NULL
    THEN
    v_location := ' 12';
    RAISE_APPLICATION_ERROR(-20001,'PLS-00234202');
    END IF;
    IF (v_sort_no = 1)
    THEN
    v_location := ' 13';
    IF (v_sort_order ='ASC' )
    THEN
    v_location := ' 14';
    IF c_projects_name_order_asc%ISOPEN
    THEN
    CLOSE c_projects_name_order_asc;
    END IF;
    OPEN c_projects_name_order_asc;
    v_location := ' 15';
    FETCH c_projects_name_order_asc BULK COLLECT INTO v_tt_pro_id;
    v_location := ' 16';
    CLOSE c_projects_name_order_asc;
    /* Assign the Sorted project ids to O/P parameter O_PRO_ALL_ID_ARRAY for fast scan */
    v_location := ' 17';
    o_pro_all_id_array := v_tt_pro_id;
    /* Delete records from temporary table TMP_PROJECTS */
    v_location := ' 18';
    DELETE FROM TMP_PROJECTS;
    /* Insert records into TMP_PROJECTS as per the page number (p_page_no) */
    v_location := ' 19';
    FORALL i IN v_first..v_last
    INSERT INTO TMP_PROJECTS VALUES(v_tt_pro_id(i));
    v_location := ' 20';
    OPEN c_pro_sum_name_asc(p_pse_id,p_user_id,v_status,v_loc_level,v_last_accessed_date);
    v_location := ' 21';
    FETCH c_pro_sum_name_asc BULK COLLECT INTO o_pro_id_array,
    o_name_array,
    o_type_of_work_array,
    o_stage_array,
    o_loc_array,
    o_currency_array,
    o_value_array,
    o_display_value_array,
    o_latest_updated_date_array,
    o_flag_array;
    CLOSE c_pro_sum_name_asc;
    ELSE
    v_location := ' 22';
    IF c_projects_name_order_desc%ISOPEN
    THEN
    CLOSE c_projects_name_order_desc;
    END IF;
    OPEN c_projects_name_order_desc;
    v_location := ' 23';
    FETCH c_projects_name_order_desc BULK COLLECT INTO v_tt_pro_id;
    CLOSE c_projects_name_order_desc;
    /* Assign the Sorted project ids to O/P parameter O_PRO_ALL_ID_ARRAY for fast scan */
    v_location := ' 24';
    o_pro_all_id_array := v_tt_pro_id;
              /*Delete records from temporary table TMP_PROJECTS */
    v_location := ' 25';
    DELETE FROM TMP_PROJECTS;
    /* Insert records into TMP_PROJECTS as per the page number (p_page_no) */
    v_location := ' 26';
    FORALL i IN v_first..v_last
    INSERT INTO TMP_PROJECTS VALUES(v_tt_pro_id(i));
    v_location := ' 27';
    OPEN c_pro_sum_name_dsc(p_pse_id,p_user_id,v_status,v_loc_level,v_last_accessed_date);
    v_location := ' 28';
    FETCH c_pro_sum_name_dsc BULK COLLECT INTO o_pro_id_array,
    o_name_array,
    o_type_of_work_array,
    o_stage_array,
    o_loc_array,
    o_currency_array,
    o_value_array,
    o_display_value_array,
    o_latest_updated_date_array,
    o_flag_array;
    CLOSE c_pro_sum_name_dsc;
    END IF;
    ELSIF (v_sort_no = 2)
    THEN
    v_location := ' 29';
    IF (v_sort_order ='ASC' )
    THEN
    v_location := ' 30';
    IF c_projects_work_order_asc%ISOPEN
    THEN
    CLOSE c_projects_work_order_asc;
    END IF;
    OPEN c_projects_work_order_asc;
    v_location := ' 31';
    FETCH c_projects_work_order_asc BULK COLLECT INTO v_tt_pro_id;
    CLOSE c_projects_work_order_asc;
    /* Assign the Sorted project ids to O/P parameter O_PRO_ALL_ID_ARRAY for fast scan */
    v_location := ' 32';
    o_pro_all_id_array := v_tt_pro_id;
    /* Delete records from temporary table TMP_PROJECTS */
    DELETE FROM TMP_PROJECTS;
    /* Insert records into TMP_PROJECTS as per the page number (p_page_no) */
    v_location := ' 33';
    FORALL i IN v_first..v_last
    INSERT INTO TMP_PROJECTS VALUES(v_tt_pro_id(i));
    v_location := ' 34';
    OPEN c_pro_sum_work_asc(p_pse_id,p_user_id,v_status,v_loc_level,v_last_accessed_date);
    v_location := ' 35';
    FETCH c_pro_sum_work_asc BULK COLLECT INTO o_pro_id_array,
    o_name_array,
    o_type_of_work_array,
    o_stage_array,
    o_loc_array,
    o_currency_array,
    o_value_array,
    o_display_value_array,
    o_latest_updated_date_array,
    o_flag_array;
    CLOSE c_pro_sum_work_asc;
    ELSE
    v_location := ' 36';
    IF c_projects_work_order_desc%ISOPEN
    THEN
    CLOSE c_projects_work_order_desc;
    END IF;
    OPEN c_projects_work_order_desc;
    v_location := ' 37';
    FETCH c_projects_work_order_desc BULK COLLECT INTO v_tt_pro_id;
    CLOSE c_projects_work_order_desc;
    /* Assign the Sorted project ids to O/P parameter O_PRO_ALL_ID_ARRAY for fast scan */
    v_location := ' 38';
    o_pro_all_id_array := v_tt_pro_id;
    /* Delete records from temporary table TMP_PROJECTS */
    v_location := ' 39';
    DELETE FROM TMP_PROJECTS;
    /* Insert records into TMP_PROJECTS as per the page number (p_page_no) */
    v_location := ' 40';
    FORALL i IN v_first..v_last
    INSERT INTO TMP_PROJECTS VALUES(v_tt_pro_id(i));
    v_location := ' 41';
    OPEN c_pro_sum_work_dsc(p_pse_id,p_user_id,v_status,v_loc_level,v_last_accessed_date);
    v_location := ' 42';
    FETCH c_pro_sum_work_dsc BULK COLLECT INTO o_pro_id_array,
    o_name_array,
    o_type_of_work_array,
    o_stage_array,
    o_loc_array,
    o_currency_array,
    o_value_array,
    o_display_value_array,
    o_latest_updated_date_array,
    o_flag_array;
    CLOSE c_pro_sum_work_dsc;
    END IF;
    ELSIF (v_sort_no = 3)
    THEN
    v_location := ' 43';
    IF (v_sort_order ='ASC' )
    THEN
    v_location := ' 44';
    IF c_projects_stage_order_asc%ISOPEN
    THEN
    CLOSE c_projects_stage_order_asc;
    END IF;
    OPEN c_projects_stage_order_asc;
    v_location := ' 45';
    FETCH c_projects_stage_order_asc BULK COLLECT INTO v_tt_pro_id;
    CLOSE c_projects_stage_order_asc;
    /* Assign the Sorted project ids to O/P parameter O_PRO_ALL_ID_ARRAY for fast scan */
    v_location := ' 46';
    o_pro_all_id_array := v_tt_pro_id;
    /* Delete records from temporary table TMP_PROJECTS */
    v_location := ' 47';
    DELETE FROM TMP_PROJECTS;
    /* Insert records into TMP_PROJECTS as per the page number (p_page_no) */
    v_location := ' 48';
    FORALL i IN v_first..v_last
    INSERT INTO TMP_PROJECTS VALUES(v_tt_pro_id(i));
    v_location := ' 49';
    OPEN c_pro_sum_stage_asc(p_pse_id,p_user_id,v_status,v_loc_level,v_last_accessed_date);
    v_location := ' 50';
    FETCH c_pro_sum_stage_asc BULK COLLECT INTO o_pro_id_array,
    o_name_array,
    o_type_of_work_array,
    o_stage_array,
    o_loc_array,
    o_currency_array,
    o_value_array,
    o_display_value_array,
    o_latest_updated_date_array,
    o_flag_array;
    CLOSE c_pro_sum_stage_asc;
    ELSE
    v_location := ' 51';
    IF c_projects_stage_order_desc%ISOPEN
    THEN
    CLOSE c_projects_stage_order_desc;
    END IF;
    OPEN c_projects_stage_order_desc;
    v_location := ' 52';
    FETCH c_projects_stage_order_desc BULK COLLECT INTO v_tt_pro_id;
    CLOSE c_projects_stage_order_desc;
    /* Assign the Sorted project ids to O/P parameter O_PRO_ALL_ID_ARRAY for fast scan */
    v_location := ' 53';
    o_pro_all_id_array := v_tt_pro_id;
         /* Delete records from temporary table TMP_PROJECTS */
    v_location := ' 54';
    DELETE FROM TMP_PROJECTS;
    /* Insert records into TMP_PROJECTS as per the page number (p_page_no) */
    v_location := ' 55';
    FORALL i IN v_first..v_last
    INSERT INTO TMP_PROJECTS VALUES(v_tt_pro_id(i));
    v_location := ' 56';
    OPEN c_pro_sum_stage_dsc(p_pse_id,p_user_id,v_status,v_loc_level,v_last_accessed_date);
    v_location := ' 57';
    FETCH c_pro_sum_stage_dsc BULK COLLECT INTO o_pro_id_array,
    o_name_array,
    o_type_of_work_array,
    o_stage_array,
    o_loc_array,
    o_currency_array,
    o_value_array,
    o_display_value_array,
    o_latest_updated_date_array,
    o_flag_array;
    CLOSE c_pro_sum_stage_dsc;
    END IF;
    ELSIF (v_sort_no = 4)
    THEN
    v_location := ' 58';
    IF (v_sort_order ='ASC' )
    THEN
    IF c_projects_loc_order_asc%ISOPEN
    THEN
    CLOSE c_projects_loc_order_asc;
    END IF;
    OPEN c_projects_loc_order_asc(v_loc_level);
    v_location := ' 59';
    FETCH c_projects_loc_order_asc BULK COLLECT INTO v_tt_pro_id,v_tt_location;
    CLOSE c_projects_loc_order_asc;
    /* Assign the Sorted project ids to O/P parameter O_PRO_ALL_ID_ARRAY,O_LOCATION for fast scan */
    v_location := ' 60';
    o_pro_all_id_array := v_tt_pro_id;
    o_location := v_tt_location;
    /* Delete records from temporary table TMP_PROJECTS */
    v_location := ' 61';
    DELETE FROM TMP_PROJECTS;
    /* Insert records into TMP_PROJECTS as per the page number (p_page_no) */
    v_location := ' 62';
    FORALL i IN v_first..v_last
    INSERT INTO TMP_PROJECTS VALUES(v_tt_pro_id(i));
    v_location := ' 63';
    OPEN c_pro_sum_loc_asc(p_pse_id,p_user_id,v_status,v_loc_level,v_last_accessed_date);
    v_location := ' 64';
    FETCH c_pro_sum_loc_asc BULK COLLECT INTO o_pro_id_array,
    o_name_array,
    o_type_of_work_array,
    o_stage_array,
    o_loc_array,
    o_currency_array,
    o_value_array,
    o_display_value_array,
    o_latest_updated_date_array,
    o_flag_array;
    CLOSE c_pro_sum_loc_asc;
    ELSE
    v_location := ' 65';
    IF c_projects_loc_order_desc%ISOPEN
    THEN
    CLOSE c_projects_loc_order_desc;
    END IF;
    OPEN c_projects_loc_order_desc (v_loc_level);
    v_location := ' 66';
    FETCH c_projects_loc_order_desc BULK COLLECT INTO v_tt_pro_id,v_tt_location;
    CLOSE c_projects_loc_order_desc;
    /* Assign the Sorted project ids to O/P parameter O_PRO_ALL_ID_ARRAY,O_LOCATION for fast scan */
    v_location := ' 67';
    o_pro_all_id_array := v_tt_pro_id;
    o_location := v_tt_location;
    /* Delete records from temporary table TMP_PROJECTS */
    DELETE FROM TMP_PROJECTS;
    /* Insert records into TMP_PROJECTS as per the page number (p_page_no) */
    v_location := ' 68';
    FORALL i IN v_first..v_last
    INSERT INTO TMP_PROJECTS VALUES(v_tt_pro_id(i));
    v_location := ' 69';
    OPEN c_pro_sum_loc_dsc(p_pse_id,p_user_id,v_status,v_loc_level,v_last_accessed_date);
    v_location := ' 70';
    FETCH c_pro_sum_loc_dsc BULK COLLECT INTO o_pro_id_array,
    o_name_array,
    o_type_of_work_array,
    o_stage_array,
    o_loc_array,
    o_currency_array,
    o_value_array,
    o_display_value_array,
    o_latest_updated_date_array,
    o_flag_array;
    CLOSE c_pro_sum_loc_dsc;
    END IF;
    ELSIF (v_sort_no = 5)
    THEN
    v_location := ' 71';
    IF (v_sort_order ='ASC' )
    THEN
    v_location := ' 72';
    IF c_projects_value_order_asc%ISOPEN
    THEN
    CLOSE c_projects_value_order_asc;
    END IF;
    OPEN c_projects_value_order_asc(v_loc_level);
    v_location := ' 73';
    FETCH c_projects_value_order_asc BULK COLLECT INTO v_tt_pro_id,v_tt_location;
    CLOSE c_projects_value_order_asc;
    /* Assign the Sorted project ids to O/P parameter O_PRO_ALL_ID_ARRAY for fast scan */
    v_location := ' 74';
    o_pro_all_id_array := v_tt_pro_id;
         o_location := v_tt_location;
    /* Delete records from temporary table TMP_PROJECTS */
    DELETE FROM TMP_PROJECTS;
    /* Insert records into TMP_PROJECTS as per the page number (p_page_no) */
    v_location := ' 75';
    FORALL i IN v_first..v_last
    INSERT INTO TMP_PROJECTS VALUES(v_tt_pro_id(i));
    v_location := ' 76';
    OPEN c_pro_sum_val_asc(p_pse_id,p_user_id,v_status,v_loc_level,v_last_accessed_date);
    v_location := ' 77';
    FETCH c_pro_sum_val_asc BULK COLLECT INTO o_pro_id_array,
    o_name_array,
    o_type_of_work_array,
    o_stage_array,
    o_loc_array,
    o_currency_array,
    o_value_array,
    o_display_value_array,
    o_latest_updated_date_array,
    o_flag_array;
    CLOSE c_pro_sum_val_asc;
    ELSE
    v_location := ' 78';
    IF c_projects_value_order_desc%ISOPEN
    THEN
    CLOSE c_projects_value_order_desc;
    END IF;
    OPEN c_projects_value_order_desc(v_loc_level);
    v_location := ' 79';
    FETCH c_projects_value_order_desc BULK COLLECT INTO v_tt_pro_id,v_tt_location;
    CLOSE c_projects_value_order_desc;
    /* Assign the Sorted project ids to O/P parameter O_PRO_ALL_ID_ARRAY for fast scan */
    v_location := ' 80';
    o_pro_all_id_array := v_tt_pro_id;
         o_location := v_tt_location;
    /* Delete records from temporary table TMP_PROJECTS */
    DELETE FROM TMP_PROJECTS;
    /* Insert records into TMP_PROJECTS as per the page number (p_page_no) */
    v_location := ' 81';
    FORALL i IN v_first..v_last
    INSERT INTO TMP_PROJECTS VALUES(v_tt_pro_id(i));
    v_location := ' 82';
    OPEN c_pro_sum_val_dsc(p_pse_id,p_user_id,v_status,v_loc_level,v_last_accessed_date);
    FETCH c_pro_sum_val_dsc BULK COLLECT INTO o_pro_id_array,
    o_name_array,
    o_type_of_work_array,
    o_stage_array,
    o_loc_array,
    o_currency_array,
    o_value_array,
    o_display_value_array,
    o_latest_updated_date_array,
    o_flag_array;
    CLOSE c_pro_sum_val_dsc;
    END IF;
    ELSIF (v_sort_no = 6)
    THEN
    v_location := ' 83';
    IF (v_sort_order ='ASC' )
    THEN
    v_location := ' 84';
    IF c_projects_lud_order_asc%ISOPEN
    THEN
    CLOSE c_projects_lud_order_asc;
    END IF;
    OPEN c_projects_lud_order_asc(v_loc_level);
    v_location := ' 85';
    FETCH c_projects_lud_order_asc BULK COLLECT INTO v_tt_pro_id,v_tt_location;
    CLOSE c_projects_lud_order_asc;
    /* Assign the Sorted project ids to O/P parameter O_PRO_ALL_ID_ARRAY for fast scan */
    v_location := ' 86';
    o_pro_all_id_array := v_tt_pro_id;
    o_location := v_tt_location;
    /* Delete records from temporary table TMP_PROJECTS */
    DELETE FROM TMP_PROJECTS;
    /* Insert records into TMP_PROJECTS as per the page number (p_page_no) */
    v_location := ' 87';
    FORALL i IN v_first..v_last
    INSERT INTO TMP_PROJECTS VALUES(v_tt_pro_id(i));
    v_location := ' 88';
    OPEN c_pro_sum_lud_asc(p_pse_id,p_user_id,v_status,v_loc_level,v_last_accessed_date);
    FETCH c_pro_sum_lud_asc BULK COLLECT INTO o_pro_id_array,
    o_name_array,
    o_type_of_work_array,
    o_stage_array,
    o_loc_array,
    o_currency_array,
    o_value_array,
    o_display_value_array,
    o_latest_updated_date_array,
    o_flag_array;
    CLOSE c_pro_sum_lud_asc;
    ELSE
    v_location := ' 89';
    IF c_projects_lud_order_desc%ISOPEN
    THEN
    CLOSE c_projects_lud_order_desc;
    END IF;
    OPEN c_projects_lud_order_desc(v_loc_level);
    v_location := ' 90';
    FETCH c_projects_lud_order_desc BULK COLLECT INTO v_tt_pro_id,v_tt_location;
    CLOSE c_projects_lud_order_desc;
    /* Assign the Sorted project ids to O/P parameter O_PRO_ALL_ID_ARRAY for fast scan */
    v_location := ' 91';
    o_pro_all_id_array := v_tt_pro_id;
         o_location := v_tt_location;
    /* Delete records from temporary table TMP_PROJECTS */
    DELETE FROM TMP_PROJECTS;
    /* Insert records into TMP_PROJECTS as per the page number (p_page_no) */
    v_location := ' 92';
    -- FORALL i IN p_project_id_arr.FIRST..p_project_id_arr.LAST
    -- FORALL i IN v_first..v_last
    FORALL i IN v_first..v_last
    INSERT INTO TMP_PROJECTS VALUES(v_tt_pro_id(i));
    FORALL i IN p_project_id_arr.FIRST..p_project_id_arr.LAST
    INSERT INTO TUSH2 VALUES(v_tt_pro_id(i));
    v_location := ' 93';
    OPEN c_pro_sum_lud_dsc(p_pse_id,p_user_id,v_status,v_loc_level,v_last_accessed_date);
    FETCH c_pro_sum_lud_dsc BULK COLLECT INTO o_pro_id_array,
    o_name_array,
    o_type_of_work_array,
    o_stage_array,
    o_loc_array,
    o_currency_array,
    o_value_array,
    o_display_value_array,
    o_latest_updated_date_array,
    o_flag_array;
    CLOSE c_pro_sum_lud_dsc;
    END IF;
    END IF;
    v_location := ' 94';
    -- Call to Timestamp Logs for logging end_time.
    DS$226.DS$2262_PROC(p_usr_id => p_user_id,
    p_tpg_id => v_tpg_id,
    p_start_time => v_start_time);
    v_location := ' 95';
    EXCEPTION
    WHEN e_user_defined_excep
    THEN
    ds$221.ds$2211_proc(p_module_type => 'PLS',
    p_err_type => 'R',
    p_location => v_module ||'::'|| v_location,
    p_java_error_stack => NULL,
    p_user_id => p_user_id);
    RAISE;
    WHEN OTHERS
    THEN
    ds$221.ds$2211_proc(p_module_type => 'PLS',
    p_err_type => 'R',
    p_location => v_module || v_location,
    p_java_error_stack => NULL,
    p_user_id => p_user_id);
    RAISE;
    END;
    END;

  • Difference between ECC 6.0 and earlier versions

    Hi,
    one of the difference between ECC 6.0 and earlier versions is that instead 'WS_UPLOAD'  and 'WS_DOWNLOAD' in ECC we should use 'GUI_UPLOAD' and 'GUI_DOWNLOAD'  respectively.
    (of course SPDD and SPRO tcodes is known by everone i suppose)
    Similarly can u all put down some differences here, atleast one entry by each, I think we can make a good docu. I have searched the net for the differences but could not get much, so by each of us contributing one each, it would become good docu..for all of us.
    Thanx in advance

    Unicode Errors Encountered and their Solutions
    E1. In u201CTEXT MODEu201D the u201CENCODINGu201D addition must be specified.
         Error:
         OPEN DATASET FILE FOR OUTPUT IN TEXT MODE.
         Solution:
         OPEN DATASET FILE FOR OUTPUT IN LEGACY TEXT MODE.
    E2. In Unicode, DESCRIBE DISTANCE can only be used with the IN BYTE MODE  or  IN
          CHARACTER MODE  addition.
         Error:
         DESCRIBE DISTANCE  BETWEEN T_KOMK AND T_KOMK-HIEBO01 INTO BPOS.
         Solution:
    DESCRIBE DISTANCE  BETWEEN T_KOMK AND T_KOMK-HIENR01 INTO BPOS
    IN CHARACTER MODE.
    E3. u201CUSR02-UFLAGu201D must be a byte-type field (Typ X or XSTRING )
         Error:
         IF USR02-UFLAG O YULOCK.
         Solution:  Since the data type of USR02-UFLAG is type INT and is compared with data type
                    X u2013 Hence the error. So we  define a new variable ZULOCK and assign the
                    value of USR02-UFLAG to ZULOCK.
                  New variable             
                  DATA: ZULOCK(1) TYPE X.   "APBRP00
                  Assign value               
                                ZULOCK = USR02-UFLAG.
            Compare -
                   IF ZULOCK = YULOCK.   u201Creplace IF USR02-UFLAG O YULOCK.
    E4.  HT cannot be converted to a Character type field
    Error :
    WRITE ht TO t_data+10(2).
    Solution : Since the data type of ht is a type u2018Xu2019 and the data is been transfer to
             t_data which has a data type u2018Cu2019. value of one data type cannot be copy to
             another data type where one of them is type string .Hence the error occur,
             so the data type of ht is been change to Type u2018Cu2019
         OR
               A Tab ( value 09 ) is introduced as part of the row. The value 09 is not converted in Unicode environment. Instead we need to use class
         Error:
              DATA: BEGIN OF ht,
                   x(1) TYPE x VALUE '09',
              END OF ht.
         Solution:
                  Define Class after the Tables definition.
                       CLASS cl_abap_char_utilities DEFINITION LOAD.
                  Data Defination :  Comment internal table HT and define a variable HT type C.
           *   Insert + APRIA00 05/02/2007 Unicode project
           *   DATA: BEGIN OF ht,
         *         x(1) TYPE x VALUE '09'
           *   END OF ht.
         *   Insert - APRIA00 05/02/2007 Unicode project
           DATA HT type C.
           Before using HT assign Horizontal tab.
                     Ht = CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB.  
    E5.  In Unicode programs the u201C#u201D cannot appear in names, as it is does here in the name    u201C#LINESu201D
         Error :
         #LINES                 TYPE I,
         Solution : Since the # is used in the start of name, it is not allowed. We need to
                  remove it. 
         Solution for the above
         V_LINES                 TYPE I,
    E6. In u201CTEXT MODEu201D the u201CENCODINGu201D addition must be specified as well as the addition was required FOR OUTPUT,FOR INPUT, FOR APPENDING OR FOR UPDATE was expected.
         Error:
         OPEN DATASET PATH_NAME IN TEXT MODE.
         Solution:
         Download =     OPEN DATASET PATH_NAME FOR OUTPUT IN LEGACY TEXT MODE.
         Upload        =  OPEN DATASET AUSZUG-FILE IN TEXT MODE FOR INPUT ENCODING DEFAULT.
    E7. u201CTABu201D must be a character-type data object( data type C,N, D, T or String). Field string)    
         Error:
                data: begin of tab,                   "Excel Parameter Split at TAB
            t type x value '09',          "Tabulator
           end of tab.
                concatenate 'Material' 'Package Status'
                    into z_download-line separated by tab.
                ( In the above command  the two field are to be separated with a horizontal Tab. The earlier      way of assigning the tab value u201809u2019 will not work in Unicode environment.
         Solution:
         Define a  class just after the Table defination.
              CLASS cl_abap_char_utilities DEFINITION LOAD.
                Define  variable Tab as shown below :
              Data : TAB           TYPE C.
         Before the concatenate statement assign the value of Tab using pre-defined attributes.
              TAB = CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB.
    E8. Upload/Ws_Upload and Download/Ws_Download are obsolete, since they are not Unicode-
          enabled; use the class cl_gui_frontend_services     
         Error-1:  Function WS_DOWNLOAD is obsolete in Unicode environment.
                call function 'WS_DOWNLOAD'
                     exporting
                          filename = zfilename
                     tables
                          data_tab = z_download.
         Solutions-1: Instead of WS_DOWNLOAD use  GUI_DOWNLOAD.
    CALL FUNCTION 'GUI_DOWNLOAD'
      EXPORTING
    *   BIN_FILESIZE                  =
        FILENAME                      = zfilename
      TABLES
        DATA_TAB                      = z_download.
    E9.  The "/" character is reserved for identification of namespaces. It must be entered twice.
            The name  of a namespace must be at least 3 characters long.
         Error :      
                     U/N(3)        TYPE C,  "U/N    --> ERSETZT DURCH SPACE
         Solution :
         * Special character can not be used to define a data variable
         *      U/N(3)        TYPE C,  "U/N    --> ERSETZT DURCH SPACE
                  U_N(3)        TYPE C,  "U/N    --> ERSETZT DURCH SPACE
         * Insert - APSUS02 07/02/2007 Unicode Project
    E10.  "LP_TAB" and "CS_TAB" are not mutually convertible. In Unicode programs,
             "LP_TAB" must have the same structure layout as "CS_TAB", independent of the length
             of a Unicode character.
         Error : This error is encountered when data from one internal table is copied to another
                             internal table which different structure. In this case its LP_TAB & CS_TAB.
                     LP_TAB[] = CS_TAB[].
         Solution :
              * Replace + APSUS02 07/02/2007  Unicode Project
    *   LP_TAB[] = CS_TAB[].
                  move-corresponding CS_TAB to LP_TAB.
              * Replace + APSUS02 07/02/2007  Unicode Project
    E11.  Could not specify the access range automatically. This means that you need a RANGE
              addition.          
         Error :  Range need to be specified as an addition to the command.
                DO 4 TIMES VARYING HELP_CHAR FROM ABCD(1) NEXT ABCD+1(1).
               Solution : 
                DO 4 TIMES VARYING HELP_CHAR FROM ABCD(1) NEXT ABCD+1(1)
              * Insert + APSUS02 07/02/2007  Unicode Project.
                                                          RANGE ABCD+0(4).
    * Insert - APSUS02 07/02/2007  Unicode Project.
    E12 .  Processing Terminated Error code: Error in opening /
                                              Path not found when downloading to Unix directory.
         Error : PARAMETER: outfile(92) DEFAULT
                  '/CP/interface/NPP/data/MX/cbslaprcpts'
                        LOWER CASE,
                   kmxmstrd AS CHECKBOX.
                This error is encountered when the path is missing. The above path is related to CCP.
         Solution:  For testing purpose comment the original path and replace it with
                                     /CP/interface/CCD/Unicode_test/ 
    E13.    Upload/Ws_Upload and Download/Ws_Download are obsolete, since they are not                                                                       Unicode- enabled; use the class cl_gui_frontend_services
         Error: Function WS_UPLOAD is obsolete in Unicode environment. (During UCCHECK)
                   Call function 'WS_UPLOAD'
           Exporting
                Filename                = zfilename
                Filetype                = u2018DATu2019
           Tables
                data_tab                = z_upload
           Exceptions
                Conversion_error        = 1
                file_open_error         = 2
                file_read_error         = 3
                invalid_table_width     = 4
                invalid_type            = 5
                no_batch                = 6
                unknown_error           = 7
                gui_refuse_filetransfer = 8
                others                  = 9.
         Solution: Instead of WS_UPLOAD use TEXT_CONVERT_XLS_TO_SAP. Do not use temporary file put the file name as it is.
    1) First define a type pool and a variable of type truxs_t_text_data.
    TYPE-POOLS: truxs.
    DATA: it_raw TYPE truxs_t_text_data.
         2) Use this it_raw in the function module in parameter i_tab_raw_data. Put file name and the internal table in the function module.
    CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
        EXPORTING
    *     I_FIELD_SEPERATOR        =
    *      i_line_header            =  ' '
          i_tab_raw_data           =  it_raw       " WORK TABLE
          i_filename               =  zfilename
        TABLES
          i_tab_converted_data     = z_upload[]    "ACTUAL DATA
       EXCEPTIONS
          conversion_failed        = 1
          OTHERS                   = 2.
         Comment u201Ci_line headeru201D. It takes the first/ header line of the file which is to be uploaded.
    Put  square brackets after internal table as shown above.
    E14.    CURSORHOLD may not be converted into a number.
         Error:  GET CURSOR LINE CURSORHOLD VALUE CURSOR_HOLD.
         Solution: In the declaration part of CURSORHOLD, one field is of u2018Pu2019 type and one field is of u2018Iu2019 type, which is not allowed in Unicode environment.So change the the type of it to NUMC.  

Maybe you are looking for

  • Values not getting populated in the SMOPCCAPRO

    Hi, We had added a new field to CPGProduct in component CPGOE_ABLOCKS. But the extension field was not included to the BOL structure automatically. So ,we had used the SAP note 1472567 to add the include structure INCL_EEW_MKTPL_PRD to structure CRMS

  • Need clear steps for doing performance tuning on SQL Server 2008 R2 (DB Engine, Reporting Services and Integration Services)

    We have to inverstigate about a reporting solution where things are getting slow (may be material, database design, network matters). I have red a lot in MSDN and some books about performance tuning on SQL Server 2008 R2 (or other) but frankly, I fee

  • SQL*Loader: How to use Sequence and REF together?

    Hi, I'm getting the following error: SQL*Loader-418: Bad datafile datatype for column AREA_ID. I attempt to upload one datafile into 4 different tables. When executing sqlldr scott/tiger control=sqlldr_aj_new.ctl 1) Here is my Control file (sqlldr_aj

  • Calling a JSP  from abstract portal component

    hi, I have included a JSP in a abstract portal component and on click of submit in 1st JSP i have to show an another JSP.How can i do this??? Regards Sushanth

  • Using Java-Methods in SAP

    Hi, the regular way of SAP-Java Connection is a RFC-Model on SAP-Sight, and in Java I use this model with his functionality. But is there a opportunity for a contrary way? I have a function in Java, and I want to use it from the SAP-Backend. Maybe I