PLSQL script not collecting temp table fields - variables problem?

I've 'written' a script to extract data from a temp table and load it directly into the associated Oracle tables via HRMS's
API packages.. but when I put the DBMS_OUTPUT.PUT_LINE's in I see that although it seems to read first API OK it doesn't collect the information from their relevant fields in the temp table.. Can anyone help please please..?
======================== code ==========================
SET serveroutput ON SIZE 1000000
SET verify OFF
SET feedback OFF
DECLARE
-- Debugging/error handling
v_err_seq NUMBER := 0;
v_err_num VARCHAR2 (30);
v_err_msg VARCHAR2 (250);
v_err_line VARCHAR2 (350);
-- Work variables
p_hire_date DATE;
p_business_group_id NUMBER := 0;
p_person_id NUMBER := 0;
p_address_line1 VARCHAR2 (240);
p_date_of_birth VARCHAR2 (35);
p_address_line2 VARCHAR2 (240);
employee_number VARCHAR2 (14);
p_employee_number VARCHAR2 (14);
emp_number VARCHAR2 (14);
p_email_address VARCHAR2 (240);
p_address_line3 VARCHAR2 (240);
p_first_name VARCHAR2 (150);
p_address_line4 VARCHAR2 (240);
p_middle_names VARCHAR2 (30);
p_post_code VARCHAR2 (30);
p_last_name VARCHAR2 (150);
p_nationality VARCHAR2 (30);
p_sex VARCHAR2 (30);
p_national_identifier VARCHAR2 (30);
p_title VARCHAR2 (30);
v_rec_cnt NUMBER := 0;
insert_flag VARCHAR2 (8);
-- ip_p_address_id NUMBER;
ip_p_address_id per_addresses.address_id%TYPE;
ip_p_object_version_number NUMBER;
ip_p_party_id per_addresses.party_id%TYPE;
l_person_id per_all_people_f.person_id%TYPE;
l_employee_number VARCHAR2 (35);
l_validate BOOLEAN DEFAULT FALSE;
l_assignment_id NUMBER;
l_per_object_version_number NUMBER;
l_asg_object_version_number NUMBER;
l_per_effective_start_date DATE;
l_per_effective_end_date DATE;
l_full_name VARCHAR2 (240);
l_per_comment_id NUMBER;
l_assignment_sequence NUMBER;
l_assignment_number VARCHAR2 (100);
l_name_combination_warning BOOLEAN;
l_assign_payroll_warning BOOLEAN;
l_address_id NUMBER;
l_object_version_number NUMBER;
return_code NUMBER;
return_message VARCHAR2 (2000);
command_prin VARCHAR2 (4000);
-- Get employee details info from work table
CURSOR get_employee_details
IS
SELECT p_person_id, p_validate, p_hire_date, p_business_group_id,
p_last_name, p_sex, p_date_of_birth, p_email_address,
p_employee_number, p_first_name, p_marital_status,
p_middle_names, p_nationality, p_title, p_national_identifier,
p_address_line1, p_address_line2, p_address_line3,
p_address_line4, p_post_code
FROM SU_TEMPLOYEE_DETAILS;
-- checks employee details info from PER_ALL_PEOPLE_F table
-- v_err_seq := 1;
CURSOR c_check_employee (emp_number VARCHAR2)
IS
SELECT per.person_id, per.business_group_id, per.last_name,
per.start_date, per.date_of_birth, per.email_address,
per.employee_number, per.first_name, per.marital_status,
per.middle_names, per.nationality, per.national_identifier,
per.sex, per.title, padd.address_id, padd.primary_flag,
padd.address_line1, padd.address_line2, padd.address_line3,
padd.town_or_city, padd.postal_code, padd.telephone_number_1,
padd.object_version_number
FROM per_all_people_f per, per_addresses padd
WHERE per.employee_number = emp_number
AND per.person_id = padd.person_id;
emp_rec c_check_employee%ROWTYPE;
BEGIN
--v_err_seq := 2;
command_prin := SQLERRM;
LOOP
-- Process each record in the work table
FOR v_emp IN get_employee_details
LOOP
v_rec_cnt := v_rec_cnt + 1;
-- determine whether customer already exists
OPEN c_check_employee (v_emp.p_employee_number);
FETCH c_check_employee
INTO emp_rec;
IF c_check_employee%NOTFOUND
THEN
insert_flag := 'I';
ELSE
insert_flag := 'X';
END IF;
IF insert_flag = 'I'
THEN
-- RETURN 'Employee does not exist, continue import..';
DBMS_OUTPUT.PUT_LINE ('Employee does not exist, continue import..');
ELSE
DBMS_OUTPUT.PUT_LINE ('Employee found - record cannot be imported.');
END IF;
CLOSE c_check_employee;
-- v_err_seq := 3;
-- Create new PER_ALL_PEOPLE_F and PER_ADDRESSES record from
-- info in table record
IF insert_flag = 'I'
THEN
BEGIN -- Importing Employee Procedure --
DBMS_OUTPUT.PUT_LINE ('          ');
DBMS_OUTPUT.PUT_LINE ('Importing employees....Hold On.......!     ');
     DBMS_OUTPUT.PUT_LINE ('          ');
