Plan code 89968

changing plan to plan code 89968. it is a special code for Walmart managers.  was provided a phone number of 1-800-535-0856. when I call no one is at the number and it doesn't say what the normal business hours are. can someone change my plan since no one at the number is ever there to do it.
I have registered my account through the correct channels just need to have my plan changed to the one listed .

Have you called Customer Service and asked?
Customer Service
Dial *611 from a cell phone
(800) 922-0204
Monday - Sunday 6 am - 11 pm

Similar Messages

  • I just brought a apple protection plan as my phone warranty is going to end in a day, when i am trying to enter the protection plan code and my phone serial no its showing an error message try after some time is there any solution to that?

    i just brought a apple protection plan as my phone warranty is going to end in a day, after entering the protection plan code and my phone serial no its showing an error message "technical error try after some time", is there any solution for that?
    As i need the warranty to extend for another year please help me regarding this issue.
    When i bought a new iphone5 in Inda after using it for three days lock button was not working properly and it was warranty claimed and exchanged from apple service center in India, for the same phone I want to extend the warranty but its showing a error message is there any solution?

    Here is some information on the applecare +:
    http://www.apple.com/support/products/iphone.html
    It appears that you have to buy the applecare within 30 days of buying your phone - you said that your phone warranty is almost over, so when did you buy it??? That could be the explanation for the error.

  • My applecare protection plan code doesn't work

    Hi,
    today I bought a macbook pro and a applecare protection plan and when I tried to use my code, it didn't work, does someone know why?

    This is a user forum. You're not talking to Apple. Call Apple and ask them.

  • Problems with planning code how can I do this??

    I wonder if someone could help me I have a slight problem.. basically i'm writing a threaded application that needs to update jeopardy codes on all open tasks on an order if there is a jeopardy code on one of the tasks. As users only put the code on one task when they should put it on all but to make the users life easier i need to write an app to do it for them.
    My problem is that there could be 5 tasks on one order and there could be 4 jeopardy codes on one of the tasks, all of these need to appear on all tasks, on another task there could be 2 jeopardy codes which then need to appear on all other tasks if one is closed then they all need to be closed on the basis that if the date closed is newer than the date opened then close all J codes if its older then create all J codes on corresponding tasks. I have written a database lookup to fetch the doc no, task nos, jep codes against each task, closed and modify dates. I have created an order object with all this info in. Other than iterating over order object to get doc number then to get list of tasks names then to get list of jeopardy codes then iterate over again to update each jeopardy code on each open task how else can I do this as this seems really messy to me... (I am updating by back end database not via api)
    Sorry if this is confusing any help will be most appreciated

    As users only put the code on one task when they
    y should put it on all but to make the users life
    easier i need to write an app to do it for them.
    My problem is that there could be 5 tasks on one
    order and there could be 4 jeopardy codes on one of
    the 5 tasks, each jeopardy code needs to appear on
    each tasks, on another task there could be 2 jeopardy
    codes which then need to appear on all other tasks as
    well.This sounds to me very much like the jeopardy code is (at least in practice) an attribute of the order and not an attribute of the task. I would suggest redesigning your data model to make this the case. Then the application that allowed the users to put a jeopardy code on a task would actually put it on the order containing the task.
    If one is closed then they all need to be closed on
    the basis that if the date closed is newer than the
    date opened then close all J codes if its older then
    create all J codes on corresponding tasks.
    I have written a database lookup to fetch the doc no,
    task nos, jep codes against each task, closed and
    modify dates. I have created an order object with all
    this info in.Or if redesigning your database isn't a palatable option (this is quite likely in most organizations) then you could modify your database lookup and object creation so that they treated the jeopardy codes for an order's tasks as if they were jeopardy codes for the order.

  • Generating EXPLAIN PLAN on a database which is opened in READ-ONLY mode

    Hi,
    I am using Oracle 10.2.0.3 version.
    If my database is opened in READ-ONLY mode, means no insert/update/delete operations are permitted here.
    While generating EXPLAIN PLAN for any SQL, it does entries in PLAN_TABLE. But my database is opened in READ-ONLY mode, means no inserts can happen.
    So how can I generate EXPLAIN PLAN for my SQL in this condition?
    Thanks in advance.
    Best Regards,
    oratest

    oratest wrote:
    I am using Oracle 10.2.0.3 version.
    If my database is opened in READ-ONLY mode, means no insert/update/delete operations are permitted here.
    While generating EXPLAIN PLAN for any SQL, it does entries in PLAN_TABLE. But my database is opened in READ-ONLY mode, means no inserts can happen.
    So how can I generate EXPLAIN PLAN for my SQL in this condition?
    You can always do: "explain plan into some_table@remote_database" to avoid inserting into the local database. Unfortunately 10g added a sequence fetch to the "explain plan" code, and this is where the call would fail if you tried this remote approach on your version.
    Here's an idea I haven't tested. If you set up a database link from your production database to the read-only database, you could then do an "explain plan" in the production database for the SQL statement by changing every object reference in the SQL statement to "object@readonlydatabase". In most cases this will allow the optimizer to recognise the statement as "fully remote" and get the optimizer on the readonly database to create the execution plan - which would then be written to the production database.
    Regards
    Jonathan Lewis

  • Can't join Family Plan because in wrong country

    Hi! My dad recently upgraded out family's Spotify account to a Family Plan. We live in Sweden but we're currently on holiday in Spain. I created a new account to join the family plan but when I tried to apply the Family Plan code it said I lived in the wrong country. I have selected Sweden as my home country in the account settings, but it's still wrong. Can a mod correct this for me? My dad's account is: myhrmannenMy account is: augustmyhrman Thanks!

    EDIT: Now solved! I don't know how, but it works.
    I used a proxy to change my location to Sweden and used the code, and ta-da: it worked... I just did the same thing I did before. Maybe it just takes some time for it to work...

  • GlobalEmail and GlobalAccess Plans

    If I add a GlobalEmail or GlobalAccess plan to my account is there a length of time that it needs to remain active before I can cancel it?  I've seen that other companies require a plan to be active for a month or a year but I'm not seeing any such stipulations on the website.

    The $64.99 and $69.98 Global email plans include the same features.  The only difference is that the $69.98 plan allows you to have a cheaper rate for Global calls and with the $64.99 plan, you will pay the flat rate for Global voice. Browsing the web is included with both.  HTH!
    Monthly Access
    Feature Code
    Email Allowance
    Global Voice Rate
    Domestic Voice Rate
    BlackBerry
    Smartphone
    $64.99
    73523
    73524
    Unlimited
    (Global and Domestic)
    Standard Rate by destination
    Determined by Calling Plan
    $69.98
    73525
    73526
    Value Plan Rate by destination
     Global Access is a high-speed global service providing a secure laptop connection to the Internet, corporate Intranet email, and applications through high speed global wireless networks while traveling abroad.
    Monthly Access
    Plan Code
    GlobalAccess
    Mobile Broadband
    Allowance
    Overage
    Allowance
    Overage
    $59.99
    77776
    N/A (Pay Per Use Rate)
    Canada: 
    $.002/KB
    Mexico: 
    $.005/KB
    Rest of World: 
    $.02/KB
    5GB
    (US., U.S.V.I., PR)
    $.05/MB
    (U.S., U.S.V.I., PR)
    $129.99
    80176
    100 MB 
    (in select destinations)
    Select Destinations: $.005/KB
    Rest of World: 
    $.02/KB
    5GB
    (U.S., U.S.V.I., PR and Canada)
    $.05/MB
    (U.S., U.S.V.I., PR and Canada)
    $219.99
    80266
    200 MB 
    (in select destinations)
    This is where the overages come in.  If you go over the allowed megabyte usage.

  • Delete duplicate values from a table

    Hi All
    I have a table like this
    table:
    id name   plan   code
    1   sam  normal   5
    1   sam  normal   6
    1   sam  special  5
    1   sam  Special  6I need to delete data in such a way that one entry with normal and one entry with special plan should remain and should be with different code. Does not matter whether normal stays with 5 or 6 code.
    Can anyone tell me how to do the same? I tried with rowid but it deletes either both normal or both special or returns same code for normal and special.

    It is not that trivial, if I correctly understand your reqs. If there are as many plans as thare are codes and you have a row for each combination:
    SQL> select  *
      2    from  tbl
      3  /
            ID NAM PLAN          CODE
             1 sam normal           5
             1 sam normal           6
             1 sam special          5
             1 sam special          6
    SQL> delete tbl
      2    where rowid not in (
      3                        with t as (
      4                                   select  rowid rid,
      5                                           row_number() over(partition by id,name,code order by plan) plan_rn,
      6                                           row_number() over(partition by id,name,plan order by code) code_rn
      7                                     from  tbl
      8                                  )
      9                        select  rid
    10                          from  t
    11                          where plan_rn = code_rn
    12                       )
    13  /
    2 rows deleted.
    SQL> select  *
      2    from  tbl
      3  /
            ID NAM PLAN          CODE
             1 sam normal           5
             1 sam special          6
    SQL> SY.

  • Help with ORA-01403: no data found please.

    First off I'd like to apologise for my lack of PL/SQL experience, what follows may seem naive, but I guess we all have to start somewhere.
    I'm trying to create a function which determines an employee's Annual Holiday Entitlement by comparing their length of service against a lookup of entitlement values. Due to the complexity of the application I'm targeting there are a number of other factors to be take into consideration, but this is the basic idea of what I want to achieve.
    I've started by taking a working SQL Server 2005 function and converted this using the translation scratch pad in SQL Developer 1.5.1 I'm now hand cranking the subtleties into the script but when I debug the code I'm getting "ORA-01403: no data found" at almost every SELECT. In fact the only successful select is from the ABS_SYSTEM_CONTROLS table. I can handle the first few failures by setting default values in the variables that I'm trying to load, but this isn't an option when it comes to selecting the DATE_OF_START from the PERSON table.
    I've sure I've probably made some fundamental error, but can't spot it myself. Any help would be most welcome.
    I've included the entire script below for your entertainment ;-)
    Thanks
    Phil.
    create or replace
    function mygetannualholidayentitlement
    ( v_empNo in varchar2
    , v_inputDate in DATE
    ) return number as
       -- Declare variables here
       v_entitlement FLOAT(53);
       v_holidayPlan VARCHAR2(20);
       v_contServiceOption VARCHAR2(255);
       v_postNo CHAR(16);
       v_lengthOfService NUMBER(10,2) ; -- Need to give this a default value else the CURSOR (below) won't initialise.
       v_empStartDate DATE;
       -- Load up our loacal variable for each row in the loop and the final value is the one we want.
       v_selectedLOF FLOAT(53);
       v_selectedDateEffective DATE;
       v_selectedAmount FLOAT(53);
       v_effectiveDate DATE;
       -- Cursor declaration
       -- Holiday plan details are also keyed on DATE_EFFECTIVE.  Need to identify which row is active as at our @effectiveDate.
       CURSOR holDefCursor
         IS SELECT length_of_service,
       date_effective,
       amount
         FROM holiday_plan_def
          WHERE hplan_code = v_holidayPlan
         AND length_of_service < v_lengthOfService
         ORDER BY date_effective ASC,
       length_of_service ASC;
    BEGIN
       -- Initialise variables --
       -- truncate any hours/Mins & secs from effective date
       v_effectiveDate := trunc(v_inputdate);
       v_entitlement := 0;
       v_contServiceOption := 0;
       v_lengthOfService := 0;
       BEGIN
       SELECT HPLAN_CODE
         INTO v_holidayPlan
         FROM APPT_HOLIDAY_BALANCE
          WHERE emp_no = v_empNo
                  --          post_no = @postNo and
                  AND ( v_effectiveDate BETWEEN HOLIDAY_YEAR_START AND HOLIDAY_YEAR_END );
       EXCEPTION
       WHEN NO_DATA_FOUND THEN
          v_holidayplan:=NULL;
       WHEN OTHERS THEN
           raise_application_error(-20011,'Unknown Exception in MyGetAnnualHolidayEntitlement function.');
       END;
       -- Still no hoildayPlan? Then use the default plan code from ABS_SYSTEM_CONTROLS.
       IF v_holidayPlan IS NULL THEN
          SELECT HPLAN_CODE
            INTO v_holidayPlan
            FROM ABS_SYSTEM_CONTROLS ;
       END IF;
       BEGIN
        SELECT OPTION_VALUE
          INTO v_contServiceOption
          FROM PS_OPTIONS
           WHERE OPTION_NAME = 'CONTINUOUS_SERVICE_OPTION';
       EXCEPTION
       WHEN NO_DATA_FOUND THEN
          v_contServiceOption := 'N' ;
       WHEN OTHERS THEN
           raise_application_error(-20011,'Unknown Exception in MyGetAnnualHolidayEntitlement function.');
       END;
       IF v_contServiceOption = 'Y' THEN
       BEGIN
          -- Need to take into account the employees CONTINUOUS_SERVICE_DATE when calculating length of service
          BEGIN
          SELECT CONTINUOUS_SERVICE_DATE
            INTO v_empStartDate
            FROM person
             WHERE emp_no = v_empNo;
          EXCEPTION  
            WHEN NO_DATA_FOUND THEN
              v_empStartDate := NULL;
            WHEN OTHERS THEN
              raise_application_error(-20011,'Unknown Exception in MyGetAnnualHolidayEntitlement function.');
          END;
          -- If we can't get a CONTINUOUS_SERVICE_DATE we will fall back to PERSON.DATE_OF_START
          IF v_empStartDate IS NULL THEN
          BEGIN
             SELECT DATE_OF_START
               INTO v_empStartDate
               FROM PERSON
                WHERE emp_no = v_empNo;
          EXCEPTION  
            WHEN OTHERS THEN
              raise_application_error(-20011,'Unknown Exception in MyGetAnnualHolidayEntitlement function.');
          END;
          END IF;
       END;
       ELSE
       BEGIN
          -- Need to use employees DATE_OF_START when calculating length of service
          SELECT DATE_OF_START
            INTO v_empStartDate
            FROM PERSON
             WHERE emp_no = v_empNo;
       END;
       END IF;
       -- Now we can get length of service
       v_lengthOfService := sqlserver_utilities.datediff('MONTH', v_empStartDate, v_effectiveDate) / 12.00;
       OPEN holDefCursor;
       FETCH holDefCursor INTO v_selectedLOF,v_selectedDateEffective,v_selectedAmount;
       WHILE ( sqlserver_utilities.fetch_status(holDefCursor%FOUND) = 0 )
       LOOP
          BEGIN
             IF v_selectedDateEffective < v_effectiveDate THEN
                v_entitlement := v_selectedAmount;
             END IF;
             -- Get the next value.
             FETCH holDefCursor INTO v_selectedLOF,v_selectedDateEffective,v_selectedAmount;
          END;
       END LOOP;
       CLOSE holDefCursor;
       -- Return the result of the function
       RETURN v_entitlement;
    END;Edited by: user4395499 on 27-Oct-2008 04:04
    Edited by: user4395499 on 27-Oct-2008 04:05
    Edited by: user4395499 on 27-Oct-2008 07:10

    Your code is extremely procedural - whilst you could ultimately get it to work like this, it is not the most efficient way of doing it.
    You should think about reducing your code to one sql statement if at all possible - this reduces the amount of context switching that needs to take place (eg. Going from PL/SQL to SQL back to PL/SQL to SQL, etc) and is usually much easier to maintain and test. You could do this by joining the various tables together, (and you might want to think about using nvl() to combine the two queries on the PERSON table!).
    Also, you've labelled your parameters "v_" and your variables "v_" ... common convention uses "p_" for parameters, to allow for easy distinction between parameters passed in and variables declared during the course of the procedure/function.
    As to the char() defined column - is there any chance that you could change that? As you've found out, chars are usually not a good datatype to use! Storing numbers in a char/varchar2 column is a no-no too, as you then run the risk of having invalid numbers stored in the column.

  • Help with XML - which is better - Help needed

    Current version of Oracle:
    BANNER
    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
    PL/SQL Release 11.2.0.1.0 - Production
    CORE 11.2.0.1.0 Production
    TNS for 64-bit Windows: Version 11.2.0.1.0 - Production
    NLSRTL Version 11.2.0.1.0 - Production
    I'm new to XML & this is my first post.
    Background: I have a "few" relational tables which are designed to assist the form scraping and to store the values as Key-Value-Attribute from the UI capture. (the change to the design is not possible at this time). I've also built the "normalized" schema which will hold the normalized data from this form-scrapping schema.
    In order to achive this: I plan on having (1) XML view which the UI will call and then it will be inserted/updated in the normalized schema (2) to be able to use the same XML by the BI publisher for reporting (3) end user query this form-scraping db to view as normalized data.
    Following are my thoughts about the approach & please correct & guide if my understanding/approach is wrong.
    After some good reading on this forum and other materials, I've come up with the below mentioned XML generation method. How can I convert this XML "record" such that it can satisfy the above stated.
    output:
    <?xml version="1.0"?>
    <ROWSET>
    <ROW>
      <FORM_TYPE_ID>900</FORM_TYPE_ID>
      <SYSTEM_NAME>HAZMAT_ENROLLMENT</SYSTEM_NAME>
      <FORM_TYPE>ENR-HAZMAT</FORM_TYPE>
      <FORM_ID>2371370</FORM_ID>
      <SUBMISSION_TYPE_ID>60</SUBMISSION_TYPE_ID>
      <FILING_DATE>29-APR-11</FILING_DATE>
      <SECTION>
       <SECTION_ROW>
        <SECTION_ID>6750</SECTION_ID>
        <SECTION_NAME>Personal Information</SECTION_NAME>
        <ATTRIBUTE>
         <ATTRIBUTE_ROW>
          <SRC>FRM_RSP</SRC>
          <ATTR_ID>30001</ATTR_ID>
          <ATTR_NAME>ENROLLEE_FIRST_NAME</ATTR_NAME>
          <ATTR_DESC>Enrollee&apos;s First Name</ATTR_DESC>
          <ATTR_VAL>Test First Name</ATTR_VAL>
         </ATTRIBUTE_ROW>
         <ATTRIBUTE_ROW>
          <SRC>FRM_RSP</SRC>
          <ATTR_ID>30002</ATTR_ID>
          <ATTR_NAME>ENROLLEE_MIDDLE_INIT</ATTR_NAME>
          <ATTR_DESC>Enrollee&apos;s Middle Initial</ATTR_DESC>
          <ATTR_VAL>Test Middle Initial</ATTR_VAL>
         </ATTRIBUTE_ROW>
       </SECTION_ROW>
      </SECTION>
    </ROW>
    </ROWSET>
    Code:
    *(All REF_% tables are lookup and FRM_RESPONSE is a KVA capture table and TBL_RESPONSE is also a KVA capture only used if the input is table wise (rows X columns))*
    FORM is made up of SECTIONs (1-to-many), SECTIONs contain ATTR_IDs (question ids, 1-to-many), %RESPONSE is always linked to an ATTR_ID
    CREATE OR REPLACE function DEVDBA.gen_xmlstr (p_form_id form.form_id%type) return clob as
    str clob := '
    SELECT rft.form_type_id, rft.system_name,rft.form_type, f.form_id, f.submission_type_id, f.sp_id,
           f.filing_date, f.tracking_num, f.spplmntl_num, f.parent_form_id, f.created_date, f.created_by,
           f.updated_date, f.updated_by,
           CURSOR(SELECT rs.section_id,
                         rs.section_name,
                         CURSOR(SELECT ''FRM_RSP'' src, fr.frm_response_id, ra.attr_id, ra.attr_name, ra.attr_desc, fr.attr_val
                                  FROM frm_response fr, ref_attr ra, ref_section_attr rsa
                                 WHERE fr.form_id = f.form_id
                                 AND fr.attr_id = rsa.attr_id
                                 AND fr.form_section_id = rsa.form_section_id
                                 AND fr.attr_id = ra.attr_id
                                 AND rsa.form_section_id = rfs.form_section_id
                                UNION
                                SELECT ''TBL_RSP1'' src, tr.tbl_response_id, tr.col_attr_id1, ra.attr_name, ra.attr_desc, col_attr_val1
                                  FROM tbl_response tr, ref_attr ra, ref_section_attr rsa
                                 WHERE tr.form_id = f.form_id
                                 AND tr.col_attr_id1 = ra.attr_id
                                 AND tr.form_section_id = rsa.form_section_id
                                 AND rsa.form_section_id = rfs.form_section_id
                                UNION
                                SELECT ''TBL_RSP2'' src, tr.tbl_response_id, tr.col_attr_id2, ra.attr_name, ra.attr_desc, col_attr_val2
                                  FROM tbl_response tr, ref_attr ra, ref_section_attr rsa
                                 WHERE tr.form_id = f.form_id
                                 AND tr.col_attr_id2 = ra.attr_id
                                 AND tr.form_section_id = rsa.form_section_id
                                 AND rsa.form_section_id = rfs.form_section_id
                                UNION
                                SELECT ''TBL_RSP3'' src, tr.tbl_response_id, TO_NUMBER(tr.col_attr_id3), ra.attr_name, ra.attr_desc, col_attr_val3
                                  FROM tbl_response tr, ref_attr ra, ref_section_attr rsa
                                 WHERE tr.form_id = f.form_id
                                 AND TO_NUMBER(tr.col_attr_id3) = ra.attr_id
                                 AND tr.form_section_id = rsa.form_section_id
                                 AND rsa.form_section_id = rfs.form_section_id
                                UNION
                                SELECT ''TBL_RSP4'' src, tr.tbl_response_id, tr.col_attr_id4, ra.attr_name, ra.attr_desc, col_attr_val4
                                  FROM tbl_response tr, ref_attr ra, ref_section_attr rsa
                                 WHERE tr.form_id = f.form_id
                                 AND tr.col_attr_id4 = ra.attr_id
                                 AND tr.form_section_id = rsa.form_section_id
                                 AND rsa.form_section_id = rfs.form_section_id
                                UNION
                                SELECT ''TBL_RSP5'' src, tr.tbl_response_id, tr.col_attr_id5, ra.attr_name, ra.attr_desc, col_attr_val5
                                  FROM tbl_response tr, ref_attr ra, ref_section_attr rsa
                                 WHERE tr.form_id = f.form_id
                                 AND tr.col_attr_id5 = ra.attr_id
                                 AND tr.form_section_id = rsa.form_section_id
                                 AND rsa.form_section_id = rfs.form_section_id
                                UNION
                                SELECT ''TBL_RSP6'' src, tr.tbl_response_id, tr.col_attr_id6, ra.attr_name, ra.attr_desc, col_attr_val6
                                  FROM tbl_response tr, ref_attr ra, ref_section_attr rsa
                                 WHERE tr.form_id = f.form_id
                                 AND tr.col_attr_id6 = ra.attr_id
                                 AND tr.form_section_id = rsa.form_section_id
                                 AND rsa.form_section_id = rfs.form_section_id
                                UNION
                                SELECT ''TBL_RSP7'' src, tr.tbl_response_id, tr.col_attr_id7, ra.attr_name, ra.attr_desc, col_attr_val7
                                  FROM tbl_response tr, ref_attr ra, ref_section_attr rsa
                                 WHERE tr.form_id = f.form_id
                                 AND tr.col_attr_id7 = ra.attr_id
                                 AND tr.form_section_id = rsa.form_section_id
                                 AND rsa.form_section_id = rfs.form_section_id
                                UNION
                                SELECT ''TBL_RSP8'' src, tr.tbl_response_id, tr.col_attr_id8, ra.attr_name, ra.attr_desc, col_attr_val8
                                  FROM tbl_response tr, ref_attr ra, ref_section_attr rsa
                                 WHERE tr.form_id = f.form_id
                                 AND tr.col_attr_id8 = ra.attr_id
                                 AND tr.form_section_id = rsa.form_section_id
                                 AND rsa.form_section_id = rfs.form_section_id
                                UNION
                                SELECT ''TBL_RSP9'' src, tr.tbl_response_id, tr.col_attr_id9, ra.attr_name, ra.attr_desc, col_attr_val9
                                  FROM tbl_response tr, ref_attr ra, ref_section_attr rsa
                                 WHERE tr.form_id = f.form_id
                                 AND tr.col_attr_id9 = ra.attr_id
                                 AND tr.form_section_id = rsa.form_section_id
                                 AND rsa.form_section_id = rfs.form_section_id
                                UNION
                                SELECT ''TBL_RSP10'' src, tr.tbl_response_id, tr.col_attr_id10, ra.attr_name, ra.attr_desc, col_attr_val10
                                  FROM tbl_response tr, ref_attr ra, ref_section_attr rsa
                                 WHERE tr.form_id = f.form_id
                                 AND tr.col_attr_id10 = ra.attr_id
                                 AND tr.form_section_id = rsa.form_section_id
                                 AND rsa.form_section_id = rfs.form_section_id
                           attribute
                    FROM ref_section rs, ref_form_section rfs
                   WHERE rs.section_id = rfs.section_id
                   AND   rfs.form_type_id = f.form_type_id
                  ORDER BY rs.section_id, rfs.form_section_id)
             section
      FROM ref_form_type rft, form f
    WHERE rft.form_type_id = f.form_type_id
    AND f.form_id = ' || p_form_id; --2371370'';
    begin
      return dbms_xmlgen.getxml(str);
    end gen_xmlstr;
    Invocation:
    select gen_xmlstr(2371370)
    from dual;
    Below is the execution plan. Can this be better?
    Execution Plan
    Plan hash value: 2652539008
    | Id  | Operation                        | Name                 | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT                 |                      |     1 |    75 |     3   (0)| 00:00:01 |
    |   1 |  SORT UNIQUE                     |                      |    11 |  1024 |    40  (88)| 00:00:01 |
    |   2 |   UNION-ALL                      |                      |       |       |            |          |
    |   3 |    NESTED LOOPS                  |                      |       |       |            |          |
    |   4 |     NESTED LOOPS                 |                      |     1 |    91 |     5   (0)| 00:00:01 |
    |   5 |      NESTED LOOPS                |                      |     1 |    82 |     3   (0)| 00:00:01 |
    |*  6 |       TABLE ACCESS BY INDEX ROWID| FRM_RESPONSE         |     1 |    25 |     2   (0)| 00:00:01 |
    |*  7 |        INDEX RANGE SCAN          | FK3_FRM_RESPONSE     |    20 |       |     1   (0)| 00:00:01 |
    |   8 |       TABLE ACCESS BY INDEX ROWID| REF_ATTR             |     1 |    57 |     1   (0)| 00:00:01 |
    |*  9 |        INDEX UNIQUE SCAN         | PK_REF_ATTR          |     1 |       |     0   (0)| 00:00:01 |
    |* 10 |      INDEX RANGE SCAN            | FK2_REF_SECTION_ATTR |     2 |       |     1   (0)| 00:00:01 |
    |* 11 |     TABLE ACCESS BY INDEX ROWID  | REF_SECTION_ATTR     |     1 |     9 |     2   (0)| 00:00:01
    |  12 |    NESTED LOOPS                  |                      |       |       |            |          |
    |  13 |     NESTED LOOPS                 |                      |     1 |   105 |     2   (0)| 00:00:01 |
    |  14 |      NESTED LOOPS                |                      |     1 |    48 |     2   (0)| 00:00:01 |
    |* 15 |       INDEX RANGE SCAN           | FK1_REF_SECTION_ATTR |     9 |    36 |     1   (0)| 00:00:01 |
    |* 16 |       TABLE ACCESS BY INDEX ROWID| TBL_RESPONSE         |     1 |    44 |     1   (0)| 00:00:01 |
    |* 17 |        INDEX RANGE SCAN          | FK1_TBL_RESPONSE     |     1 |       |     0   (0)| 00:00:01 |
    |* 18 |      INDEX UNIQUE SCAN           | PK_REF_ATTR          |     1 |       |     0   (0)| 00:00:01 |
    |  19 |     TABLE ACCESS BY INDEX ROWID  | REF_ATTR             |     1 |    57 |     0   (0)| 00:00:01 |
    |  20 |    NESTED LOOPS                  |                      |       |       |            |          |
    |  21 |     NESTED LOOPS                 |                      |     1 |   100 |     2   (0)| 00:00:01 |
    |  22 |      NESTED LOOPS                |                      |     1 |    43 |     2   (0)| 00:00:01 |
    |* 23 |       INDEX RANGE SCAN           | FK1_REF_SECTION_ATTR |     9 |    36 |     1   (0)| 00:00:01 |
    |* 24 |       TABLE ACCESS BY INDEX ROWID| TBL_RESPONSE         |     1 |    39 |     1   (0)| 00:00:01 |
    |* 25 |        INDEX RANGE SCAN          | FK1_TBL_RESPONSE     |     1 |       |     0   (0)| 00:00:01 |
    |* 26 |      INDEX UNIQUE SCAN           | PK_REF_ATTR          |     1 |       |     0   (0)| 00:00:01 |
    |  27 |     TABLE ACCESS BY INDEX ROWID  | REF_ATTR             |     1 |    57 |     0   (0)| 00:00:01 |
    |  28 |    NESTED LOOPS                  |                      |       |       |            |          |
    |  29 |     NESTED LOOPS                 |                      |     1 |    86 |     3   (0)| 00:00:01 |
    |  30 |      NESTED LOOPS                |                      |     1 |    29 |     2   (0)| 00:00:01 |
    |* 31 |       INDEX RANGE SCAN           | FK1_REF_SECTION_ATTR |     9 |    36 |     1   (0)| 00:00:01 |
    |* 32 |       TABLE ACCESS BY INDEX ROWID| TBL_RESPONSE         |     1 |    25 |     1   (0)| 00:00:01 |
    |* 33 |        INDEX RANGE SCAN          | FK1_TBL_RESPONSE     |     1 |       |     0   (0)| 00:00:01 |
    |* 34 |      INDEX UNIQUE SCAN           | PK_REF_ATTR          |     1 |       |     0   (0)| 00:00:01 |
    |  35 |     TABLE ACCESS BY INDEX ROWID  | REF_ATTR             |     1 |    57 |     1   (0)| 00:00:01 |
    |  36 |    NESTED LOOPS                  |                      |       |       |            |          |
    |  37 |     NESTED LOOPS                 |                      |     1 |    93 |     2   (0)| 00:00:01 |
    |  38 |      NESTED LOOPS                |                      |     1 |    36 |     2   (0)| 00:00:01 |
    |* 39 |       INDEX RANGE SCAN           | FK1_REF_SECTION_ATTR |     9 |    36 |     1   (0)| 00:00:01 |
    |* 40 |       TABLE ACCESS BY INDEX ROWID| TBL_RESPONSE         |     1 |    32 |     1   (0)| 00:00:01 |
    |* 41 |        INDEX RANGE SCAN          | FK1_TBL_RESPONSE     |     1 |       |     0   (0)| 00:00:01 |
    |* 42 |      INDEX UNIQUE SCAN           | PK_REF_ATTR          |     1 |       |     0   (0)| 00:00:01 |
    |  43 |     TABLE ACCESS BY INDEX ROWID  | REF_ATTR             |     1 |    57 |     0   (0)| 00:00:01 |
    |  44 |    NESTED LOOPS                  |                      |       |       |            |          |
    |  45 |     NESTED LOOPS                 |                      |     1 |    93 |     2   (0)| 00:00:01 |
    |  46 |      NESTED LOOPS                |                      |     1 |    36 |     2   (0)| 00:00:01 |
    |* 47 |       INDEX RANGE SCAN           | FK1_REF_SECTION_ATTR |     9 |    36 |     1   (0)| 00:00:01 |
    |* 48 |       TABLE ACCESS BY INDEX ROWID| TBL_RESPONSE         |     1 |    32 |     1   (0)| 00:00:01 |
    |* 49 |        INDEX RANGE SCAN          | FK1_TBL_RESPONSE     |     1 |       |     0   (0)| 00:00:01 |
    |* 50 |      INDEX UNIQUE SCAN           | PK_REF_ATTR          |     1 |       |     0   (0)| 00:00:01 |
    |  51 |     TABLE ACCESS BY INDEX ROWID  | REF_ATTR             |     1 |    57 |     0   (0)| 00:00:01 |
    |  52 |    NESTED LOOPS                  |                      |       |       |            |          |
    |  53 |     NESTED LOOPS                 |                      |     1 |    90 |     2   (0)| 00:00:01 |
    |  54 |      NESTED LOOPS                |                      |     1 |    33 |     2   (0)| 00:00:01 |
    |* 55 |       INDEX RANGE SCAN           | FK1_REF_SECTION_ATTR |     9 |    36 |     1   (0)| 00:00:01 |
    |* 56 |       TABLE ACCESS BY INDEX ROWID| TBL_RESPONSE         |     1 |    29 |     1   (0)| 00:00:01 |
    |* 57 |        INDEX RANGE SCAN          | FK1_TBL_RESPONSE     |     1 |       |     0   (0)| 00:00:01 |
    |* 58 |      INDEX UNIQUE SCAN           | PK_REF_ATTR          |     1 |       |     0   (0)| 00:00:01 |
    |  59 |     TABLE ACCESS BY INDEX ROWID  | REF_ATTR             |     1 |    57 |     0   (0)| 00:00:01 |
    |  60 |    NESTED LOOPS                  |                      |       |       |            |          |
    |  61 |     NESTED LOOPS                 |                      |     1 |    95 |     2   (0)| 00:00:01 |
    |  62 |      NESTED LOOPS                |                      |     1 |    38 |     2   (0)| 00:00:01 |
    |* 63 |       INDEX RANGE SCAN           | FK1_REF_SECTION_ATTR |     9 |    36 |     1   (0)| 00:00:01 |
    |* 64 |       TABLE ACCESS BY INDEX ROWID| TBL_RESPONSE         |     1 |    34 |     1   (0)| 00:00:01 |
    |* 65 |        INDEX RANGE SCAN          | FK1_TBL_RESPONSE     |     1 |       |     0   (0)| 00:00:01 |
    |* 66 |      INDEX UNIQUE SCAN           | PK_REF_ATTR          |     1 |       |     0   (0)| 00:00:01 |
    |  67 |     TABLE ACCESS BY INDEX ROWID  | REF_ATTR             |     1 |    57 |     0   (0)| 00:00:01 |
    |  68 |    NESTED LOOPS                  |                      |       |       |            |          |
    |  69 |     NESTED LOOPS                 |                      |     1 |    90 |     2   (0)| 00:00:01 |
    |  70 |      NESTED LOOPS                |                      |     1 |    33 |     2   (0)| 00:00:01 |
    |* 71 |       INDEX RANGE SCAN           | FK1_REF_SECTION_ATTR |     9 |    36 |     1   (0)| 00:00:01 |
    |* 72 |       TABLE ACCESS BY INDEX ROWID| TBL_RESPONSE         |     1 |    29 |     1   (0)| 00:00:01 |
    |* 73 |        INDEX RANGE SCAN          | FK1_TBL_RESPONSE     |     1 |       |     0   (0)| 00:00:01 |
    |* 74 |      INDEX UNIQUE SCAN           | PK_REF_ATTR          |     1 |       |     0   (0)| 00:00:01 |
    |  75 |     TABLE ACCESS BY INDEX ROWID  | REF_ATTR             |     1 |    57 |     0   (0)| 00:00:01 |
    |  76 |    NESTED LOOPS                  |                      |       |       |            |          |
    |  77 |     NESTED LOOPS                 |                      |     1 |    90 |     2   (0)| 00:00:01 |
    |  78 |      NESTED LOOPS                |                      |     1 |    33 |     2   (0)| 00:00:01 |
    |* 79 |       INDEX RANGE SCAN           | FK1_REF_SECTION_ATTR |     9 |    36 |     1   (0)| 00:00:01 |
    |* 80 |       TABLE ACCESS BY INDEX ROWID| TBL_RESPONSE         |     1 |    29 |     1   (0)| 00:00:01 |
    |* 81 |        INDEX RANGE SCAN          | FK1_TBL_RESPONSE     |     1 |       |     0   (0)| 00:00:01 |
    |* 82 |      INDEX UNIQUE SCAN           | PK_REF_ATTR          |     1 |       |     0   (0)| 00:00:01 |
    |  83 |     TABLE ACCESS BY INDEX ROWID  | REF_ATTR             |     1 |    57 |     0   (0)| 00:00:01 |
    |  84 |    NESTED LOOPS                  |                      |       |       |            |          |
    |  85 |     NESTED LOOPS                 |                      |     1 |    91 |     2   (0)| 00:00:01 |
    |  86 |      NESTED LOOPS                |                      |     1 |    34 |     2   (0)| 00:00:01 |
    |* 87 |       INDEX RANGE SCAN           | FK1_REF_SECTION_ATTR |     9 |    36 |     1   (0)| 00:00:01 |
    |* 88 |       TABLE ACCESS BY INDEX ROWID| TBL_RESPONSE         |     1 |    30 |     1   (0)| 00:00:01 |
    |* 89 |        INDEX RANGE SCAN          | FK1_TBL_RESPONSE     |     1 |       |     0   (0)| 00:00:01 |
    |* 90 |      INDEX UNIQUE SCAN           | PK_REF_ATTR          |     1 |       |     0   (0)| 00:00:01 |
    |  91 |     TABLE ACCESS BY INDEX ROWID  | REF_ATTR             |     1 |    57 |     0   (0)| 00:00:01 |
    |  92 |  SORT ORDER BY                   |                      |    20 |  1040 |     7  (29)| 00:00:01 |
    |* 93 |   HASH JOIN                      |                      |    20 |  1040 |     6  (17)| 00:00:01 |
    |  94 |    TABLE ACCESS BY INDEX ROWID   | REF_FORM_SECTION     |    20 |   200 |     2   (0)| 00:00:01 |
    |* 95 |     INDEX RANGE SCAN             | FK1_FORM_SECTION     |    20 |       |     1   (0)| 00:00:01 |
    |  96 |    TABLE ACCESS FULL             | REF_SECTION          |   100 |  4200 |     3   (0)| 00:00:01 |
    |  97 |  NESTED LOOPS                    |                      |     1 |    75 |     3   (0)| 00:00:01 |
    |  98 |   TABLE ACCESS BY INDEX ROWID    | FORM                 |     1 |    59 |     2   (0)| 00:00:01 |
    |* 99 |    INDEX UNIQUE SCAN             | PK_FORM              |     1 |       |     1   (0)| 00:00:01 |
    | 100 |   TABLE ACCESS BY INDEX ROWID    | REF_FORM_TYPE        |     5 |    80 |     1   (0)| 00:00:01 |
    |*101 |    INDEX UNIQUE SCAN             | PK_REF_FORM_TYPE     |     1 |       |     0   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
       6 - filter("FR"."FORM_SECTION_ID"=:B1)
       7 - access("FR"."FORM_ID"=:B1)
       9 - access("FR"."ATTR_ID"="RA"."ATTR_ID")
      10 - access("FR"."ATTR_ID"="RSA"."ATTR_ID")
      11 - filter("RSA"."FORM_SECTION_ID"=:B1 AND "FR"."FORM_SECTION_ID"="RSA"."FORM_SECTION_ID")
      15 - access("RSA"."FORM_SECTION_ID"=:B1)
      16 - filter("TR"."COL_ATTR_ID1" IS NOT NULL AND "TR"."FORM_ID"=:B1)
      17 - access("TR"."FORM_SECTION_ID"=:B1)
           filter("TR"."FORM_SECTION_ID"="RSA"."FORM_SECTION_ID")
      18 - access("TR"."COL_ATTR_ID1"="RA"."ATTR_ID")
      23 - access("RSA"."FORM_SECTION_ID"=:B1)
      24 - filter("TR"."COL_ATTR_ID2" IS NOT NULL AND "TR"."FORM_ID"=:B1)
      25 - access("TR"."FORM_SECTION_ID"=:B1)
           filter("TR"."FORM_SECTION_ID"="RSA"."FORM_SECTION_ID")
      26 - access("TR"."COL_ATTR_ID2"="RA"."ATTR_ID")
      31 - access("RSA"."FORM_SECTION_ID"=:B1)
      32 - filter("TR"."FORM_ID"=:B1)
      33 - access("TR"."FORM_SECTION_ID"=:B1)
           filter("TR"."FORM_SECTION_ID"="RSA"."FORM_SECTION_ID")
      34 - access("RA"."ATTR_ID"=TO_NUMBER("TR"."COL_ATTR_ID3"))
      39 - access("RSA"."FORM_SECTION_ID"=:B1)
      40 - filter("TR"."COL_ATTR_ID4" IS NOT NULL AND "TR"."FORM_ID"=:B1)
      41 - access("TR"."FORM_SECTION_ID"=:B1)
           filter("TR"."FORM_SECTION_ID"="RSA"."FORM_SECTION_ID")
      42 - access("TR"."COL_ATTR_ID4"="RA"."ATTR_ID")
      47 - access("RSA"."FORM_SECTION_ID"=:B1)
      48 - filter("TR"."COL_ATTR_ID5" IS NOT NULL AND "TR"."FORM_ID"=:B1)
      49 - access("TR"."FORM_SECTION_ID"=:B1)
           filter("TR"."FORM_SECTION_ID"="RSA"."FORM_SECTION_ID")
      50 - access("TR"."COL_ATTR_ID5"="RA"."ATTR_ID")
      55 - access("RSA"."FORM_SECTION_ID"=:B1)
      56 - filter("TR"."COL_ATTR_ID6" IS NOT NULL AND "TR"."FORM_ID"=:B1)
      57 - access("TR"."FORM_SECTION_ID"=:B1)
           filter("TR"."FORM_SECTION_ID"="RSA"."FORM_SECTION_ID")
      58 - access("TR"."COL_ATTR_ID6"="RA"."ATTR_ID")
      63 - access("RSA"."FORM_SECTION_ID"=:B1)
      64 - filter("TR"."COL_ATTR_ID7" IS NOT NULL AND "TR"."FORM_ID"=:B1)
      65 - access("TR"."FORM_SECTION_ID"=:B1)
           filter("TR"."FORM_SECTION_ID"="RSA"."FORM_SECTION_ID")
      66 - access("TR"."COL_ATTR_ID7"="RA"."ATTR_ID")
      71 - access("RSA"."FORM_SECTION_ID"=:B1)
      72 - filter("TR"."COL_ATTR_ID8" IS NOT NULL AND "TR"."FORM_ID"=:B1)
      73 - access("TR"."FORM_SECTION_ID"=:B1)
           filter("TR"."FORM_SECTION_ID"="RSA"."FORM_SECTION_ID")
      74 - access("TR"."COL_ATTR_ID8"="RA"."ATTR_ID")
      79 - access("RSA"."FORM_SECTION_ID"=:B1)
      80 - filter("TR"."COL_ATTR_ID9" IS NOT NULL AND "TR"."FORM_ID"=:B1)
      81 - access("TR"."FORM_SECTION_ID"=:B1)
           filter("TR"."FORM_SECTION_ID"="RSA"."FORM_SECTION_ID")
      82 - access("TR"."COL_ATTR_ID9"="RA"."ATTR_ID")
      87 - access("RSA"."FORM_SECTION_ID"=:B1)
      88 - filter("TR"."COL_ATTR_ID10" IS NOT NULL AND "TR"."FORM_ID"=:B1)
      89 - access("TR"."FORM_SECTION_ID"=:B1)
           filter("TR"."FORM_SECTION_ID"="RSA"."FORM_SECTION_ID")
      90 - access("TR"."COL_ATTR_ID10"="RA"."ATTR_ID")
      93 - access("RS"."SECTION_ID"="RFS"."SECTION_ID")
      95 - access("RFS"."FORM_TYPE_ID"=:B1)
      99 - access("F"."FORM_ID"=2371370)
    101 - access("RFT"."FORM_TYPE_ID"="F"."FORM_TYPE_ID")
    What tools/techniques are available to generate the XSLT? (use XMLSpy etc?), how to create a such that it can be as simple as "select from v_xml_view;" and be able to replace * with column names?*
    ==============================
    I've also tried the *SQL-XML extensions* but am stuck with the UNION PART (help is requested on how to union columns within the XMLAgg).
    {code}
    select
    xmlelement ("System",
    xmlforest(rft.form_type_id as "FormTypeID", rft.system_name as "SystemName", rft.form_type as "FormType", f.form_id as "FormID"),
    xmlelement("Sections",
    (select xmlagg(xmlelement("Section",
    xmlforest(rs.section_id as "SectionID", rs.section_name as "SectionName"),
    xmlelement("Attributes",
    (select xmlagg(xmlelement("Attr",
    xmlforest (rsa.attr_id as "AttrID", ra.attr_name as "AttrName", ra.attr_desc as "Attr_desc", fr.attr_val as "AttrValue")
    ) -- "attr"
    ) --xmlagg attr
    from ref_section_attr rsa, ref_attr ra, frm_response fr
    where rsa.attr_id = ra.attr_id
    and rsa.form_section_id = rfs.form_section_id
    and fr.form_id = f.form_id
    and fr.form_section_id = rsa.form_section_id
    and fr.attr_id = rsa.attr_id
    ) --attributes select
    ) -- attributes
    ) -- section elements
    ) -- xmlagg
    from ref_section rs, ref_form_section rfs
    where rs.section_id = rfs.section_id
    and rfs.form_type_id = f.form_type_id
    ) -- select query
    ) -- sections
    ) -- system
    as str
    from ref_form_type rft, FORM f
    where rft.form_type_id = f.form_type_id
    and f.form_id = 2371420;
    {code}
    *and the output is like:
    (I don't know how to format this for easy viewing!)*
    {code}
    <System><FormTypeID>900</FormTypeID><SystemName>HAZMAT_ENROLLMENT</SystemName><FormType>ENR-HAZMAT</FormType><FormID>2371420</FormID><Sections><Section><SectionID>6750</SectionID><SectionName>Personal Information</SectionName><Attributes><Attr><AttrID>30001</AttrID><AttrName>ENROLLEE_FIRST_NAME</AttrName><Attr_desc>Enrollee&apos;s First Name</Attr_desc><AttrValue>Enroll</AttrValue></Attr><Attr><AttrID>30002</AttrID><AttrName>ENROLLEE_MIDDLE_INIT</AttrName><Attr_desc>Enrollee&apos;s Middle Initial</Attr_desc><AttrValue> </AttrValue></Attr><Attr><AttrID>30003</AttrID><AttrName>ENROLLEE_LAST_NAME</AttrName><Attr_desc>Enrollee&apos;s Last Name</Attr_desc><AttrValue>User11</AttrValue></Attr><Attr><AttrID>30004</AttrID><AttrName>ENROLLEE_WORK_PHONE</AttrName><Attr_desc>Enrollee&apos;s Work Phone Number</Attr_desc><AttrValue>(703) 222-4444</AttrValue></Attr><Attr><AttrID>30005</AttrID><AttrName>ENROLLEE_FAX</AttrName><Attr_desc>Enrollee Fax Number</Attr_desc><AttrValue> </AttrValue></Attr><Attr><AttrID>30006</AttrID><AttrName>ENROLLEE_EXT</AttrName><Attr_desc>Enrollee&apos;s Work Extension</Attr_desc><AttrValue> </AttrValue></Attr><Attr><AttrID>30007</AttrID><AttrName>ENROLLEE_EMAIL</AttrName><Attr_desc>Enrollee&apos;s Email</Attr_desc><AttrValue>[email protected]</AttrValue></Attr><Attr><AttrID>30023</AttrID><AttrName>POC_TYPE</AttrName><Attr_desc>Point of Contact Type</Attr_desc><AttrValue>Consultant</AttrValue></Attr><Attr><AttrID>30008</AttrID><AttrName>ENROLLEE_MAIL_ADDR_1</AttrName><Attr_desc>Enrollee&apos;s Mailing Address #1</Attr_desc><AttrValue>123 Main St</AttrValue></Attr><Attr><AttrID>30009</AttrID><AttrName>ENROLLEE_MAIL_ADDR_2</AttrName><Attr_desc>Enrollee&apos;s Mailing Address #2</Attr_desc><AttrValue> </AttrValue></Attr><Attr><AttrID>30010</AttrID><AttrName>ENROLLEE_CITY</AttrName><Attr_desc>Enrollee&apos;s City</Attr_desc><AttrValue>Herndon</AttrValue></Attr><Attr><AttrID>30011</AttrID><AttrName>ENROLLEE_STATE</AttrName><Attr_desc>Enrollee&apos;s State</Attr_desc><AttrValue>VA</AttrValue></Attr><Attr><AttrID>30012</AttrID><AttrName>ENROLLEE_ZIP</AttrName><Attr_desc>Enrollee&apos;s Zip</Attr_desc><AttrValue>28408</AttrValue></Attr><Attr><AttrID>30013</AttrID><AttrName>ENROLLEE_USER_NAME</AttrName><Attr_desc>Enrollee&apos;s User Name</Attr_desc><AttrValue>enrolluser11</AttrValue></Attr></Attributes></Section><Section><SectionID>6800</SectionID><SectionName>Company Information</SectionName><Attributes><Attr><AttrID>30014</AttrID><AttrName>DUN_BRADSTREET_NUM</AttrName><Attr_desc>Company&apos;s Dun and Bradstreet #</Attr_desc><AttrValue>198455201</AttrValue></Attr></Attributes></Section><Section><SectionID>6850</SectionID><SectionName>Points of Contact</SectionName><Attributes></Attributes></Section><Section><SectionID>6900</SectionID><SectionName>Enrollment Verification</SectionName><Attributes></Attributes></Section><Section><SectionID>6950</SectionID><SectionName>Enrollment Confirmation</SectionName><Attributes></Attributes></Section></Sections></System>
    {code}
    *The execution plan:*
    {code}
    Execution Plan
    Plan hash value: 2641045985
    | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
    ------------

    Thanks for the data.
    I thought you would have included data from TBL_RESPONSE, as the interesting part is how to deal with this "special" design ;)
    So, to run some tests, I've generated the following data for FORM_SECTION_ID 5350 and 5360 :
    insert into tbl_response (FORM_ID, FORM_SECTION_ID, COL_ATTR_ID1, COL_ATTR_VAL1, COL_ATTR_ID2, COL_ATTR_VAL2, COL_ATTR_ID3, COL_ATTR_VAL3, COL_ATTR_ID4, COL_ATTR_VAL4, COL_ATTR_ID5, COL_ATTR_VAL5, COL_ATTR_ID6, COL_ATTR_VAL6, COL_ATTR_ID7, COL_ATTR_VAL7, COL_ATTR_ID8, COL_ATTR_VAL8, COL_ATTR_ID9, COL_ATTR_VAL9, COL_ATTR_ID10, COL_ATTR_VAL10)
    values (2371420, 5350, 30000, '05/03/2011', 30001, 'John', '30002', 'J', 30003, 'Doe', 30004, '(555) 123-1234', 30005, '(555) 123-1235', 30006, '1234567', 30007, '[email protected]', 30008, '10 Maple Street', 30009, '.');
    insert into tbl_response (FORM_ID, FORM_SECTION_ID, COL_ATTR_ID1, COL_ATTR_VAL1, COL_ATTR_ID2, COL_ATTR_VAL2, COL_ATTR_ID3, COL_ATTR_VAL3, COL_ATTR_ID4, COL_ATTR_VAL4, COL_ATTR_ID5, COL_ATTR_VAL5, COL_ATTR_ID6, COL_ATTR_VAL6, COL_ATTR_ID7, COL_ATTR_VAL7, COL_ATTR_ID8, COL_ATTR_VAL8, COL_ATTR_ID9, COL_ATTR_VAL9, COL_ATTR_ID10, COL_ATTR_VAL10)
    values (2371420, 5350, 30011, 'MA', 30012, '02668', '30013', 'jdoe', null, '', null, '', null, '', null, '', null, '', null, '', null, '');
    insert into tbl_response (FORM_ID, FORM_SECTION_ID, COL_ATTR_ID1, COL_ATTR_VAL1, COL_ATTR_ID2, COL_ATTR_VAL2, COL_ATTR_ID3, COL_ATTR_VAL3, COL_ATTR_ID4, COL_ATTR_VAL4, COL_ATTR_ID5, COL_ATTR_VAL5, COL_ATTR_ID6, COL_ATTR_VAL6, COL_ATTR_ID7, COL_ATTR_VAL7, COL_ATTR_ID8, COL_ATTR_VAL8, COL_ATTR_ID9, COL_ATTR_VAL9, COL_ATTR_ID10, COL_ATTR_VAL10)
    values (2371420, 5360, 30014, '123456789', 30015, 'My Company', '30016', '50 Main Street', 30017, '.', 30018, 'Marstons Mills', 30019, 'MA', 30020, '02648', 30021, '(555) 123-1236', null, '', null, '');And here's the query :
    WITH attr_unpivot AS (
      SELECT form_section_id
           , attr_val
      FROM (
        SELECT form_section_id
             , XMLForest(col_attr_id1 as "AttrID", col_attr_val1 as "AttrValue") as attr01
             , XMLForest(col_attr_id2 as "AttrID", col_attr_val2 as "AttrValue") as attr02
             , XMLForest(col_attr_id3 as "AttrID", col_attr_val3 as "AttrValue") as attr03
             , XMLForest(col_attr_id4 as "AttrID", col_attr_val4 as "AttrValue") as attr04
             , XMLForest(col_attr_id5 as "AttrID", col_attr_val5 as "AttrValue") as attr05
             , XMLForest(col_attr_id6 as "AttrID", col_attr_val6 as "AttrValue") as attr06
             , XMLForest(col_attr_id7 as "AttrID", col_attr_val7 as "AttrValue") as attr07
             , XMLForest(col_attr_id8 as "AttrID", col_attr_val8 as "AttrValue") as attr08
             , XMLForest(col_attr_id9 as "AttrID", col_attr_val9 as "AttrValue") as attr09
             , XMLForest(col_attr_id10 as "AttrID", col_attr_val10 as "AttrValue") as attr10
        FROM tbl_response
        WHERE form_id = 2371420
      UNPIVOT (
        attr_val FOR attr_pos IN (attr01,attr02,attr03,attr04,attr05,attr06,attr07,attr08,attr09,attr10)
      UNION ALL
      SELECT form_section_id
           , XMLForest(fr.attr_id as "AttrID", fr.attr_val as "AttrValue")
      FROM frm_response fr
      WHERE fr.form_id = 2371420
    SELECT XMLElement("System",
             XMLForest(
               rft.form_type_id as "FormTypeID"
             , rft.system_name as "SystemName"
             , rft.form_type as "FormType"
             , f.form_id as "FormID"
           , XMLElement("Sections",
                SELECT XMLAgg(
                         XMLElement("Section",
                           XMLForest(
                             rs.section_id as "SectionID"
                           , rs.section_name as "SectionName"
                         , XMLElement("Attributes",
                              SELECT XMLAgg(
                                       XMLElement("Attr",
                                         XMLForest(
                                           ra.attr_desc as "AttrDesc"
                                         , ra.attr_name as "AttrName"
                                       , v.attr_val
                              FROM attr_unpivot v
                                   JOIN ref_section_attr rsa ON rsa.attr_id = extractValue(v.attr_val,'AttrID')
                                                            AND rsa.form_section_id = v.form_section_id
                                   JOIN ref_attr ra ON ra.attr_id = rsa.attr_id
                              WHERE rsa.form_section_id = rfs.form_section_id
                FROM ref_section rs
                     JOIN ref_form_section rfs ON rs.section_id = rfs.section_id
                WHERE rfs.form_type_id = f.form_type_id
           ) as xmldoc
    FROM ref_form_type rft
         JOIN form f ON rft.form_type_id = f.form_type_id
    WHERE f.form_id = 2371420
    ;The WITH clause builds a normalized result set out of TBL_RESPONSE and FRM_RESPONSE.
    That result set is then joined in the main query for each section of the form.
    The resulting XML document looks like :
    <System>
      <FormTypeID>900</FormTypeID>
      <SystemName>ENROLLMENT</SystemName>
      <FormType>ENR</FormType>
      <FormID>2371420</FormID>
      <Sections>
        <Section>
          <SectionID>6750</SectionID>
          <SectionName>Personal Information</SectionName>
          <Attributes>
            <Attr>
              <AttrDesc>Enrollment Date</AttrDesc>
              <AttrName>ENROLLMENT_DATE</AttrName>
              <AttrID>30000</AttrID>
              <AttrValue>05/03/2011</AttrValue>
            </Attr>
            <Attr>
              <AttrDesc>Enrollee&apos;s First Name</AttrDesc>
              <AttrName>ENROLLEE_FIRST_NAME</AttrName>
              <AttrID>30001</AttrID>
              <AttrValue>John</AttrValue>
            </Attr>
            <Attr>
              <AttrDesc>Enrollee&apos;s Middle Initial</AttrDesc>
              <AttrName>ENROLLEE_MIDDLE_INIT</AttrName>
              <AttrID>30002</AttrID>
              <AttrValue>J</AttrValue>
            </Attr>
            <Attr>
              <AttrDesc>Enrollee&apos;s Last Name</AttrDesc>
              <AttrName>ENROLLEE_LAST_NAME</AttrName>
              <AttrID>30003</AttrID>
              <AttrValue>Doe</AttrValue>
            </Attr>
            <Attr>
              <AttrDesc>Enrollee&apos;s Work Phone Number</AttrDesc>
              <AttrName>ENROLLEE_WORK_PHONE</AttrName>
              <AttrID>30004</AttrID>
              <AttrValue>(555) 123-1234</AttrValue>
            </Attr>
            <Attr>
              <AttrDesc>Enrollee Fax Number</AttrDesc>
              <AttrName>ENROLLEE_FAX</AttrName>
              <AttrID>30005</AttrID>
              <AttrValue>(555) 123-1235</AttrValue>
            </Attr>
            <Attr>
              <AttrDesc>Enrollee&apos;s Work Extension</AttrDesc>
              <AttrName>ENROLLEE_EXT</AttrName>
              <AttrID>30006</AttrID>
              <AttrValue>1234567</AttrValue>
            </Attr>
            <Attr>
              <AttrDesc>Enrollee&apos;s Email</AttrDesc>
              <AttrName>ENROLLEE_EMAIL</AttrName>
              <AttrID>30007</AttrID>
              <AttrValue>[email protected]</AttrValue>
            </Attr>
            <Attr>
              <AttrDesc>Enrollee&apos;s Mailing Address #1</AttrDesc>
              <AttrName>ENROLLEE_MAIL_ADDR_1</AttrName>
              <AttrID>30008</AttrID>
              <AttrValue>10 Maple Street</AttrValue>
            </Attr>
            <Attr>
              <AttrDesc>Enrollee&apos;s Mailing Address #2</AttrDesc>
              <AttrName>ENROLLEE_MAIL_ADDR_2</AttrName>
              <AttrID>30009</AttrID>
              <AttrValue>.</AttrValue>
            </Attr>
            <Attr>
              <AttrDesc>Enrollee&apos;s State</AttrDesc>
              <AttrName>ENROLLEE_STATE</AttrName>
              <AttrID>30011</AttrID>
              <AttrValue>MA</AttrValue>
            </Attr>
            <Attr>
              <AttrDesc>Enrollee&apos;s Zip</AttrDesc>
              <AttrName>ENROLLEE_ZIP</AttrName>
              <AttrID>30012</AttrID>
              <AttrValue>02668</AttrValue>
            </Attr>
            <Attr>
              <AttrDesc>Enrollee&apos;s User Name</AttrDesc>
              <AttrName>ENROLLEE_USER_NAME</AttrName>
              <AttrID>30013</AttrID>
              <AttrValue>jdoe</AttrValue>
            </Attr>
          </Attributes>
        </Section>
        <Section>
          <SectionID>6800</SectionID>
          <SectionName>Company Information</SectionName>
          <Attributes>
            <Attr>
              <AttrDesc>Company&apos;s DB #</AttrDesc>
              <AttrName>DBNUM</AttrName>
              <AttrID>30014</AttrID>
              <AttrValue>123456789</AttrValue>
            </Attr>
            <Attr>
              <AttrDesc>Company Name</AttrDesc>
              <AttrID>30015</AttrID>
              <AttrValue>My Company</AttrValue>
            </Attr>
            <Attr>
              <AttrDesc>Company Adress #1</AttrDesc>
              <AttrID>30016</AttrID>
              <AttrValue>50 Main Street</AttrValue>
            </Attr>
            <Attr>
              <AttrDesc>Company Adress #2</AttrDesc>
              <AttrID>30017</AttrID>
              <AttrValue>.</AttrValue>
            </Attr>
            <Attr>
              <AttrDesc>Company City</AttrDesc>
              <AttrID>30018</AttrID>
              <AttrValue>Marstons Mills</AttrValue>
            </Attr>
            <Attr>
              <AttrDesc>Company State</AttrDesc>
              <AttrID>30019</AttrID>
              <AttrValue>MA</AttrValue>
            </Attr>
            <Attr>
              <AttrDesc>Company Zip</AttrDesc>
              <AttrID>30020</AttrID>
              <AttrValue>02648</AttrValue>
            </Attr>
            <Attr>
              <AttrDesc>Company Phone</AttrDesc>
              <AttrID>30021</AttrID>
              <AttrValue>(555) 123-1236</AttrValue>
            </Attr>
          </Attributes>
        </Section>
        <Section>
          <SectionID>6850</SectionID>
          <SectionName>Points of Contact</SectionName>
          <Attributes/>
        </Section>
        <Section>
          <SectionID>6900</SectionID>
          <SectionName>Enrollment Verification</SectionName>
          <Attributes/>
        </Section>
        <Section>
          <SectionID>6950</SectionID>
          <SectionName>Enrollment Confirmation</SectionName>
          <Attributes/>
        </Section>
      </Sections>
    </System>

  • Problem with decode function while dispaly the data ( urgent )

    Hi friends ,
    I want the output like this.
    sample:
    CLIENT CODE: 00027
    PLAN CODE: 01
    SSN Last Name First Name TYPE Frequency Amount
    123-45-6036 Perrault Julia D M 250.00
    123-45-6036 Perrault Julia D Q 400.00
    CLIENT CODE: 00027
    PLAN CODE: 02
    SSN Last Name First Name TYPE Frequency Amount
    123-45-6036 Perrault Julia D S 1000.00
    123-45-7042 Testaverde Alexander D B 50.00
    this is my query:
    SELECT distinct pln.plan_code,
    ind.ssn,
    ind.last_name,
    ind.first_name,
    pln.clt_client_id,
    DECODE(rp.account_code,'AMNT',rp.userid,NULL) amount,
    DECODE(rp.account_code,'FREQ',rp.userid,NULL) frequence,
    DECODE(rp.account_code,'TYPE',rp.userid,NULL) type
    FROM rp_extract_recon rp,
    plan pln,
    indicative ind
    where ind.indicative_id in ( select distinct
    rp1.ind_indicative_id
    from rp_extract_recon rp1
    where rp1.rp_extract_recon_id =
    rp.rp_extract_recon_id )
    and ind.clt_client_id = pln.clt_client_id
    and pln.plan_id = rp.pln_plan_id
    and rp.bat_batch_info_id = 14078
    and rp.rp_report_type_code = 'TEST'
    output for above query:
    PLAN_C SSN LAST_NAME FIRST_NAME CLT_C AMOUNT
    FREQUENCE TYPE
    01 123456036 Perrault Julia 00027 250.00
    01 123456036 Perrault Julia 00027 400.00
    01 123456036 Perrault Julia 00027 M
    01 123456036 Perrault Julia 00027 Q
    01 123456036 Perrault Julia
    00027 D
    02 123456036 Perrault Julia 00027 1000.00
    02 123456036 Perrault Julia 00027 S
    02 123456036 Perrault Julia
    00027 D
    02 123457042 Testaverde Alexander 00027 50.00
    02 123457042 Testaverde Alexander 00027 B
    02 123457042 Testaverde Alexander
    00027 D
    11 rows selected.
    11 rows selected.
    how can i get the above ouput .
    i want the type,frequency,amount values in one line.
    thanks for u r kind help
    srini

    Hi Srini,
    Add Max in the begining and group by at the end of statement.
    Please let me know in both cases if it works or not.
    thanks
    for example
    SELECT distinct pln.plan_code,
    ind.ssn,
    ind.last_name,
    ind.first_name,
    pln.clt_client_id,
    MAX(DECODE(rp.account_code,'AMNT',rp.userid,NULL) amount,
    DECODE(rp.account_code,'FREQ',rp.userid,NULL) frequence,
    DECODE(rp.account_code,'TYPE',rp.userid,NULL) type )
    FROM rp_extract_recon rp,
    plan pln,
    indicative ind
    where ind.indicative_id in ( select distinct
    rp1.ind_indicative_id
    from rp_extract_recon rp1
    where rp1.rp_extract_recon_id =
    rp.rp_extract_recon_id )
    and ind.clt_client_id = pln.clt_client_id
    and pln.plan_id = rp.pln_plan_id
    and rp.bat_batch_info_id = 14078
    and rp.rp_report_type_code = 'TEST'
    GROUP BY
    pln.plan_code,
    ind.ssn,
    ind.last_name,
    ind.first_name,
    pln.clt_client_id,

  • Custom report table and field mapping

    Hi Experts,
    i am writing a functional spec for the custom report to be developed by developers and need to know the table and field name for the following items:
    Employee Number
    Name
    Original Hire date
    Adjusted Hire date
    Salary Class
    Rate of Pay
    Emp. Status
    Classification
    Acounting Unit
    Activity (WBS)
    Accrual Beginning Balance (Hours)
    Accrual Beginning Balance (Dollars)
    Accrued (Hours)
    Accrued (Dollars)
    Used (Hours)
    Used (Dollars)
    Other / Manual Adjustments (+/-) (Hours)
    Other / Manual Adjustments (+/-) (Dollars)
    Other / Manual Adjustments Description
    Accrual Ending Balance (Hours)
    Accrual Ending Balance (Dollars)
    Vested Status
    PlanCode
    PlanDescription
    Thanks,
    Lisa

    I can give you a 30,000 foot answer, but to get down to ground level I would have to know your system.  There is way to much missing information in your request to give you a definite answer.
    Employee Number - if you are using LDB PNP/PNPCE to run your report then it is the field PERNR-PERNR.
    Name - IT/PA0002-NACHN -Last Name, IT/PA0002-VORNA-First Name.IT/PA002-MIDNM-Middle Name. Depending on your system configuration these fields are also stored on IT/AP0001-SNAME (Last Name-FirstName) or ENAME(First Name, Middle Name, Last Name)
    Original Hire Date-IT/PA0041-This stores multiple date types with a specific code to identify what each one is.  You will need to know the code for OHD.
    Adjusted Hire Date - same as above
    Salary Class- not sure what you are talking about, but salary information is stored on IT/PA008
    Empl Status - IT/PA000-Stat2
    Classification-not sure what field you are talking about, but IT/PA0001 is where this type of information is stored
    Accounting Unit-same as above
    Activity(WBS)- now you are getting complicated. This is stored in Cost Distribution  HRT1019-POSNR, but you have to know how to connect the dots to get there.
    Accrual Beginning Balance(Hours)-I would go to the ABWKONTI table in the Time Cluster for this fields ANZHL & KVERB
    Accrual Beginning Balance(Dollars) - this will probably have to be computed
    Used(Hours)-You can either compute this balance by computing the difference between the Beginning/Ending balances or read back through the appropriate Time Cluster Tables or total IT/PA2001 and IT/PA2013.
    Used(dollars) will probably have to be computed
    Other/Manual Adjustments(Hours) - not sure but you may be looking at IT/PA2013
    Other/Manual Adjustments(Dollars)- will have to be computed
    Accrual Ending Balance(Hours)-I would go to the ABWKONTI table in the Time Cluster for this fields ANZHL & KVERB
    Accrual Ending Balance(Dollars) - this will probably have to be computed
    Vested Status - I have no idea
    Plan Code-Plan Code for what(Health Ins, Life Ins, Retirement Plans, Flexible Spending?)
    Plan/Description-see above

  • OO Interactive ALV Problem

    I have an OO ALV program that allows the User to change fields in the display and then it will update a data base when they click on the SAVE button.  I need to have an edit to check two fields both of which have the value 'X' or ' '.  I need to edit them when a change occurs to check that if one field is 'X' the other must not be 'X' and produce an error message when it occurs.  I'm stumped on how to do this.  I tried going back to the table when field A is changed and getting field B and doing the check, but that won't work because they may have changed field B and while it was X it may now be ' '.  The best place to check it would be down where I get ready to save it, but I don't know how to set the error indicator on the row/column and produce the message identifying all the rows in error at that point.

    Here is the first half of the program that shows the Methods I'm using and what I've tried to do.  Maybe that will help make things clearer.
    program  ZPAPAI0022_UPDT_MERIT_ELIG_ONG
    MESSAGE-ID ZF.
    *Original program data fields copied from ZFIFMR0020_CF_FIXED
            TABLES, ITABS AND STRUCTURES
    TABLES:  ZHCM_MERIT_ELIG, "Merit Increase Eligibility Table
             PA0001,
             SSCRFIELDS.     "Screen fields
    **Define the structure to hold the header for a journal
    TYPES:  BEGIN OF I_MERIT,
             PERNR        LIKE P0001-PERNR,
             GSBER        LIKE P0001-GSBER,
             WERKS        LIKE P0001-WERKS,
             SNAME        LIKE P0001-SNAME,
             BEGDA        LIKE P0001-BEGDA,
             CPLAN        LIKE T71CA-CPLAN,
             ELIGIBLE     LIKE ZHCM_MERIT_ELIG-ELIGIBLE,
             NOT_ELIGIBLE LIKE ZHCM_MERIT_ELIG-NOT_ELIGIBLE,
             EMPCT        LIKE ZHCM_MERIT_ELIG-EMPCT,
             STATUS       LIKE ZHCM_MERIT_ELIG-STATUS,
             CELLTAB      type LVC_T_STYL,
           END OF I_MERIT.
    TYPES:  BEGIN OF T_MERIT_OUT_ALV,
             PERNR        LIKE P0001-PERNR,
             GSBER        LIKE P0001-GSBER,
             WERKS        LIKE P0001-WERKS,
             SNAME        LIKE P0001-SNAME,
             BEGDA        LIKE P0001-BEGDA,
             CPLAN        LIKE T71CA-CPLAN,
             ELIGIBLE     LIKE ZHCM_MERIT_ELIG-ELIGIBLE,
             NOT_ELIGIBLE LIKE ZHCM_MERIT_ELIG-NOT_ELIGIBLE,
             EMPCT        LIKE ZHCM_MERIT_ELIG-EMPCT,
             STATUS       LIKE ZHCM_MERIT_ELIG-STATUS,
             CELLTAB      type LVC_T_STYL,
            END OF T_MERIT_OUT_ALV.
    DATA:
      I_ALV_MERIT TYPE STANDARD TABLE
          OF T_MERIT_OUT_ALV
          WITH HEADER LINE.
    types: begin of ty_merit_change,
          PERNR         LIKE ZHCM_MERIT_ELIG-PERNR,    "Personnel Number
          GSBER         LIKE ZHCM_MERIT_ELIG-GSBER,    "Business Area
          WERKS         LIKE ZHCM_MERIT_ELIG-WERKS,    "Personnel Area
          CPLAN         LIKE ZHCM_MERIT_ELIG-CPLAN,    "Merit Elig Code
          BEGDA         like ZHCM_MERIT_ELIG-BEGDA,    "Effective Date
          ELIGIBLE      LIKE ZHCM_MERIT_ELIG-ELIGIBLE, "Elgibility Indicator
          NOT_ELIGIBLE  LIKE ZHCM_MERIT_ELIG-NOT_ELIGIBLE,
          EMPCT         LIKE ZHCM_MERIT_ELIG-EMPCT,
          STATUS        LIKE ZHCM_MERIT_ELIG-STATUS,
          end of ty_merit_change.
    DATA: I_MERIT_CHANGE TYPE HASHED TABLE
          OF ty_merit_change
          WITH UNIQUE KEY PERNR GSBER WERKS
          WITH HEADER LINE.
    DATA: ZTIME(6) TYPE C,
          ITAB_EXPORT(10) TYPE C,
          ZDATA_CHNGED    TYPE C VALUE 'N',
          REPLY           TYPE C,
          WS_LINE_CNT TYPE I.
    DATA: BEGIN OF WS,
            REC_CNT(10) TYPE P,            "Processed records
            CANCELLED(1)  TYPE C,          "file read cancelled
            COMMAND_LINE  LIKE RLGRAP-FILENAME,
            FILENAME      LIKE RLGRAP-FILENAME,
            FILETYPE      LIKE RLGRAP-FILETYPE,
            FILELGTH(40)  TYPE C,
            MAPPE LIKE APQI-GROUPID,                     "jc01182007
            SUM           LIKE BPBY-WLJHR,
            NUMBERS(10)   TYPE C VALUE '0123456789',
            DATETIME(16)  TYPE C,
            E(1)          TYPE C VALUE 'E', "LANGUAGE CODE
            COUNT         TYPE I,           "COUNT FOR FILE HEADER
            DTF(60)       TYPE C,
            DIRFILE(60)   TYPE C,
            NO_RECORDS(1) TYPE C,
            ARK(3)        TYPE C VALUE 'ARK',
            ONE           TYPE C VALUE '1',
            COLON(1)      TYPE C VALUE ':',
            MARK(1)       TYPE C VALUE 'X',
            FYR(4)        TYPE C,
            FILERR(1)     VALUE 'N',
            BUDREL(1)     VALUE 'Y',
            DATE LIKE SY-DATUM,
            date_cur(10),                            "jc01182007
            date_new(10),                            "jc01182007
            date_out type sy-datum,                  "jc01182007
            TIME LIKE SY-UZEIT,
            DOCTYPE LIKE BKPF-BLART,
            LINES TYPE I,
            rfipex like zfmcfblock-fipex,
       END OF WS.
    *SYS_HDR constains the system ID and the client
    DATA:  BEGIN OF SYS_HDR,
              SYS    LIKE SY-SYSID,
              FIL(1) TYPE C VALUE '/',
              CLT LIKE SY-MANDT,
           END OF SYS_HDR.
    *Contains the report name and the user id.
    DATA:  BEGIN OF RPT_AND_USER,
              RPT    LIKE SY-REPID,
              FIL(1) TYPE C VALUE '/',
              USR    LIKE SY-UNAME,
           END OF RPT_AND_USER.
    *Object oriented data fields
    data: ok_code like sy-ucomm,
          save_ok like sy-ucomm,
          g_container type scrfname value 'BCALV_GRID_DEMO_0100_CONT1',
          g_grid  type ref to cl_gui_alv_grid,
          g_custom_container type ref to cl_gui_custom_container,
          gt_fieldcat type lvc_t_fcat,
          gs_layout type lvc_s_layo.
    local class to handle semantic checks
    class lcl_event_receiver definition deferred.
    data: g_event_receiver type ref to lcl_event_receiver.
    types: begin of ty_mod_cells,
          row_id like lvc_s_modi-row_id,
          PERNR         LIKE ZHCM_MERIT_ELIG-PERNR,        "Personnel Number
          GSBER         LIKE ZHCM_MERIT_ELIG-GSBER,        "Business area
          WERKS         LIKE ZHCM_MERIT_ELIG-WERKS,        "Personnel Area
          ELIGIBLE      LIKE ZHCM_MERIT_ELIG-ELIGIBLE,     "Eligible Flag
          NOT_ELIGIBLE  LIKE ZHCM_MERIT_ELIG-NOT_ELIGIBLE, "Not Eligible
          end of ty_mod_cells.
    data: it_mod_cells type standard table of ty_mod_cells
          with header line.
    data: zit_mod_cells type standard table of ty_mod_cells
          with header line.
    data: it_hold_mod_cells type standard table of ty_mod_cells
          with header line.
    START OF COMMENT ************
    LOCAL CLASS Definition
    **§4.Define and implement event handler to handle event DATA_CHANGED.
    class lcl_event_receiver definition.
      public section.
        methods:
          handle_data_changed
             for event data_changed of cl_gui_alv_grid
                 importing er_data_changed,
          handle_top_of_page
            for event print_top_of_page of cl_gui_alv_grid.
      private section.
    This flag is set if any error occured in one of the
    following methods:
        data: error_in_data type c.
        data: ls_good type lvc_s_modi.
        data: s_mod_cells type ty_mod_cells.
    Methods to modularize event handler method HANDLE_DATA_CHANGED:
    This is a suggestion how you could comment your checks in each
    *method:
    CHECK: fieldname(old/new value) !<comp> fieldname(old/new value)
    IF NOT: (What to tell the user is wrong about the input)
    Remarks:
    fieldname:       fieldname of table for the corresponding column
    (old/new value): ckeck with value of GT_OUTTAB or MT_GOOD_CELLS.
    !<comp>        : the value is valid if the condition <comp> holds.
        methods: check_cplan
             importing
                ps_good_cplan type lvc_s_modi
                pr_data_changed type ref to cl_alv_changed_data_protocol.
        methods: check_eligible
             importing
                ps_good_eligible type lvc_s_modi
                pr_data_changed type ref to cl_alv_changed_data_protocol.
        methods: check_not_eligible
             importing
                ps_good_not_eligible type lvc_s_modi
                pr_data_changed type ref to cl_alv_changed_data_protocol.
        methods: check_begda
             importing
                ps_good_begda type lvc_s_modi
                pr_data_changed type ref to cl_alv_changed_data_protocol.
    endclass.                    "lcl_event_receiver DEFINITION
    class lcl_event_receiver implementation.
      method handle_data_changed.
        error_in_data = space.
        clear i_merit_change.
        refresh i_merit_change.
    semantic checks
    Identify columns which were changed and check input
    against output table gt_outtab or other new input values of one row.
    Table er_data_changed->mt_good_cells holds all cells that
    are valid according to checks against their DDIC data.
    No matter in which order the input was made this table is
    ordered by rows (row_id). For each row, the entries are
    sorted by columns according to their order in the fieldcatalog
    (not the defined order using field COL_POS but the order
    given by the position of the record in the fieldcatalog).
    The order is relevant if new inputs in several columns of
    the same row are dependent.
    **§5.Loop over table MT_GOOD_CELLS to check all values that are
      valid due to checks according to information of the DDIC.
        data: ls_merit_change type ty_merit_change.
        refresh i_merit_change.
        loop at er_data_changed->mt_good_cells into ls_good.
          case ls_good-fieldname.
    check if column CPLAN of this row was changed
            when 'CPLAN'.
              call method check_cplan
                EXPORTING
                  ps_good_cplan = ls_good
                  pr_data_changed   = er_data_changed.
             when 'ELIGIBLE'.
              call method check_eligible
                EXPORTING
                  ps_good_eligible = ls_good
                  pr_data_changed   = er_data_changed.
             when 'NOT_ELIGIBLE'.
              call method check_not_eligible
                EXPORTING
                  ps_good_not_eligible = ls_good
                  pr_data_changed      = er_data_changed.
             when 'BEGDA'.
              call method check_begda
                EXPORTING
                  ps_good_begda = ls_good
                  pr_data_changed   = er_data_changed.
          endcase.
        endloop.
    **§7.Display application log if an error has occured.
        if error_in_data eq 'X'.
          call method er_data_changed->display_protocol.
          refresh it_mod_cells.
        else.
          append lines of it_mod_cells to it_hold_mod_cells.
        endif.
      endmethod.                    "handle_data_changed
      method handle_top_of_page.
        write: /,'Event: PRINT_TOP_OF_PAGE'(001).
      endmethod.                    "handle_top_of_page
      method check_cplan.
    Overview of checks according to field CPLAN
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        data: l_cplan type CMP_PLAN.
        data s_alv type t_merit_out_alv.
        data: s_merit_change type ty_merit_change.
    Get new cell value to check it.
        call method pr_data_changed->get_cell_value
          EXPORTING
            i_row_id    = ps_good_cplan-row_id
            i_fieldname = ps_good_cplan-fieldname
          IMPORTING
            e_value     = l_cplan.
    In case of error, create a protocol entry in the application log.
    Possible values for message type ('i_msgty'):
        if L_cplan = 'MERE' OR
           L_cplan = 'MERA' OR
           L_cplan = 'MERS' OR
           L_cplan = 'MERU' OR
           L_cplan = 'NOEV'.
        ELSE.
          call method pr_data_changed->add_protocol_entry
            EXPORTING
              i_msgid     = 'ZF'
              i_msgno     = '095'
              i_msgty     = 'E'
              i_msgv1     = 'Invalid Plan Code'
              i_fieldname = ps_good_cplan-fieldname
              i_row_id    = ps_good_cplan-row_id.
          error_in_data = 'X'.
          exit.
        endif.
        modify table i_merit_change from s_merit_change.
        clear s_mod_cells.
        s_mod_cells-row_id = ls_good-row_id.
        s_mod_cells-pernr = s_alv-pernr.
        s_mod_cells-gsber = s_alv-gsber.
        s_mod_cells-werks = s_alv-werks.
        s_mod_cells-pernr = s_alv-pernr.
        ZDATA_CHNGED = 'Y'.
        append s_mod_cells to it_mod_cells.
      endmethod.                    "check_cplan
      method check_ELIGIBLE.
    Overview of checks according to field CPLAN
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        data: l_ELIGIBLE type CMP_CELIG.
        data s_alv type t_merit_out_alv.
        data s_alv2 type t_merit_out_alv.
        data: s_merit_change type ty_merit_change.
        data: znot_eligible like zhcm_merit_elig-not_eligible.
    Get new cell value to check it.
        call method pr_data_changed->get_cell_value
          EXPORTING
            i_row_id    = ps_good_eligible-row_id
            i_fieldname = ps_good_eligible-fieldname
          IMPORTING
            e_value     = l_eligible.
        READ TABLE IT_MOD_CELLS INDEX ps_good_eligible-row_id
                                              into zit_mod_cells.
        IF SY-SUBRC = 0.
           MOVE ZIT_MOD_CELLS-NOT_ELIGIBLE TO ZNOT_ELIGIBLE.
        ELSE.
           READ TABLE I_ALV_MERIT INDEX ps_good_eligible-row_id
                                             into s_alv.
           IF SY-SUBRC = 0.
               MOVE S_ALV-NOT_ELIGIBLE TO ZNOT_ELIGIBLE.
           ENDIF.
        ENDIF.
       IF L_ELIGIBLE = 'X' AND
          ZNOT_ELIGIBLE = 'X'.
         call method pr_data_changed->add_protocol_entry
           EXPORTING
             i_msgid     = 'ZF'
             i_msgno     = '095'
             i_msgty     = 'E'
             i_msgv1     = 'ELIGIBLE & NOT ELIGIBLE BOTH = X'
             i_fieldname = ps_good_eligible-fieldname
             i_row_id    = ps_good_eligible-row_id.
         error_in_data = 'X'.
         exit.
       endif.
        READ TABLE I_ALV_MERIT INDEX ps_good_eligible-row_id into s_alv.
        clear s_mod_cells.
        s_mod_cells-row_id = ls_good-row_id.
        s_mod_cells-pernr = s_alv-pernr.
        s_mod_cells-gsber = s_alv-gsber.
        s_mod_cells-werks = s_alv-werks.
        s_mod_cells-pernr = s_alv-pernr.
        s_mod_cells-eligible = l_eligible.
        s_mod_cells-not_eligible = s_alv-not_eligible.
        ZDATA_CHNGED = 'Y'.
        append s_mod_cells to it_mod_cells.
      endmethod.                    "check_eligible
      method check_NOT_ELIGIBLE.
    Overview of checks according to field NOT_ELIGIBLE
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        data: l_NOT_ELIGIBLE type CMP_CELIG.
        data s_alv type t_merit_out_alv.
        data s_alv2 type t_merit_out_alv.
        data: s_merit_change type ty_merit_change.
        data: ZELIGIBLE LIKE ZHCM_MERIT_ELIG-ELIGIBLE.
    Get new cell value to check it.
        call method pr_data_changed->get_cell_value
          EXPORTING
            i_row_id    = ps_good_not_eligible-row_id
            i_fieldname = ps_good_not_eligible-fieldname
          IMPORTING
            e_value     = l_not_eligible.
        READ TABLE IT_MOD_CELLS INDEX ps_good_not_eligible-row_id
                                              into zit_mod_cells.
        IF SY-SUBRC = 0.
           MOVE ZIT_MOD_CELLS-ELIGIBLE TO ZELIGIBLE.
        ELSE.
           READ TABLE I_ALV_MERIT INDEX ps_good_not_eligible-row_id
                                             into s_alv.
           IF SY-SUBRC = 0.
               MOVE S_ALV-ELIGIBLE TO ZELIGIBLE.
           ENDIF.
        ENDIF.
        IF L_NOT_ELIGIBLE = 'X' AND
           ZELIGIBLE = 'X'.
          call method pr_data_changed->add_protocol_entry
            EXPORTING
              i_msgid     = 'ZF'
              i_msgno     = '095'
              i_msgty     = 'E'
              i_msgv1     = 'ELIGIBLE & NOT ELIGIBLE BOTH = X'
              i_fieldname = ps_good_not_eligible-fieldname
              i_row_id    = ps_good_not_eligible-row_id.
          error_in_data = 'X'.
          exit.
        endif.
      READ TABLE I_ALV_MERIT INDEX ps_good_not_eligible-row_id
               into s_alv.
       IF SY-SUBRC = 0.
          S_MERIT_CHANGE = S_ALV.
          S_ALV-NOT_ELIGIBLE = L_NOT_ELIGIBLE.
          modify table i_merit_change from s_merit_change.
       ENDIF.
        READ TABLE I_ALV_MERIT INDEX ps_good_not_eligible-row_id
                           into s_alv.
        clear s_mod_cells.
        s_mod_cells-row_id = ls_good-row_id.
        s_mod_cells-pernr = s_alv-pernr.
        s_mod_cells-gsber = s_alv-gsber.
        s_mod_cells-werks = s_alv-werks.
        s_mod_cells-pernr = s_alv-pernr.
        s_mod_cells-eligible = zit_mod_cells-eligible.
        s_mod_cells-not_eligible = L_not_eligible.
        ZDATA_CHNGED = 'Y'.
        append s_mod_cells to it_mod_cells.
      endmethod.                    "check_not_eligible

  • How to determine PLTYP from BPLAN

    How can I determine a plan's type (PLTYP) given it's plan code (BPLAN)?  Is there a lookup table for this?

    For that you might have to look at View U_17170.
    a

  • solved need help in tuning this Query

    hi frs,
    i have created a query like this
    pls help
    Regards
    Rajesh
    Message was edited by:
    Rajesh.mani
    Message was edited by:
    Rajesh.mani

    Code and explain plan should be between [pre] and [/pre] or [code] and [/code] tags like this.
    [pre]Code[/pre]An now explain plan
    [code]Execution plan
    [/code]
    Cheers
    Sarma.

Maybe you are looking for

  • Videos no longer playback after upgrade to itunes 7

    Yesterday I upgraded to itunes V.7. Now none of my videos or video podcasts play. I Also upgraded my Ipod and none of the videos show up. The error messege when connecting my ipod is as follows "The video format is not supported on this ipod" All my

  • [SOLVED] PHP script returning a 255 errorcode

    Hello, I have a rather strange problem at hand currently.  I am using the stock binary PHP supplied in the repositories with sqlite3, pdo ,pdo-sqlite, and soap modules enabled.  Whenever I try to run a PHP script, however, no output is returned to ST

  • Swing is not displaying urdu

    hi, i am developing an application in Swing, i am setting URDU(Pakistan national language) with the help of setText() method in Netbeans 6.0 IDE, when i see preview it dispaly urdu correctly,But when i run application it display ?????????? this. any

  • Service PO Delivery complete indicator

    Hello Experts, I am new in SAP MM. I have one doubt regarding service po. If I have done total service entry sheet those service po qty have, then how i will recognize that Service PO againest service has been completly done.There is no any delivery

  • Photomerge Scene Cleaner in PS CS4

    Is there a way to get at the Photomerge Scene Cleaner functionality that is in Photoshop Elements via full Photoshop CS4? I can't figure it out, and it's exactly what I need for this set of images I'm working with. Thanks.