BEGIN
Hr_Employee_Api.create_gb_employee
(p_validate => l_validate, --FALSE,
p_hire_date => p_hire_date,
p_business_group_id => p_business_group_id,
p_date_of_birth => p_date_of_birth,
p_email_address => p_email_address,
p_first_name => p_first_name,
p_middle_names => p_middle_names,
p_last_name => p_last_name,
p_sex => p_sex,
p_ni_number => p_national_identifier,
p_employee_number => l_employee_number,
p_person_id => l_person_id,
p_title => p_title,
p_assignment_id => l_assignment_id,
p_per_object_version_number => l_per_object_version_number,
p_asg_object_version_number => l_asg_object_version_number,
p_per_effective_start_date => l_per_effective_start_date,
p_per_effective_end_date => l_per_effective_end_date,
p_full_name => l_full_name,
p_per_comment_id => l_per_comment_id,
p_assignment_sequence => l_assignment_sequence,
p_assignment_number => l_assignment_number,
p_name_combination_warning => l_name_combination_warning,
p_assign_payroll_warning => l_assign_payroll_warning
DBMS_OUTPUT.PUT_LINE
('..employee record updated succesfully..');
DBMS_OUTPUT.PUT_LINE ('          ');
DBMS_OUTPUT.PUT_LINE ('          ');
EXCEPTION
WHEN OTHERS
THEN
DBMS_OUTPUT.PUT_LINE ('..SQLCodeErrors:- ' || SQLCODE);
     DBMS_OUTPUT.PUT_LINE (' ');
DBMS_OUTPUT.PUT_LINE ('Person ID:-' || p_person_id || l_person_id);
DBMS_OUTPUT.PUT_LINE ('Assignmnt Seq - '|| l_assignment_sequence);
DBMS_OUTPUT.PUT_LINE ('l_ass_no - ' ||l_assignment_number);
-- DBMS_OUTPUT.PUT_LINE ('Record failed to load.. ' || SQLERRM);
DBMS_OUTPUT.PUT_LINE (SUBSTR (command_prin, 1, 250));
END;
BEGIN -- Importing Associated Address Procedure --
DBMS_OUTPUT.PUT_LINE ('          ');
-- ('..and the associated employee address....');
Hr_Person_Address_Api.create_person_address
(p_validate => l_validate,
-- p_effective_date => p_hire_date,
p_effective_date => SYSDATE,
p_pradd_ovlapval_override => NULL,
p_validate_county => NULL,
p_person_id => l_person_id,
p_primary_flag => 'Y',
p_style => 'GB_GLB',
-- p_date_from => p_hire_date,
p_date_from => SYSDATE,
p_date_to => NULL,
p_address_type => NULL,
p_comments => NULL,
p_address_line1 => p_address_line1,
p_address_line2 => p_address_line2,
p_address_line3 => p_address_line3,
p_town_or_city => p_address_line4,
p_region_1 => NULL,
p_region_2 => NULL,
p_region_3 => NULL,
p_postal_code => p_post_code,
p_country => p_nationality,
p_telephone_number_1 => NULL,
p_telephone_number_2 => NULL,
p_telephone_number_3 => NULL,
p_addr_attribute_category => NULL,
p_addr_attribute1 => NULL,
p_addr_attribute2 => NULL,
p_addr_attribute3 => NULL,
p_addr_attribute4 => NULL,
p_addr_attribute5 => NULL,
p_addr_attribute6 => NULL,
p_addr_attribute7 => NULL,
p_addr_attribute8 => NULL,
p_addr_attribute9 => NULL,
p_addr_attribute10 => NULL,
p_addr_attribute11 => NULL,
p_addr_attribute12 => NULL,
p_addr_attribute13 => NULL,
p_addr_attribute14 => NULL,
p_addr_attribute15 => NULL,
p_addr_attribute16 => NULL,
p_addr_attribute17 => NULL,
p_addr_attribute18 => NULL,
p_addr_attribute19 => NULL,
p_addr_attribute20 => NULL,
p_add_information13 => NULL,
p_add_information14 => NULL,
p_add_information15 => NULL,
p_add_information16 => NULL,
p_add_information17 => NULL,
p_add_information18 => NULL,
p_add_information19 => NULL,
p_add_information20 => NULL,
-- p_party_id => NULL,
p_party_id => ip_p_party_id,
p_address_id => ip_p_address_id,
p_object_version_number => ip_p_object_version_number
DBMS_OUTPUT.PUT_LINE ('Address Updation/Insertion has been successful!');
EXIT WHEN command_prin IS NULL;
command_prin := SUBSTR (command_prin, 251);
END;
END;
-- v_err_seq := 4;
-- End of customer related details
END IF;
END LOOP;
-- DBMS_OUTPUT.PUT_LINE ('Records read : ' || v_rec_cnt);
-- v_err_seq := 5;
--EXCEPTION
-- WHEN OTHERS THEN
-- ROLLBACK;
-- Output Error Message
-- v_err_num := TO_CHAR(SQLCODE);
-- v_err_msg := SUBSTR(SQLERRM,1,250);
-- v_err_line := 'Oracle error (seqno=' || v_err_seq || ') ' ||
-- v_err_num ||' occurred processing record '||
-- TO_CHAR(v_rec_cnt + 1) ||' : '||v_err_msg;
-- DBMS_OUTPUT.PUT_LINE(v_err_line);
END LOOP;
COMMIT;
END;
--END;
EXIT;
======================================================
many thanks to all...
Steven

Ive just sussed it - I had'nt put the 'v_emp' at the front of the fields from the temp table to pick then up! we continue..

Similar Messages

  • How do I CREATE IF NOT EXISTS Temp table in PLSQL?

    hello, how do I CREATE IF NOT EXISTS Temp table in PLSQL? The following table is to be created in FIRST call inside a recursive function (which you'll see in QUESTION 2).
    QUESTION 1:
    CREATE GLOBAL TEMPORARY TABLE TmpHierarchyMap
                                  Id numeric(19,0) NOT NULL,
                                  ParentId numeric(19,0) NOT NULL,
                                  ChildId numeric(19,0) NOT NULL,
    ... more ...
                             ) on commit delete rows');
    QUESTION 2: How to return a temp table from a function?
    For example, this is how I'm doing it at the moment, using Nested Table.
    EXECUTE IMMEDIATE 'CREATE OR REPLACE TYPE TmpHierarchyMapObjType AS OBJECT
                   Id numeric(19,0) ,
                   ParentId numeric(19,0),
                   ChildId numeric(19,0),
    ... more ...
         EXECUTE IMMEDIATE 'CREATE OR REPLACE TYPE TmpHierarchyMapTableType AS TABLE OF TmpHierarchyMapObjType;';
    CREATE OR REPLACE FUNCTION fnGetParentsTable
    ObjectId number,
    ObjectClassifier varchar2
    RETURN TmpHierarchyMapTableType
    IS
    TmpHierarchyMap TmpHierarchyMapTableType := TmpHierarchyMapTableType();
    ThisTempId varchar2(32);
    CURSOR spGetParents_cursor IS
    SELECT
    Id,
    ParentId,
    ChildId,
    FROM TMP_HIERARCHYMAP
    WHERE TempId = ThisTempId;
    BEGIN
    SELECT sys_guid() INTO ThisTempId FROM dual;
    spRecursiveGetParents(ObjectId, ObjectClassifier, ThisTempId);
    FOR oMap in spGetParents_cursor LOOP
    TmpHierarchyMap.Extend();
    TmpHierarchyMap(TmpHierarchyMap.Count) := TmpHierarchyMapObjType( oMap.Id
    , oMap.ParentId
    , oMap.ChildId
    END LOOP;
    DELETE FROM TMP_HIERARCHYMAP WHERE TempId = ThisTempId;
    RETURN TmpHierarchyMap;
    END fnGetParentsTable;
    QUESTION 3: what does the word GLOBAL means? I read that temp table is visible only to a particular database connection/session and will be dropped automatically on termination of the session. i can only find this information in some forum discussion but failed to locate this in Oracle doc, can someone point me in right direction please?
    Many thanks!
    REF:
    http://stackoverflow.com/questions/221822/sybase-developer-asks-how-to-create-a-temporary-table-in-oracle
    http://www.oracle-base.com/articles/8i/TemporaryTables.php

    devvvy wrote:
    so if I CREATE GLOBAL TEMPORARY TABLE twice on second pass of my recursive function what then...?You don't create it inside your function.
    You create the GTT once on your database outside of the function and then just leave it there and use it.
    Tables should not be dynamically created and dropped.
    Only other database engines such as SQL Server use the concept of creating temporary tables during the execution of code. Oracle uses a "create once, use whenever" methodology.

  • Difference between Temp table and Variable table and which one is better performance wise?

    Hello,
    Anyone could you explain What is difference between Temp Table (#, ##) and Variable table (DECLARE @V TABLE (EMP_ID INT)) ?
    Which one is recommended to use for better performance?
    also Is it possible to create CLUSTER and NONCLUSTER Index on Variable table?
    In my case: 1-2 days transactional data are more than 3-4 Millions. I tried using both # and table variable and found table variable is faster.
    Is that Table variable using Memory or Disk space?
    Thanks Shiven:) If Answer is Helpful, Please Vote

    Check following link to see differences b/w TempTable & TableVariable: http://sqlwithmanoj.com/2010/05/15/temporary-tables-vs-table-variables/
    TempTables & TableVariables both use memory & tempDB in similar manner, check this blog post: http://sqlwithmanoj.com/2010/07/20/table-variables-are-not-stored-in-memory-but-in-tempdb/
    Performance wise if you are dealing with millions of records then TempTable is ideal, as you can create explicit indexes on top of them. But if there are less records then TableVariables are good suited.
    On Tables Variable explicit index are not allowed, if you define a PK column, then a Clustered Index will be created automatically.
    But it also depends upon specific scenarios you are dealing with , can you share it?
    ~manoj | email: http://scr.im/m22g
    http://sqlwithmanoj.wordpress.com
    MCCA 2011 | My FB Page

  • DAC, ETL failed due to Post-Etl Script not exist and table not exist.

    When execute the ETL in DAC, it failed when execute the "Change Capture For Siebel OLTP"
    encounterred the following two type errors.
    how to fix these errors?
    The first is the table not exist:
    ======================================================================
    MESSAGE:::Could not truncate table 'S_ETL_I_IMG_38' because this table does not exist in database 'OLTP_SIA'.
    EXCEPTION CLASS::: com.microsoft.sqlserver.jdbc.SQLServerException
    com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(Unknown Source)
    ======================================================================
    The second is the Post-Etl not exist.
    I have copied the Copy Source Files and Lookup Files. What else should I do? What script it not find? have no idea.
    ======================================================================
    Jan 20, 2009 4:11:06 PM com.siebel.etl.etlmanager.EtlExecutionManager finishEtl
    SEVERE: Incorrectly specified Post-Etl Script/Executable. The file either does n
    ot exist, or is not readable
    UNREGISTERING: com.siebel.etl.engine.bore.FixedFailedNodesFacility
    686 SEVERE Tue Jan 20 16:11:06 CST 2009
    END OF ETL
    687 SEVERE Tue Jan 20 16:11:06 CST 2009 Incorrectly specified Post-Etl Script
    /Executable. The file either does not exist, or is not readable
    UNREGISTERING: com.siebel.etl.engine.core.SessionHandler
    UNREGISTERING: com.siebel.etl.engine.bore.ServerTokenPool
    UNREGISTERING: com.siebel.etl.engine.core.TableIndexHandler
    UNREGISTERING: com.siebel.etl.engine.bore.NewDispatcher
    Stopping EtlParameters 9550256
    UNREGISTERING: com.siebel.etl.engine.bore.EtlParameters
    UNREGISTERING: com.siebel.etl.engine.bore.ExternalTaskTokenPool
    UNREGISTERING: com.siebel.analytics.etl.execution.RefreshDateHandler

    Hi tigger,
    ad scripts:
    http://download.oracle.com/docs/cd/E12102_01/books/AnyInstAdm784/AnyInstAdmFunctionalRef9.html#wp1005877
    http://download.oracle.com/docs/cd/E12102_01/books/AnyInstAdm784/AnyInstAdmFunctionalRef8.html
    ad tables:
    Without data change capture tables nothing will work. Have you looked at the actual documentaiotn? It contains everythign step by step.
    http://www.oracle.com/technology/documentation/bi_apps.html
    --> Oracle Business Intelligence Applications Fusion Edition Installation and Configuration Guide -> 4.15.3 How to Update Siebel Transactional Database Schema Definitions

  • Table field length problem

    Hi Team,
    We r tring to create table with field length 250 and 'CHAR' type and one more field 'STRING 'for unlimited length.While creating table entries ,it is tsking only 130 length for all fields.it is not taking 250 characters for 250 length field.and it is not taking unlimited length for String field.Plz let me know.

    Hello Mohan,
    CHAR 250 is right. i am not facing any problem.
    can you please explain in detail what you have done and what error you are getting.
    Regards,
    Sujeet
    Edited by: Sujeet Mishra on Dec 2, 2009 4:42 AM

  • Table & Field Name Problem

    Hi Mentors,
    I am creating a z report in that one perticular field i want new value, old value details.
    Field is in MMR - Foreigh trade import - CAS numner (pharma) this field we are using for material status.( ex. A,B,C)
    Table Name - MARA Fiels name - CASNR
    This status we will change every three months. so when i am taking the report i need old value and new value status.
    For new value i will get from MARA-CASNR But, where i will find the old value table.
    Ex. if i edit master record MM02 and go to top - environment-dispay changes- in that i am finding the chage details, if i choose the details option i am getting old value and new value details.
    pls help me any one to find the old value details.
    Highly appreciated any solution
    award points if use ful answer
    Regards
    Laxman

    Hi Laxman,
    I have found one program Please check the same.
    *& Report  ZAK_MM_CHANGE_HISTORY                                       *
    REPORT  ZAK_MM_CHANGE_HISTORY                   .
    TABLES:
            CDHDR, CDPOS, MARA, MAKT, MARD.
    FIELD-GROUPS: HEADER.
    DATA: BEGIN OF CHGDOC OCCURS 50.
            INCLUDE STRUCTURE CDRED.
    DATA: END OF CHGDOC.
    DATA:
          CHGTYPE(1),
          PLANT(4),
          MATNR1 LIKE CHGDOC-OBJECTID.
    SELECT-OPTIONS:
        XMATNR  FOR CDHDR-OBJECTID,    "Material
        XUDATE  FOR CDHDR-UDATE,       "Change Date
        XUNAME  FOR CDHDR-USERNAME,    "User Name
        XTCODE  FOR CDHDR-TCODE,       "Transaction Code
        XWERKS  FOR MARD-WERKS.        "Plants
    SELECTION-SCREEN SKIP.
    *Filter change type
    SELECTION-SCREEN BEGIN OF BLOCK CHG0 WITH FRAME TITLE TEXT-001.
       PARAMETERS : XCHG1 AS CHECKBOX DEFAULT 'X',
                    XCHG2 AS CHECKBOX DEFAULT 'X',
                    XCHG3 AS CHECKBOX DEFAULT 'X'.
    SELECTION-SCREEN END OF BLOCK CHG0.
    START-OF-SELECTION.
    INSERT:
            CHGDOC-OBJECTID        "Material
            CHGTYPE                "Change type
            PLANT
            CHGDOC-CHANGENR
            CHGDOC-USERNAME
            CHGDOC-UDATE
            CHGDOC-TCODE
            CHGDOC-TABNAME
            CHGDOC-TABKEY
            CHGDOC-CHNGIND
            CHGDOC-FNAME
            CHGDOC-FTEXT
            CHGDOC-TEXTART
            CHGDOC-OUTLEN
            CHGDOC-F_OLD
            CHGDOC-F_NEW
    INTO HEADER.
    SELECT * FROM MARA WHERE MATNR IN XMATNR.
       MATNR1 = MARA-MATNR.
       CALL FUNCTION 'CHANGEDOCUMENT_READ'
         EXPORTING
            ARCHIVE_HANDLE             = 0
            CHANGENUMBER               = ' '
            DATE_OF_CHANGE             = '00000000'
              OBJECTCLASS                = 'MATERIAL'
              OBJECTID                   = MATNR1
            TABLEKEY                   = ' '
            TABLENAME                  = ' '
            TIME_OF_CHANGE             = '000000'
            USERNAME                   = ' '
            LOCAL_TIME                 = ' '
         TABLES
              EDITPOS                    = CHGDOC
         EXCEPTIONS
              NO_POSITION_FOUND          = 1
              WRONG_ACCESS_TO_ARCHIVE    = 2
              TIME_ZONE_CONVERSION_ERROR = 3
              OTHERS                     = 4.
       LOOP AT CHGDOC.
          CHECK:  CHGDOC-UDATE    IN XUDATE,
                  CHGDOC-USERNAME IN XUNAME,
                  CHGDOC-TCODE    IN XTCODE.
        Chg type: 1. Part revision, 2. Price change, 3. Others
          CASE CHGDOC-TCODE.
             WHEN 'MM01' OR 'MM02' OR 'MM03'.  CHGTYPE = '1'.
             WHEN 'MR21'.  CHGTYPE = '2'.
             WHEN OTHERS.  CHGTYPE = '3'.
          ENDCASE.
        Filter chg type
          IF ( CHGTYPE = '1' AND XCHG1 <> 'X' ) OR
             ( CHGTYPE = '2' AND XCHG2 <> 'X' ) OR
             ( CHGTYPE = '3' AND XCHG3 <> 'X' ).
             CONTINUE.
          ENDIF.
        Plant is a substring of tabkey
          PLANT = CHGDOC-TABKEY+21(4).
          IF NOT ( XWERKS IS INITIAL ) AND NOT ( PLANT IS INITIAL ).
             CHECK PLANT IN XWERKS.
          ENDIF.
          EXTRACT HEADER.
       ENDLOOP.
    ENDSELECT.
    END-OF-SELECTION.
    SORT.
    LOOP.
    Material
       AT NEW CHGDOC-OBJECTID.
          SELECT SINGLE * FROM MAKT  WHERE MATNR = CHGDOC-OBJECTID.
          FORMAT INTENSIFIED ON.
          SKIP.  SKIP.
          WRITE:/' *** Material:', (18) CHGDOC-OBJECTID, MAKT-MAKTX.
       ENDAT.
    Change type
       AT NEW CHGTYPE.
          FORMAT INTENSIFIED ON.
          SKIP.
          CASE CHGTYPE.
             WHEN '1'.   WRITE:/ '  **  Change type:  PARTS REVISION'.
             WHEN '2'.   WRITE:/ '  **  Change type:  PRICE CHANGE'.
             WHEN '3'.   WRITE:/ '  **  Change type:  OTHERS'.
          ENDCASE.
          SKIP.
       ENDAT.
       SHIFT CHGDOC-F_OLD LEFT DELETING LEADING SPACE.
       SHIFT CHGDOC-F_NEW LEFT DELETING LEADING SPACE.
       FORMAT INTENSIFIED OFF.
       WRITE:
         /     PLANT          UNDER 'Plant',
          (50) CHGDOC-FTEXT   UNDER 'Field',
          (45) CHGDOC-F_OLD   UNDER 'Old value',
          (45) CHGDOC-F_NEW   UNDER 'New value'.
       AT NEW CHGDOC-CHANGENR.
          FORMAT INTENSIFIED OFF.
          WRITE:
               CHGDOC-CHANGENR   UNDER 'Change doc',
               CHGDOC-TCODE      UNDER 'Tcod',
               CHGDOC-USERNAME   UNDER 'User name   ',
               CHGDOC-UDATE      UNDER 'Date    ' DD/MM/YY.
       ENDAT.
       AT END OF CHGDOC-OBJECTID.
          SKIP.
          ULINE.
          SKIP.
       ENDAT.
    ENDLOOP.
    TOP-OF-PAGE.
    WRITE: / SY-DATUM, SY-UZEIT,
        50 'ABC PTE LTD',
       100 'page', SY-PAGNO,
           / SY-REPID,
        48 'Change Documents Report',
       100 SY-UNAME.
    SKIP.
    ULINE.
    WRITE:/3
            'Change doc',
            'Tcod',
            'User name   ',
            'Date    ',
            'Plant',
       (50) 'Field',
       (45) 'Old value',
       (45) 'New value'.
    ULINE.
    Go to SE38 Create one Z report and paste the program without disturbing anything and execute. If it doesnot show any values in this report use Leading zeros formulae ieGive material no like 000000000000100222 etc. Try this i have tried in my system and its working.
    Reg,
    Ashok
    Assign points if useful.

  • TABLE FIELD DETERMINATION PROBLEM

    Hi Experts,
    I have a problem described  below by an example .
    Suppose I enter in the Tcode 'MIRO' and give the value of the field 'Inv. recpt date' and 'Reference' and then press
    'ENTER' . Now I just want to know that in which table the value of the field 'Reference' is gone and saved . I tried in a
    method in which I click on the field and press 'F1' . But it is showing only the structure name 'INVFO' not th table name.
    So please tell me the exact step through which I can identify the table name properly  .
    DEB
    Edited by: DEB. ABAP on Dec 1, 2011 11:32 AM
    Moderator message: FAQ, please search for previous discussions of this topic.
    Edited by: Thomas Zloch on Dec 1, 2011 12:12 PM

    Hi,
    U cant find out the field using pressing F1 in this type of fields....
    most of the MIRO details are in RBKP and RSEG.
    Some times U can find multiple values for particular record
    Suppose U got 3 entries in the field of the REFERENCE from the table. To find out which is the reference u have to make help of other field. This field is almost called CONDITION TYPE.
    These things are depends on clients.... So we cant give a proper answer....
    Eg:      REFERENCE     CONDTION
                123                      A
                124                      B
                125                      C
    here 3 values are there in ref for one doc so we have to refer condition also.....
    Values : 123,124,125
    condition : A, B, C
    Edited by: Riyas.a.rasak on Dec 1, 2011 12:02 PM
    Edited by: Riyas.a.rasak on Dec 1, 2011 12:05 PM

  • Internal table field name problem

    Dear All,
              I am declaring one internal table & fetching data using inner join. Following is my structure of internal table but it is not fetching data into MATNR1, the data is there in the table.
    Kindly suggest why this is happening?
    Regards,
    Dilip Gupchup
    internal table
    data : begin of sales_to_purchase_link_itab occurs 10,
    *******FOR P O RELATED INFORMATION
             EBELN LIKE EKKN-EBELN,"DOCUMENT NO
             AEDAT LIKE EKPO-AEDAT,"P O DATE
             EBELP LIKE EKKN-EBELP," ITEM
             MATNR LIKE EKPO-MATNR,"MATERIAL
             MENGE LIKE EKKN-MENGE,"QUANTITY
             SAKTO LIKE EKKN-SAKTO,"G/L Account Number
             NETWR LIKE EKKN-NETWR,"Net order value in PO
    *******END FOR P O RELATED INFORMATION
    *******FOR SALES ORDER RELATED INFORMATION
             VBELN LIKE EKKN-VBELN,"SALES DOC NO
             VBELP LIKE EKKN-VBELP,"SALES DOC ITEM
             MATNR1 LIKE VBAP-MATNR,"SALES MATERIAL
             ERDAT LIKE VBAP-ERDAT,"SALES DOC DATE
             ARKTX LIKE VBAP-ARKTX,"MATERIAL DESCRIPTION
             ZMENG LIKE VBAP-ZMENG,"QUANTITY
             NETPR LIKE VBAP-NETPR,"SALE VALUE
    *******FOR SALES ORDER RELATED INFORMATION
       end of sales_to_purchase_link_itab.
    select query
    select
    ekkn~ebeln
    EKKN~EBELP
    EKKN~SAKTO
    EKKO~AEDAT
    ekko~bukrs
    EKPO~MATNR
    EKPO~MENGE
    EKPO~NETWR
    vbap~vbeln
    ekkn~vbelp
    vbap~arktx
    VBAP~MATNR
    into corresponding fields of table
    sales_to_purchase_link_itab from ekkn
    inner join ekko on ekknebeln eq ekkoebeln "UP TO 10 ROWS.
    INNER JOIN EKPO ON EKKOEBELN EQ EKPOEBELN
    inner join vbap on ekknvbeln eq vbapvbeln
    WHERE
    EKPO~AEDAT IN S_ERDAT1.

    Hi,
    or change your coding like that:
    DATA rep LIKE sy-repid.
    TYPE-POOLS : slis.
    DATA : fcat TYPE slis_t_fieldcat_alv.
    DATA wa TYPE  slis_fieldcat_alv.
    DATA : BEGIN OF fld OCCURS 0,
    name(50),
    END OF fld.
    rep = sy-repid.
    *only possible if fields of itab are defined with LIKE !
    CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
         EXPORTING
              i_program_name         = rep
              i_internal_tabname     = 'SALES_TO_PURCHASE_LINK_ITAB'
              i_client_never_display = 'X'
              i_inclname             = rep
         CHANGING
              ct_fieldcat            = fcat.
    LOOP AT fcat INTO wa.
      CONCATENATE wa-ref_tabname '~' wa-fieldname INTO fld-name.
      APPEND fld.
    ENDLOOP.
    SELECT (fld)
    INTO TABLE sales_to_purchase_link_itab
    FROM ekkn
    INNER JOIN ekko ON ekkn~ebeln EQ ekko~ebeln "UP TO 10 ROWS.
    INNER JOIN ekpo ON ekko~ebeln EQ ekpo~ebeln
    INNER JOIN vbap ON ekkn~vbeln EQ vbap~vbeln
    WHERE
    ekpo~aedat IN s_erdat1.
    Andreas

  • Doubling Summed Numbers from Temp Table

    I have a crystal report that uses an Oracle Stored Procedure. The stored procedure sums (using Oracle sum function) some of the data from another table into a temp table, does some additional data manipulation and then selects from the temp table. My problem is any of the data that was summed in the stored procedure is displaying as double in the Crystal Report, (e.g. a field that sums to 10 is displaying as 20 in the Crystal Report.) When I run this Stored Procedure from Oracle SQL Developer I get the correct data.
    Could anyone tell me why this is happening and what to do to correct they problem? I am using Version 11.0.0.1282 of Crystal and Oracle 10g.
    Thanks,
    Debbie

    Hi Debbie,
    You also did not mention which DB driver you are using, ODBC, OLE DB or our native Oracle driver. Try one of the other ones to see they work. Could be an issue in the specific driver you are using.
    Testing in Oracle will use the native client engine. Try using a third party SQL, ODBC or OLE DB test tool to verify running the SP works.
    Thanks again
    Don

  • Temp Table within an Stored Procedure

    I'm pretty new to Oracle, but I have been developing in MS SQL for about 15. So I'm still getting use to the syntax and features within Oracle.
    I'm trying to create a stored procedure that has two temporary tables within it, and then queries both them tables and inserts the results into a table.
    I created the script but when they try to run in on the server it wont run. Can you guys tell me what I'm doing wrong?
    CREATE OR REPLACE PROCEDURE UpdateFIDB_SP IS BEGIN               CREATE GLOBAL TEMPORARY TABLE myAAAA         AS               (SELECT  AAAA.1111, AAAA.2222, BBBB.3333_EXT, CCCC.4444, DDDD.5555, DDDD.6666, DDDD.7777,                       DDDD.8888, AAAA.9999, EEEE.1010, EEEE.1A1A, EEEE.1B1B, FFFF.3333_LO, FFFF.1C1C,                       AAAA.1D1D               FROM mySchema.FFFF_07 FFFF               RIGHT OUTER JOIN mySchema.EEEE EEEE ON FFFF.9999 = EEEE.1B1B               RIGHT OUTER JOIN (                                 mySchema.DDDD DDDD                                 RIGHT OUTER JOIN mySchema.AAAA AAAA ON DDDD.1D1D = AAAA.1D1D                                 ) ON EEEE.PSPNR = AAAA.9999               LEFT OUTER JOIN mySchema.CCCC CCCC ON AAAA.3333 = CCCC.3333               LEFT OUTER JOIN mySchema.BBBB BBBB ON AAAA.3333 = BBBB.3333_INT               GROUP BY  AAAA.1D1D, AAAA.1111, AAAA.2222, BBBB.3333_EXT, CCCC.4444, DDDD.5555, DDDD.6666,                         DDDD.7777, DDDD.8888, AAAA.9999, EEEE.1010, EEEE.1A1A, EEEE.1B1B, FFFF.3333_LO,                         FFFF.1C1C         ON COMMIT DELETE ROWS);                         CREATE GLOBAL TEMPORARY TABLE myGGGG         AS             (SELECT  GGGG.1E1E, GGGG.1F1F, GGGG.1G1G, GGGG.1H1H, GGGG.1I1I, GGGG.1J1J,                     GGGG.1K1K, GGGG.R1D1D, GGGG.1L1L, GGGG.1M1M, GGGG.1N1N, GGGG.1O1O, GGGG.1P1P,                     GGGG.1Q1Q, HHHH.1R1R, IIII.1S1S, IIII.1T1T, IIII.1U1U, IIII.1V1V             FROM  mySchema.IIII IIII                   INNER JOIN mySchema.GGGG GGGG ON IIII.1K1K = GGGG.1K1K                   LEFT OUTER JOIN mySchema.HHHH HHHH ON GGGG.1L1L = HHHH.1W1W             WHERE ( GGGG.1M1M IN ('20', '30') )             AND   ( TO_DATE(IIII.1V1V, 'dd-mon-yyyy') = TO_DATE('31-DEC-9999','dd-mon-yyyy') )             AND ( TO_DATE(GGGG.1N1N, 'dd-mon-yyyy') >= TO_DATE('01-Jan-2011','dd-mon-yyyy') )         ON COMMIT DELETE ROWS);                 TRUNCATE TABLE FIDB;                 INSERT INTO FIDB (1111, 2222, 3333_EXT, 4444, 5555, 6666, 7777, 8888, 9999,                                   1010, 1A1A, 1B1B,3333_LO, 1C1C, 1D1D, 1E1E, 1F1F, 1G1G,                                   1H1H, 1I1I, 1J1J, 1K1K, R1D1D, 1L1L, 1M1M, 1N1N,                                   1O1O, 1P1P, 1Q1Q, 1R1R, 1S1S, 1T1T, 1U1U, 1V1V)            SELECT  myAAAA.1111, myAAAA.2222, myAAAA.3333_EXT, myAAAA.4444, myAAAA.5555, myAAAA.6666,                 myAAAA.7777, myAAAA.8888, myAAAA.9999, myAAAA.1010, myAAAA.1A1A, myAAAA.1B1B,                 myAAAA.3333_LO, myAAAA.1C1C, myAAAA.1D1D, myGGGG.1E1E, myGGGG.1F1F, myGGGG.1G1G,                 myGGGG.1H1H, myGGGG.1I1I, myGGGG.1J1J, myGGGG.1K1K, myGGGG.R1D1D,                 myGGGG.1L1L, myGGGG.1M1M, myGGGG.1N1N, myGGGG.1O1O, myGGGG.1P1P,                 myGGGG.1Q1Q, myGGGG.1R1R, myGGGG.1S1S, myGGGG.1T1T, myGGGG.1U1U, myGGGG.1V1V         FROM myGGGG INNER JOIN myAAAA ON myGGGG.R1D1D = myAAAA.1D1D         ORDER BY myGGGG.R1D1D;        COMMIT;     END;
    Thanks!

    Some people still sound mad at me because I have two queries and use temp tables
    Because in Oracle, unlike in sql server, you generally do not NEED temp tables at all.
    One of the biggest mistakes new Oracle developers make is to use PL/SQL when SQL will do the job just fine. Using PL/SQL when it isn't needed generally makes the code slower, less scalable and harder to maintain.
    One of the biggest mistakes sql server developers make when they use Oracle is to use temp table when they aren't needed. They try to write code in Oracle exactly the same way they wrote it in sql server. That creates temp tables that aren't needed, makes their code perform horribly and also makes it less scalable and harder to maintain.
    Oracle works differently and generally doesn't need ANY temp tables. You need to learn about how Oracle handles transactions and read consistency and how writers do NOT block readers and vice versa.
    Create a new thread and post FORMATTED code that shows the PROBLEM you are trying to solve and we can show you the proper way to solve it. That 'proper way' will likely NOT include any need for or use of temp tables.

  • How to download Temp tables from Function Module

    Hi Gurus,
    I have a function Module which is getting data from various DSOs and putting in another DSO.
    For data validation purposes I need to download data which is in temp tables.
    I know I need to go to SE37 and set breakpoint and then go to rsa3 and run the extractor/ FM in DEBUG mode. After that I have to execute the FM. I performed all these steps but still could not  downlaod temp tables.
    Anybody has any suggestions if I am missing any steps in here.
    Regards

    if you have a temp table - say itab - then you can have an open dataset command to dump the table into a flat file in your app server and then do the reconsiliation with that data.  This is because extraction is done using a background job and you can only store the data as a flat file onto the app server.
    The flat file can be generated using the open dataset command.

  • How do I write a select statement to see if table field is in variable list

    I was wondering if someone knew the best way to write a query to pull back rows where a table field is found in a a variable string.  I'm using Cold Fusion 10 on Microsoft SQL Server.
    The table has a series of fields such as
    carcode          carname
    G                Garage
    C                Carport
    A               Attached
    D               Detached
    And another query pulls back a field that stores as text all the abbreviations that apply
    I want to pull back all the carnames that would match the abbreviations stored in that field.  I thought I could use a contains line but that does not work.  How do I pull back matches against a variable string... I tried an IN statment but that didn't work.
    CFQUERY...
    Select carname from CarTable WHERE CONTAINS (carcode, '#query.carlist#') does not work. 
       select carname from CarTable WHERE CONTAINS(carcode, 'G,A')
    I'm stumped.  The list of abbreviations could be very LOOOONG or short and I just need to translate those abbreviations into the full names by grabbing it from another table.  It isn't just one abbreviation so I can't use LIKE in the one to one sense.
    Thank you so much.

    If you have records with these values,
    G,A
    0
    then your first mistake is that you designed your database poorly.  Storing lists in a single field is essentially stroring unuseable data.  A one to many relationship is better.  If you don't know what that is, I've heard good things about the book, Database Design for Mere Mortals.
    Next, this syntax, #queryname.car_storage#, only returns the first record.  To get all the records, use the valuelist function.
    Next, in sql, if you have a list of strings, each one has to be quoted.  Something like this.
    where myfield in ('a', 'b', 'c')
    The best way to achieve this in ColdFusion is to use the cfqueryparam tag with the list attribute set to yes.

  • How to use temp table/variable

    Hello,
    It's SQL 2008 R2. I need to bring data from Oracle using .Net Providers/ODBC Data Provider to MS SQL table converting Oracle UTC dates to PST.  The source connection type cannot be changed as it's given. For the Destination I'm using the OLE DB.
    As the truncate all and load could take time I'm trying to use a temp table or a variable to use it further with t-sql merge or not exists to bring/add the only new records to the destination table.
    I'm trying different scenarios that is all failed.
    Scenario A:
    1. In DTF after OLE DB Source I'm using the Derived Colum to convert dates. It's working well.
    2. Then use Recordset Destination with an object variable User::obj_TableACD. It's also working well.
    3. Then I created a string variable with a simple query that I could modify later "select * from " + (DT_WSTR,10)@[User::obj_TableACD] trying to get data from the recordset object variable but it's not working.
    Scenario B:
    1. Created a store procedure to create a temp table.
    2. Created a string variable to execute SP str_CreateTempTable: "EXEC dbo.TempTable". It's working well with the SQL Task with SQLSourceType as Variable.
    3. Then how to populate the temp table from the Oracle source to bring data into the Destination?
    I could spend another few days to figure it out. So, please help me on it if there is a way to solve it.
    Thanks

    Thank you so much, Nitesh. Now, I got the understanding of temp tables in SSIS. However, in my case to implement t-sql merge or not exists to bring the new records only I'd need to load at least a one table into a temp table anyway. So, why not to use a
    destination table instead. I also noticed a one remark from the article you suggested that the expert who wrote the article had never actual used the temp tables in SSIS.
    So, I decided to go with truncate, drop keys, derive columns, load, and create keys again in the destination table.
    Thank you again, I'll reserve the knowledge I got for the temp SSIS tables for some other cases.

  • Global Temp Table Not found - SSIS

    I am facing below error while using global temp table in SSIS.
    [OLE DB Destination [78]] Error: SSIS Error Code DTS_E_OLEDBERROR.  An OLE DB error has occurred. Error code: 0x80040E37.
    An OLE DB record is available.  Source: "Microsoft SQL Server Native Client 10.0"  Hresult: 0x80040E37  Description: "Table/view either does not exist or contains errors.".
    [OLE DB Destination [78]] Error: Failed to open a fastload rowset for " ##AGENTDTLS". Check that the object exists in the database.
    [SSIS.Pipeline] Error: component "OLE DB Destination" (78) failed the pre-execute phase and returned error code 0xC0202040.
    1) For data connection manager - Retain same connection is set to True
    2) Data Flow task - Delay Validation is set to True
    3) Destination Task - Using Temp Table - ValidateExternalMetadata is set to false.
    4) I am just using one data connection.
    5) before using the temp file I am checking if its exits and if yes drp it first and create it.
    Not able to understand the reason for failure.

    Why don't you use permanent table in tempdb?
    Kalman Toth Database & OLAP Architect
    SQL Server 2014 Design & Programming
    New Book / Kindle: Exam 70-461 Bootcamp: Querying Microsoft SQL Server 2012

  • How to create a temp table in the memory, not in disk?

    in sql server, you can create a temp table in the memory instead of disk,
    then you can do the insert, delete,update and select on it.
    after finishing, just release it.
    in Oracle,
    I am wonderfing how to create a temp table in the memory, not in disk?
    thanks,

    Thanks for rectifying me Howard.
    I just read your full article on this too and its very well explained here:
    http://www.dizwell.com/prod/node/357
    Few lines from your article
    It is true, of course, that since Version 8.0 Oracle has provided the ability to create a Keep Pool in the Buffer Cache, which certainly sounds like it can do the job... especially since that word 'keep' is used again. But a keep pool is merely a segregated part of the buffer cache, into which you direct blocks from particular tables (by creating them, or altering them, with the BUFFER POOL KEEP clause). So you can tuck the blocks from such tables out of the way, into their own part of the buffer cache... but that is not the same thing as guaranteeing they'll stay there. If you over-populate the Keep Pool, then its LRU mechanism will kick in and age its contents out just as efficiently as an unsegregated buffer cache would.
    Functionally, therefore, there can be no guarantees. The best you can do is create a sufficiently large Keep Pool, and then choose the tables that will use it with care such that they don’t swamp themselves, and start causing each other to age out back to disk.
    Thanks and Regards

Maybe you are looking for