Inheriting table data and constraints

hi
When i do a
create table t1 as select * from t2 ,t1 does not inherit the constraints indexes etc of t2 but only the data.
Is there any way we can achieve this. Or is there any way to replicate a table into another one?
Thanks,
Ashok

Cross-posting to same topic in the inheriting table with data.
Note that COPY is a SQL*Plus command, and deprecated since 8.0. It's intended for copying data from one database to another; we're supposed to use Advanced Replication functionality instead.
Cheers, APC

Similar Messages

  • Accessing sap tables data and display in webi

    Hi all,
    i installed business objects edge series.
    i want to access SAP tables data and display in webi for adhoc reporting.
    Is there any process to achieve this.

    Hi
    currently (April 2010) you have the following options:
    1. You load your R/3 data into an SAP BW and use universes based on BEx queries to create WebI reports
    2. You can use SAP rapid marts. They contain Data integrator mappings (you need an installation of the DI for this) to extract and load your SAP R/3 data into a relational database. Additionally they provide universes (based on a relational schema) hich ill allo you to build WebI reports.
    3. You can use the R/3 connector for the Data Federator (You need a DF installation for this). Please note that the R/3 connector is not yet a product rather just a PROTOTYPE. Take a look here: SAP BusinessObjects Web Intelligence Reporting for SAP ERP [original link is broken]
    4. You can try to access the underlying database directly using the appropriate DB drivers. Please note that this is NOT RECOMMENDED. This way you cannot leverage security defined on the R/3 side in your WebI reports and you will not be able to access all data as available in R/3 since some of them are stored encoded/compressed in the underlying tables.
    5. Instead of WebI you can use Crystal Reports and the R/3 drivers (eg. SAP Tables, Functions, Cluster) provided when installing the integration kit for SAP.
    Regards,
    Stratos

  • How to compare table data and table field

    Hi buddy,
        I have some question about how to compare table data and table field.
       1. I know there is one method:   CL_ABAP_UNIT_ASSERT=>ASSERT_TABLE_CONTAINS  , it use in unit test to compare the table data(A and B) , you can loop table A into structure A1, then use this mehtod it can compare whether table B contain structure A1.  but when I try to use this in main program it will dump.
              CL_ABAP_UNIT_ASSERT=>ASSERT_TABLE_CONTAINS(
                                                                                                        LINE    = A1
                                                                                                        TABLE = B ).
           Is there any method or FM can be used to compare the table data ?
        2. I also want to compare two table field , try to find out the different. How to realize this.
    Thank you for your sincerely answer.

    Hi Zongjie,
    What`s the difference, if you using loop A into wa_A, read table B into wa_B with all field, then compare with wa_A and wa_B.
    The question 2, seems no standard FM available here.
    Loop A into wa_A.
       Loop B into wa_B.
           if wa_A-field1 eq wa_B-field1.
           endif.
            if wa_A-field2 eq wa_B-field2. 
           endif.
       endloop.
    endloop.
    regards,
    Archer

  • Modify table data and import to same bapi function module

    Hai friends,
    I have a requirement on bapi , such that after executing the bapi function module data comes on tables and again  i need enter  weight in weight column field in the same table data and pass the same table in the same bapi function module .
    plz sujjest.
    with reagards,
    prasad.

    Can  u explain in details,
    means which bapi r u using? where  u will enter weight? etc.

  • How to make a copy of an application with its schema-tables,data and all

    Good day,
    I am looking for the best way to make a copy of an application from one computer to another, including the schema (tables, data and all) in Apex3.2.
    I can only manage to make a copy of the application without the data using the export utility
    Please assist with this difficulty
    Kind Regards
    Thabo
    Edited by: Thabo K on Jun 1, 2009 1:13 AM

    Hello,
    To copy across the data you can use the traditional EXP/IMP or the Datapump utility.
    If you're used to using EXP/IMP I'd encourage you to look at Datapump, if you haven't used EXP/IMP before I'd encourage you to look at Datapump (datapump rocks) -
    http://www.oracle-base.com/articles/10g/OracleDataPump10g.php
    There are a few major differences between Datapump and traditional EXP/IMP (EXP/IMP creates the export file on the client side, Datapump creates it on the server side etc).
    In my book "Pro Oracle Application Express" I have a section on cloning applications/data between instances, which you might find useful.
    Hope this helps,
    John.
    Blog: http://jes.blogs.shellprompt.net
    Work: http://www.apex-evangelists.com
    Author of Pro Application Express: http://tinyurl.com/3gu7cd
    REWARDS: Please remember to mark helpful or correct posts on the forum, not just for my answers but for everyone!

  • How can we delete SID table data and Text table data

    Hi,
    How can we delete SID table data and Text table data of any
    InfoObject.

    Hi,
    Go to transaction SE14, give the technical name if the table:
    /BIC/T<InfoObject Name>   for Text Table
    /BIC/S<InfoObject Name>  for SID Table
    Select "Table" in the given 4 options below  &  hit Edit button.
    in the next screen select "Direct"
    & also select "detele data" radio button.
    & hit  "Activate & adjust database".
    this will delete the complete data from the tables.
    Note: before deleting the SID's make sure of the consequences & after effects.
    Also the SID gets generated the next time you load master data/transaction data only for those records which were loaded..
    Regards,
    Iliyas

  • Table structure and constraints in HTML table

    This script creates a html file (Structure.html) that contains structure of a specific table.
    When the following script is executed in sql * plus, it asks for the table name for which
    structure information is needed. after entering the table name, it writes the table structure
    into structure.html file.
    SET LINESIZE 150
    SET PAGESIZE 150
    SET FEEDBACK OFF
    SET VERIFY OFF
    COLUMN "COLUMN NAME" FORMAT A50
    COLUMN "DATA TYPE" FORMAT A15
    COLUMN "IS NULL" FORMAT A15
    COLUMN CONSTRAINTS FORMAT A15
    PROMPT Enter table name:
    ACCEPT TABNAME
    SET MARK HTML ON
    SPOOL STRUCTURE.html
    PROMPT &TABNAME
    -- Query ---
    SELECT TRIM(A.COLUMN_NAME) AS "COLUMN NAME",
    TRIM(DATA_TYPE||'('||DECODE(A.DATA_LENGTH,22,A.DATA_PRECISION||','||A.DATA_SCALE,
    A.DATA_LENGTH) || ')') AS "DATA TYPE",
    TRIM(DECODE(A.NULLABLE,'Y',' ','NOT NULL')) AS "IS NULL",
    TRIM(DECODE(C.CONSTRAINT_TYPE,'P','PRIMARY KEY','R','FOREIGN KEY('||D.TABLE_NAME||')','U','UNIQUE', 'C','CHECK')) AS CONSTRAINTS,
    TRIM(C.CONSTRAINT_NAME) AS "CONSTRAINT NAME",
    C.SEARCH_CONDITION AS "CHECK CONDITION",
    A.DATA_DEFAULT AS "DEFAULT VALUE"
    FROM USER_TAB_COLS A,
    USER_CONS_COLUMNS B,
    USER_CONSTRAINTS C,
    USER_CONS_COLUMNS D
    WHERE
    A.TABLE_NAME = '&TABNAME' AND
    A.TABLE_NAME = B.TABLE_NAME(+) AND
    A.COLUMN_NAME = B.COLUMN_NAME(+) AND
    B.CONSTRAINT_NAME = C.CONSTRAINT_NAME(+) AND
    C.R_CONSTRAINT_NAME = D.CONSTRAINT_NAME(+);
    SPOOL OFF
    SET MARK HTML OFF

    Hi,
    For Head Count you can use 0HR_PA_0 datasource and the other Employee details like start date and end date you can get them from employee master data and FTE can be calculated from the Emloyee Master Data and Head count data.
    Hope this helps...
    Thanks,

  • How to read internal table data and use to retrive from other table.

    Hi all,
        I am trying to generate a report using ooabap.
    In this scenario, I retrieved data from one standard table (zcust) and successfully displayed using structure 'i_zcust_final' ( i_zcust_final is similar structure of zcust).  
        Now I want to get some other data from other standard table  (zpurch) using the data in i_zcust_final. How....???? I am unable to read data from i_zcust_final even i kept in loop.
        I am attaching the code here.. even it too long, please look at the code and suggest me what to do.
    code  **************************
    REPORT  ZBAT_OOPS_REPORT1.
    TABLES: ZCUST.
        D E F I N I T I O N     *****
    CLASS BATLANKI_CLS DEFINITION.
      PUBLIC SECTION.
      DATA : ITAB_ZCUST TYPE STANDARD TABLE OF ZCUST,
             I_ZCUST_FINAL LIKE LINE OF ITAB_ZCUST,
             ITAB_ZCUST1 TYPE STANDARD TABLE OF ZCUST.
      TYPES: BEGIN OF IT_ZPURCH,
              CUSTNUM   TYPE ZPURCH-CUSTNUM,
              PURC_DOC  TYPE ZPURCH-PURC_DOC,
              VENDOR    TYPE ZPURCH-VENDOR,
              STATUS    TYPE ZPURCH-STATUS,
              PURC_ORG  TYPE ZPURCH-PURC_ORG,
            END OF IT_ZPURCH.
      DATA : ITAB_ZPURCH TYPE TABLE OF IT_ZPURCH,
             I_ZPURCH_FINAL LIKE LINE OF ITAB_ZPURCH.
      METHODS: GET_ZCUST,
               PRINT_ZCUST,
               GET_ZPURCH.
    ENDCLASS.
    I N I T I A L I Z T I O N   *****
        SELECT-OPTIONS:S_CUSNUM FOR ZCUST-CUSTNUM.
    INITIALIZATION.
    S_CUSNUM-LOW = '0100'.
    S_CUSNUM-HIGH = '9999'.
    S_CUSNUM-OPTION = 'BT'.
    S_CUSNUM-SIGN   = 'I'.
    APPEND S_CUSNUM.
    CLEAR S_CUSNUM.
    I M P L E M E N T A T I O N *****
    CLASS BATLANKI_CLS IMPLEMENTATION.
      METHOD GET_ZCUST.
      SELECT * FROM ZCUST
        INTO TABLE ITAB_ZCUST
       WHERE CUSTNUM IN S_CUSNUM.
    ENDMETHOD.
      METHOD PRINT_ZCUST.
       LOOP AT ITAB_ZCUST INTO I_ZCUST_FINAL.
       WRITE:/ I_ZCUST_FINAL-CUSTNUM,
               I_ZCUST_FINAL-CUSTNAME,
               I_ZCUST_FINAL-CITY,
               I_ZCUST_FINAL-EMAIL.
       ENDLOOP.
      ENDMETHOD.
       METHOD GET_ZPURCH.
    LOOP AT ITAB_ZCUST INTO ITAB_ZCUST1.
      SELECT CUSTNUM
             PURC_DOC
             VENDOR
             STATUS
             PURC_ORG
        FROM ZPURCH
        INTO CORRESPONDING FIELDS OF TABLE ITAB_ZPURCH
        WHERE CUSTNUM EQ I_ZCUST_FINAL-CUSTNUM.
    ENDLOOP.
         LOOP AT ITAB_ZPURCH INTO I_ZPURCH_FINAL.
         WRITE:/ I_ZPURCH_FINAL-CUSTNUM,
                 I_ZPURCH_FINAL-PURC_DOC,
                 I_ZPURCH_FINAL-VENDOR,
                 I_ZPURCH_FINAL-STATUS,
                 I_ZPURCH_FINAL-PURC_ORG.
         ENDLOOP.
    ENDMETHOD.
    ENDCLASS.
      O B J E C T   *****
    DATA: BATLANKI_OBJ TYPE REF TO BATLANKI_CLS.
    START-OF-SELECTION.
    CREATE OBJECT BATLANKI_OBJ.
    CALL METHOD:
                 BATLANKI_OBJ->GET_ZCUST,
                 BATLANKI_OBJ->PRINT_ZCUST,
                 BATLANKI_OBJ->GET_ZPURCH.
    Can anyone suggest me..
      Thanks in advance,
      Surender.

    Hi Surendar..
    There is mistake in the Work area specification in this method.
    METHOD GET_ZPURCH.
    LOOP AT ITAB_ZCUST INTO ITAB_ZCUST1.
    SELECT CUSTNUM
    PURC_DOC
    VENDOR
    STATUS
    PURC_ORG
    FROM ZPURCH
    INTO CORRESPONDING FIELDS OF TABLE ITAB_ZPURCH
    <b>WHERE CUSTNUM EQ      ITAB_ZCUST1-CUSTNUM.</b>           
                                   "Instead of  I_ZCUST_FINAL-CUSTNUM.
    ENDLOOP.
    LOOP AT ITAB_ZPURCH INTO I_ZPURCH_FINAL.
    WRITE:/ I_ZPURCH_FINAL-CUSTNUM,
    I_ZPURCH_FINAL-PURC_DOC,
    I_ZPURCH_FINAL-VENDOR,
    I_ZPURCH_FINAL-STATUS,
    I_ZPURCH_FINAL-PURC_ORG.
    ENDLOOP.
    ENDMETHOD.
    Now it should work..
    One more thing : From performance point of view you have to Replace that loop using FOR ALL ENTRIES . And avoid CORRESPONDING FIELDS. it will be slow.
    This is the code.
    LOOP AT ITAB_ZCUST INTO ITAB_ZCUST1.
    if ITAB_ZCUST[] IS NOT INITIAL.
    SELECT CUSTNUM
    PURC_DOC
    VENDOR
    STATUS
    PURC_ORG
    FROM ZPURCH
    INTO TABLE ITAB_ZPURCH
    <b>for all entries in ITAB_ZCUST1</b>
    <b>WHERE CUSTNUM EQ      ITAB_ZCUST1-CUSTNUM.</b>           
                                   "Instead of  I_ZCUST_FINAL-CUSTNUM.
    ENDIF.
    ENDLOOP.
    <b>Reward if Helpful.</b>

  • Merge multiple source table dates and to one target table

    The requirement is to merge multiple source tables (each table has a set of start and end date) to one target table with one set of start and end date and contain the date relevant column values from each source table.  Payment source tablestart dateend datepayemnt1/1/201512/31/2015301/1/201612/31/999960Position source tablestart dateend dateposition1/1/201512/31/2016101/1/201712/31/999920Target tablestart dateend datepayemntposition1/1/201512/31/201530101/1/201612/31/201660101/1/201712/31/99996020 What transformation(s) will be best to use to handle this requirement? Thanks, Lei

    Thanks Karen,
    that was exactly what i was hoping for.
    Maybe it could be made easier/less confusing if the Mapping Workbench just made you choose a target table. But maybe this is not usefull if the table contains two foreign keys to the same table. Or maybe this should just be put somewhere in the documentation.
    Regards,
    Robert
    Hi Donald,
    fortunately i'm my own DBA so i don't have any problems ;-). However i'm certainly interested in the reasons for not having such a conditional foreign key.
    However actually the foreign key isn't conditional, the condition is that either the field (using the FK) must be filled, or a free-format field. The reasoning for this is that we have a list of known towns and if the addres is local a town from that list must be chosen. If the addres is outside the country a town can just be typed in (no list).
    Concerning the agrregate, all fields are always used. There are no neediness flags anywhere. The aggregate contains three fields which are mapping as direct (two fields) or a One-to-one (the FK). All 'parents' all contains these three fields.
    Regards,
    Robert

  • Read table data and fetch file from path specified in table column

    Hi,
    I have a situation where file path information is stored in database table along with other columns - I need to read data from SQL Server table row by row, go to the path identified by the record, check for existance of the file - if the file is available copy it to a staging area, then read the next record. Repeat this process until the last record is fetched from the table. At the end, zip all the files found and FTP to a different location. If the file is not found in the path specified, write the database record to a seperate text file.
    At end of the process, send an email with records for which files were not found at specified location.
    Thanks
    Edited by: user4566019 on Oct 5, 2008 4:32 AM

    Hi,
    That is not complex to solve at ODI.
    Try the following.
    1) Create a package
    2) create a variable to receive the path as parameter and drag and drop it at package as "Declared"
    3) drag and drop the ODI Tool "odiFileMove" using and let the variable as patch at ODI Tool parameter.
    Use the parameters -ACTION=MOVE -TIMEOUT=100 and -NOFILE_ERROR=NO (take a look at ODI Toos Reference for other parameters)
    3) Create a "KO" (error) flow to write the variable at a text file. That will allow the process knows what file is missing
    4) generate a scenario of this package
    5) create a procedure
    6) at first step, put the query from SQL Server (set the Logical Schema to the right connection)
    7) at Target tab, put the call to the scenario generated using the returned value from query parameter. Plus, let the -SYNC_MODE=1. That will call one scenario by time.
    8) create a new step to zip the files at stage directory
    9) create a step to make the ftp
    10) create a step to mail the txt generated with files not founded. If you wish, you can make a validation on the file to see if is necessary to send the mail, it means, if there is any file missing.
    Does it help you?

  • I have these three tables data and i want this report as given below

    here cpv means cash payment voucher<pre>i have voucher header tableVoucher Voucher Voucher Entry ID Type Date Date1 CPV 2014-12-10 16:47:00 0 2014-12-10 00:00:00
    1 CRV 2014-12-10 16:22:00 0 2014-12-10 00:00:00
    1 JV 2014-12-10 16:49:00 ccc 0 2014-12-10 00:00:00
    2 CPV 2014-12-10 16:51:00 sss 0 2014-12-10 00:00:00
    2 CRV 2014-12-10 16:59:00 0 2014-12-10 00:00:00
    2 JV 2014-12-20 14:31:00 0 2014-12-20 00:00:00
    3 CPV 2014-12-20 14:33:00 0 2014-12-20 00:00:00
    3 CRV 2014-12-13 15:02:00 0 2014-12-13 00:00:00
    3 JV 2014-12-13 15:02:00 0 2014-12-20 00:00:00
    4 CPV 2014-12-20 14:33:00 0 2014-12-20 00:00:00
    4 CRV 2014-12-13 15:13:00 0 2014-12-13 00:00:00
    4 JV 2014-12-23 00:21:00 0 2014-12-23 00:00:00
    5 CPV 2014-12-20 20:50:00 0 2014-12-20 00:00:00
    5 CRV 2014-12-14 23:39:00 0 2014-12-14 00:00:00
    5 JV 2014-12-23 00:24:00 0 2014-12-23 00:00:00
    6 CPV 2014-12-20 22:43:00 0 2014-12-20 00:00:00
    6 CRV 2014-12-14 23:40:00 0 2014-12-14 00:00:00 select VoucherID,VoucherType,Remarks ,Debit,Credit from voucherbody
    1 CRV fsdd 0.000000000 44.000000000
    1 JV xccc 4.000000000 4.000000000
    2 CRV sdf 0.000000000 40.000000000
    2 CPV ss 33.000000000 0.000000000
    1 CPV cxvx 43.000000000 0.000000000
    3 CRV 0.000000000 33.000000000
    4 CRV 0.000000000 200.000000000
    5 CRV 0.000000000 3444.000000000
    6 CRV 0.000000000 343333.000000000
    2 JV 300.000000000 300.000000000
    3 CPV 40000.000000000 0.000000000
    7 CRV 0.000000000 34.000000000
    8 CRV 0.000000000 4000.000000000
    9 CRV ss 0.000000000 3444.000000000
    4 CPV 345.000000000 0.000000000
    5 CPV 230.000000000 0.000000000
    3 JV 4000.000000000 4000.000000000
    6 CPV 2.000000000 0.000000000
    7 CPV 3432.000000000 0.000000000
    8 CPV 222.000000000 0.000000000
    9 CPV 2000.000000000 0.000000000
    10 CPV 233.000000000 0.000000000
    11 CPV 3444.000000000 0.000000000
    10 CRV 0.000000000 45555.000000000
    12 CPV 333.000000000 0.000000000
    13 CPV 344.000000000 0.000000000
    14 CPV 4555.000000000 0.000000000
    15 CPV 455.000000000 0.000000000
    16 CPV 2222.000000000 0.000000000
    17 CPV 333.000000000 0.000000000
    18 CPV ss 232.000000000 0.000000000
    19 CPV 222.000000000 0.000000000
    11 CRV 0.000000000 2222.000000000
    4 JV xx 200.000000000 200.000000000
    12 CRV 0.000000000 333.000000000
    20 CPV 3333.000000000 0.000000000
    13 CRV 0.000000000 3333.000000000
    14 CRV 0.000000000 4444.000000000
    5 JV 33.000000000 33.000000000
    21 CPV ssss 2222.000000000 0.000000000
    22 CPV wsss 2222.000000000 0.000000000
    23 CPV 22222.000000000 0.000000000
    24 CPV qqq 1111.000000000 0.000000000
    25 CPV 222.000000000 0.000000000
    26 CPV 2222.000000000 0.000000000
    15 CRV qqqq 0.000000000 11111.000000000
    16 CRV 0.000000000 2000.000000000
    27 CPV 10000.000000000 0.000000000
    28 CPV 23.000000000 0.000000000select AccountNo,AccountTitle,AccountType,OpeningDebit,OpeningCredit from AccountChart100001 Majid ASSET 2000.000000000 3000.000000000
    100002 Salman ASSET 2999.000000000 1000.000000000
    100003 Kamran ASSET 4000.000000000 4500.000000000
    100004 Arif ASSET 3000.000000000 2000.000000000
    100005 Aslam ASSET 2000.000000000 50000.000000000
    100006 Akram ASSET 30.000000000 454.000000000
    100007 Sohail ASSET 3.000000000 353.000000000
    100008 Kashif ASSET 78897.000000000 7879.000000000
    100009 Asif ASSET 4200.000000000 3242.000000000
    100010 Tajmul ASSET 1111123.000000000 3000.000000000
    100011 Kamran ASSET 3.000000000 113.000000000
    100012 Taswer ASSET 2000.000000000 1000.000000000
    100013 dfd ASSET 2000.000000000 1000.000000000
    100014 Tameer ASSET 3000.000000000 2000.000000000
    100015 No Name ASSET 5000.000000000 1999.000000000
    100016 Saleem ASSET 3339.000000000 9999.000000000
    100017 Awais ASSET 6000.000000000 4000.000000000
    100018 Abid ASSET 4000.000000000 1000.000000000
    200001 Muazam LIABILITY 500.000000000 0.000000000i want this report as given below from above tables account no AccountTitle accounttype Debit Credit1 CRV fsdd 0.000000000 44.0000000001 cash fsdd 44.000000000 0.000000000</pre>

    SELECT AC.AccountNo
    ,AC.AccountTitle
    ,AC.AccountType
    ,VB.Debit
    ,VB.Credit
    FROM voucherheader VH
    INNER JOIN voucherbody VB ON VH.VoucherID = VB.VoucherID
    INNER JOIN AccountChart AC ON AC.AccountNo = VH.AccountNohere voucher header has voucherID and not Accountnoit is showing error at vh.accountno

  • Find table name and constraint type based on field name

    I have a field or column name with me...I want to find the table name for which it is a primary key...Any query to do this job so that the execution costs are low...
    Currently i have to mix dba_constraints and ALL_TAB_COLUMNS to get this...any way to fetch the data from a single table/anyother cost effective process is appreciated

    Why are you using dynamic SQL? Just place it as static SQL in your PL/SQL code. Simply like this
    select table_name
       into ..
      from (
              select cc.column_name
                   , cc.table_name
                   , count(cc.column_name) over(partition by c.constraint_name) column_count
                from user_constraints c
                join user_cons_columns cc
                  on c.constraint_name = cc.constraint_name
               where constraint_type = 'P'
    where column_count = 1
       and column_name  = p_name;
    And in some case (Not this one) if you have to use dynamic SQL you need to pass your variables are bind variables to your SQL. You should not be appending it in the string. That's a very bad thing to do. Your code will be going for hard parse, your code will be exposed to SQL Injection. With your SQL this is how you use bind variable.
    execute immediate
    q'[
        select table_name 
          from (
                  select cc.column_name
                       , cc.table_name
                       , count(cc.column_name) over(partition by c.constraint_name) column_count
                    from user_constraints c
                    join user_cons_columns cc
                      on c.constraint_name = cc.constraint_name 
                   where constraint_type = 'P'
         where column_count = 1
           and column_name  = :1
    using p_name
    into <your_variable>;
    And finally to exactly tell why your code is failing, You have not use sing quotes to enclose your p_name that you are appending to your code. Following would fix the error.
    DO NOT USE IT IN ANY CASE. ITS WRONG ALWAYS!!
    'select table_name  from '||' (
              select  cc.column_name,cc.table_name, count(cc.column_name) over(partition by c.constraint_name) column_count
                from user_constraints c join user_cons_columns cc
                  on c.constraint_name = cc.constraint_name  where constraint_type = ''P'') '||
    ' where column_count = 1 and column_name = '''|| p_name || '''';
    AGAIN NEVER WRITE A CODE AS SHOWN ABOVE.

  • How to obtain from tables Date and Time in MHP

    Hello,
    I'm working in a MHP project and I need to access information about the current time and hour. I have been using Calendar class but it doesn't work in my ADB. So I think that I should access to the SI tables using an asinchronus listener. Can somebody help sending some code snnipets.
    Thanks very much

    Hello,
    yes I have tried it and it works in a my ADB but not in the real test enviorment. I have been using this expression:
    Calendar cal = Calendar.getInstance();
              System.out.println("La fecha es:\n Dia: "+cal.get(cal.DAY_OF_MONTH)+" Mes: "+(cal.get(cal.MONTH)+1)+" A�o: "+cal.get(cal.YEAR));
              System.out.println("La hora es: "+cal.get(cal.HOUR_OF_DAY)+" minutos: "+cal.get(cal.MINUTE));
    As you know this way shall be quite easier than accessing to the Tables but maybe I must access directly to the tables
    Thanks very much.

  • To export and import oracle 11g table data only

    Hi Gurus,
    Just not sure of the procedure to follow in the export just the table data and then truncate the table do some changes(not table structure changes ) and then import the same table data in to the relevent table .
    Could some please help me in the setps involved in it .
    Thanks a Lot in advance

    If you can use Data Pump, here are your commands:
    expdp table_owner/password directory=<your_directory> dumpfile=table_name.dmp tables=table_name content=data_only
    impdp table_owner/password directory=<your_directory> dumpfile=table_name.dmp tables=table_name table_exists_action=append
    Data Pump requires version 10.1 or later.
    Dean

  • Problem converting data in XML file to internal table data

    Hi all,
    I have a requirement. I need to convert an XML file to internal table data and based on that data do Goods Receipt in SAP.
    With the help of this blog /people/r.eijpe/blog/2005/11/10/xml-dom-processing-in-abap-part-i--convert-an-abap-table-into-xml-file-using-sap-dom-approach
    I am able to convert the XML file to data in SAP. But this blog will display the output on screen as ELELEMNT = nodename VALUE= value of that node.
    But I donu2019t want in that way, I want to store all the data in XML file in an internal table so that I can make use of those values and do Goods Recipt in SAP.
    Can some one suggest how should I read the data in an internal table.
    Here is my code..what changes should I make?
    *& Report  z_xit_xml_check
      REPORT  z_xit_xml_check.
      TYPE-POOLS: ixml.
      TYPES: BEGIN OF t_xml_line,
              data(256) TYPE x,
            END OF t_xml_line.
      DATA: l_ixml            TYPE REF TO if_ixml,
            l_streamfactory   TYPE REF TO if_ixml_stream_factory,
            l_parser          TYPE REF TO if_ixml_parser,
            l_istream         TYPE REF TO if_ixml_istream,
            l_document        TYPE REF TO if_ixml_document,
            l_node            TYPE REF TO if_ixml_node,
            l_xmldata         TYPE string.
      DATA: l_elem            TYPE REF TO if_ixml_element,
            l_root_node       TYPE REF TO if_ixml_node,
            l_next_node       TYPE REF TO if_ixml_node,
            l_name            TYPE string,
            l_iterator        TYPE REF TO if_ixml_node_iterator.
      DATA: l_xml_table       TYPE TABLE OF t_xml_line,
            l_xml_line        TYPE t_xml_line,
            l_xml_table_size  TYPE i.
      DATA: l_filename        TYPE string.
      PARAMETERS: pa_file TYPE char1024 DEFAULT 'c:\temp\orders_dtd.xml'.
    Validation of XML file: Only DTD included in xml document is supported
      PARAMETERS: pa_val  TYPE char1 AS CHECKBOX.
      START-OF-SELECTION.
      Creating the main iXML factory
        l_ixml = cl_ixml=>create( ).
      Creating a stream factory
        l_streamfactory = l_ixml->create_stream_factory( ).
        PERFORM get_xml_table CHANGING l_xml_table_size l_xml_table.
      wrap the table containing the file into a stream
        l_istream = l_streamfactory->create_istream_itable( table = l_xml_table
                                                        size  = l_xml_table_size ).
      Creating a document
        l_document = l_ixml->create_document( ).
      Create a Parser
        l_parser = l_ixml->create_parser( stream_factory = l_streamfactory
                                          istream        = l_istream
                                          document       = l_document ).
      Validate a document
        IF pa_val EQ 'X'.
          l_parser->set_validating( mode = if_ixml_parser=>co_validate ).
        ENDIF.
      Parse the stream
        IF l_parser->parse( ) NE 0.
          IF l_parser->num_errors( ) NE 0.
            DATA: parseerror TYPE REF TO if_ixml_parse_error,
                  str        TYPE string,
                  i          TYPE i,
                  count      TYPE i,
                  index      TYPE i.
            count = l_parser->num_errors( ).
            WRITE: count, ' parse errors have occured:'.
            index = 0.
            WHILE index < count.
              parseerror = l_parser->get_error( index = index ).
              i = parseerror->get_line( ).
              WRITE: 'line: ', i.
              i = parseerror->get_column( ).
              WRITE: 'column: ', i.
              str = parseerror->get_reason( ).
              WRITE: str.
              index = index + 1.
            ENDWHILE.
          ENDIF.
        ENDIF.
      Process the document
        IF l_parser->is_dom_generating( ) EQ 'X'.
          PERFORM process_dom USING l_document.
        ENDIF.
    *&      Form  get_xml_table
      FORM get_xml_table CHANGING l_xml_table_size TYPE i
                                  l_xml_table      TYPE STANDARD TABLE.
      Local variable declaration
        DATA: l_len      TYPE i,
              l_len2     TYPE i,
              l_tab      TYPE tsfixml,
              l_content  TYPE string,
              l_str1     TYPE string,
              c_conv     TYPE REF TO cl_abap_conv_in_ce,
              l_itab     TYPE TABLE OF string.
        l_filename = pa_file.
      upload a file from the client's workstation
        CALL METHOD cl_gui_frontend_services=>gui_upload
          EXPORTING
            filename   = l_filename
            filetype   = 'BIN'
          IMPORTING
            filelength = l_xml_table_size
          CHANGING
            data_tab   = l_xml_table
          EXCEPTIONS
            OTHERS     = 19.
        IF sy-subrc <> 0.
          MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                     WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        ENDIF.
      Writing the XML document to the screen
        CLEAR l_str1.
        LOOP AT l_xml_table INTO l_xml_line.
          c_conv = cl_abap_conv_in_ce=>create( input = l_xml_line-data replacement = space  ).
          c_conv->read( IMPORTING data = l_content len = l_len ).
          CONCATENATE l_str1 l_content INTO l_str1.
        ENDLOOP.
        l_str1 = l_str1+0(l_xml_table_size).
        SPLIT l_str1 AT cl_abap_char_utilities=>cr_lf INTO TABLE l_itab.
        WRITE: /.
        WRITE: /' XML File'.
        WRITE: /.
        LOOP AT l_itab INTO l_str1.
          REPLACE ALL OCCURRENCES OF cl_abap_char_utilities=>horizontal_tab IN
            l_str1 WITH space.
          WRITE: / l_str1.
        ENDLOOP.
        WRITE: /.
      ENDFORM.                    "get_xml_table
    *&      Form  process_dom
      FORM process_dom USING document TYPE REF TO if_ixml_document.
        DATA: node      TYPE REF TO if_ixml_node,
              iterator  TYPE REF TO if_ixml_node_iterator,
              nodemap   TYPE REF TO if_ixml_named_node_map,
              attr      TYPE REF TO if_ixml_node,
              name      TYPE string,
              prefix    TYPE string,
              value     TYPE string,
              indent    TYPE i,
              count     TYPE i,
              index     TYPE i.
        node ?= document.
        CHECK NOT node IS INITIAL.
        ULINE.
        WRITE: /.
        WRITE: /' DOM-TREE'.
        WRITE: /.
        IF node IS INITIAL. EXIT. ENDIF.
      create a node iterator
        iterator  = node->create_iterator( ).
      get current node
        node = iterator->get_next( ).
      loop over all nodes
        WHILE NOT node IS INITIAL.
          indent = node->get_height( ) * 2.
          indent = indent + 20.
          CASE node->get_type( ).
            WHEN if_ixml_node=>co_node_element.
            element node
              name    = node->get_name( ).
              nodemap = node->get_attributes( ).
              WRITE: / 'ELEMENT  :'.
              WRITE: AT indent name COLOR COL_POSITIVE INVERSE.
              IF NOT nodemap IS INITIAL.
              attributes
                count = nodemap->get_length( ).
                DO count TIMES.
                  index  = sy-index - 1.
                  attr   = nodemap->get_item( index ).
                  name   = attr->get_name( ).
                  prefix = attr->get_namespace_prefix( ).
                  value  = attr->get_value( ).
                  WRITE: / 'ATTRIBUTE:'.
                  WRITE: AT indent name  COLOR COL_HEADING INVERSE, '=',
                                   value COLOR COL_TOTAL   INVERSE.
                ENDDO.
              ENDIF.
            WHEN if_ixml_node=>co_node_text OR
                 if_ixml_node=>co_node_cdata_section.
            text node
              value  = node->get_value( ).
              WRITE: / 'VALUE     :'.
              WRITE: AT indent value COLOR COL_GROUP INVERSE.
          ENDCASE.
        advance to next node
          node = iterator->get_next( ).
        ENDWHILE.
      ENDFORM.                    "process_dom
    Any help would be highly apperciated.
    regards,
    Jessica Sam

    Pavel Vera,
    With your example i tries doing the following .....
    I tried  to convert the data of XML file to internal table data. I am collecting the data in internal table to do goos recipt with that data.
    Please find my XML file, ABAP pgm and XSLT pgm . I donu2019t know what I am missing I am not getting any output. I donu2019t know what is wrong please help me with this
    Below is my XML file, My code and XSLT Program. In the below XML file I need to collect Vendor Number, Order Number, and Date tags which occur only once for one XML file.
    I also need to collect the following tags from <Shipmentdetail>
    <Shipmentdetail> has following child nodes and I need to collect them
    TrackingNumber
    Freight
    Weight
    ShipmentDate
    ShipmentMethod
    Need to collect to collect the following tags from <ProductInformation>
    <ProductInformation> has following child nodes and I need to collect them
        LineNumber
        SKUNumber
        OrderedQuantity
        ShippedQuantity
        UOM
    The <Shipmentdetail> and <ProductInformation> are child nodes of <OrderShipment>
    The <Shipmentdetail> occurs only ones but the <ProductInformation> can occur once or many times and will be dynamic and differs depening on the input file.
    My XML file is as follows
    <?xml version="1.0" encoding="iso-8859-1" ?>
    - <ShipmentHeader>
      <AccountID />
    - <OrderShipment>
          <VendorNumber>1000</VendorNumber>
          <OrderNumber>P00009238</OrderNumber>
          <OrderType>Stock</OrderType>
          <Company />
          <Division />
         <Department />
         <Date>20061120</Date>
         <CartonCount>2</CartonCount>
         <ShipAllProducts>No</ShipAllProducts>
    -             <ShipmentDetail>
                      <TrackingNumber>1ZR3W891PG47477811</TrackingNumber>
                      <Freight>000000010000</Freight>
                      <ShipmentDate>20061120</ShipmentDate>
                      <ShipmentMethod>UPS1PS</ShipmentMethod>
                 </ShipmentDetail>
    -            <ProductInformation>
                     <LineNumber>000000001</LineNumber>
                     <SKUNumber>110FR</SKUNumber>
                     <AdvSKUNumber>003 4518</AdvSKUNumber>
                     <SKUID />
                     <OrderedQuantity>00000001000000</OrderedQuantity>
                     <ShippedQuantity>00000001000000</ShippedQuantity>
                     <UOM>EA</UOM>
                     <Factor>1</Factor>
                </ProductInformation>
    -           <ProductInformation>
                    <LineNumber>000000002</LineNumber>
                    <SKUNumber>938EN</SKUNumber>
                    <AdvSKUNumber>001 7294</AdvSKUNumber>
                    <SKUID />
                    <OrderedQuantity>00000000450000</OrderedQuantity>
                    <ShippedQuantity>00000000450000</ShippedQuantity>
                    <UOM>EA</UOM>
                    <Factor>1</Factor>
                </ProductInformation>
    -           <CaseInformation>
                   <LineNumber>000000001</LineNumber>
                   <SKUNumber>110FR</SKUNumber>
                   <AdvSKUNumber>003 4518</AdvSKUNumber>
                   <SKUID />
                   <SSCCNumber>00000001668000002487</SSCCNumber>
                   <CaseQuantity>00000001000000</CaseQuantity>
                   <UOM>EA</UOM>
                   <Factor>1</Factor>
                 </CaseInformation>
                 <CaseInformation>
                   <LineNumber>000000001</LineNumber>
                   <SKUNumber>110FR</SKUNumber>
                   <AdvSKUNumber>003 4518</AdvSKUNumber>
                   <SKUID />
                   <SSCCNumber>00000001668000002487</SSCCNumber>
                   <CaseQuantity>00000001000000</CaseQuantity>
                   <UOM>EA</UOM>
                   <Factor>1</Factor>
                 </CaseInformation>
    -  </OrderShipment>
      </ShipmentHeader>
    My Program
    TYPE-POOLS abap.
    CONSTANTS gs_file TYPE string VALUE 'C:\temp\test.xml'.
    * This is the structure for the data from the XML file
    TYPES: BEGIN OF ts_shipment,
             VendorNumber(10)     TYPE n,
             OrderNumber(20)      TYPE n,
             OrderType(8)         TYPE c,
             Date(8)              TYPE c,
           END OF ts_shipment.
    TYPES: BEGIN OF ts_shipmentdetail,
             TrackingNumber(30)     TYPE n,
             Freight(12)            TYPE n,
             Weight(14)             TYPE n,
             ShipmentDate(8)        TYPE c,
             ShipmentMethod(8)      TYPE c,
             END OF ts_shipmentdetail.
    TYPES: BEGIN OF ts_productinformation,
             LineNumber(9)          TYPE n,
             SKUNumber(20)          TYPE c,
             OrderedQuantity(14)    TYPE n,
             ShippedQuantity(14)    TYPE n,
             UOM(4)                 TYPE c,
             END OF ts_productinformation.
    * Table for the XML content
    DATA: gt_itab       TYPE STANDARD TABLE OF char2048.
    * Table and work ares for the data from the XML file
    DATA: gt_shipment               TYPE STANDARD TABLE OF ts_shipment,
          gs_shipment               TYPE ts_shipment.
    DATA: gt_shipmentdetail         TYPE STANDARD TABLE OF ts_shipmentdetail,
          gs_shipmentdetail         TYPE ts_shipmentdetail.
    DATA: gt_productinformation     TYPE STANDARD TABLE OF ts_productinformation,
          gs_productinformation     TYPE ts_productinformation.
    * Result table that contains references
    * of the internal tables to be filled
    DATA: gt_result_xml TYPE abap_trans_resbind_tab,
          gs_result_xml TYPE abap_trans_resbind.
    * For error handling
    DATA: gs_rif_ex     TYPE REF TO cx_root,
          gs_var_text   TYPE string.
    * Get the XML file from your client
    CALL METHOD cl_gui_frontend_services=>gui_upload
      EXPORTING
        filename                = gs_file
      CHANGING
        data_tab                = gt_itab
      EXCEPTIONS
        file_open_error         = 1
        file_read_error         = 2
        no_batch                = 3
        gui_refuse_filetransfer = 4
        invalid_type            = 5
        no_authority            = 6
        unknown_error           = 7
        bad_data_format         = 8
        header_not_allowed      = 9
        separator_not_allowed   = 10
        header_too_long         = 11
        unknown_dp_error        = 12
        access_denied           = 13
        dp_out_of_memory        = 14
        disk_full               = 15
        dp_timeout              = 16
        not_supported_by_gui    = 17
        error_no_gui            = 18
        OTHERS                  = 19.
    IF sy-subrc <> 0.
      MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
              WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    * Fill the result table with a reference to the data table.
    * Within the XSLT stylesheet, the data table can be accessed with
    * "ISHIPMENT".
    GET REFERENCE OF gt_shipment INTO gs_result_xml-value.
    gs_result_xml-name = 'ISHIPMENT'.
    APPEND gs_result_xml TO gt_result_xml.
    * Fill the result table with a reference to the data table.
    * Within the XSLT stylesheet, the data table can be accessed with
    * "ISHIPDET".
    GET REFERENCE OF gt_shipmentdetail INTO gs_result_xml-value.
    gs_result_xml-name = 'ISHIPDET'.
    APPEND gs_result_xml TO gt_result_xml.
    * Fill the result table with a reference to the data table.
    * Within the XSLT stylesheet, the data table can be accessed with
    * "IPRODDET".
    GET REFERENCE OF gt_productinformation  INTO gs_result_xml-value.
    gs_result_xml-name = 'IPRODDET'.
    APPEND gs_result_xml TO gt_result_xml.
    * Perform the XSLT stylesheet
    TRY.
        CALL TRANSFORMATION z_xml_to_abap3
        SOURCE XML gt_itab
        RESULT (gt_result_xml).
      CATCH cx_root INTO gs_rif_ex.
        gs_var_text = gs_rif_ex->get_text( ).
        MESSAGE gs_var_text TYPE 'E'.
    ENDTRY.
    * Writing the data from file for gt_shipment
    *Collecting the Shipping Data from the XML file to internal table gt_shipment
    *and writing the data to the screen
    LOOP AT gt_shipment INTO gs_shipment.
      WRITE: / 'VendorNumber:', gs_shipment-VendorNumber.
      WRITE: / 'OrderNumber :', gs_shipment-OrderNumber.
      WRITE: / 'OrderType  :', gs_shipment-OrderType.
      WRITE: / 'Date  :',      gs_shipment-Date.
      WRITE : /.
    ENDLOOP. "gt_shipment.
    LOOP AT gt_shipmentdetail INTO gs_shipmentdetail.
      WRITE: / 'TrackingNumber:',     gs_shipmentdetail-TrackingNumber.
      WRITE: / 'Freight :',           gs_shipmentdetail-Freight.
      WRITE: / 'Weight  :',           gs_shipmentdetail-Weight.
      WRITE: / 'ShipmentDate  :',     gs_shipmentdetail-ShipmentDate.
    * WRITE: / 'ShipmentMethod  :'    gs_shipmentdetail-ShipmentMethod
      WRITE : /.
    ENDLOOP. "gt_shipmentdetail.
    LOOP AT gt_productinformation INTO gs_productinformation.
      WRITE: / 'LineNumber:',         gs_productinformation-LineNumber.
      WRITE: / 'SKUNumber :',         gs_productinformation-SKUNumber.
      WRITE: / 'OrderedQuantity  :',  gs_productinformation-OrderedQuantity.
      WRITE: / 'ShippedQuantity  :',  gs_productinformation-ShippedQuantity.
      WRITE: / 'UOM  :',              gs_productinformation-UOM.
      WRITE : /.
    ENDLOOP. "gt_productinformation.
    XSLT Program
    <xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
      <xsl:output encoding="iso-8859-1" indent="yes" method="xml" version="1.0"/>
      <xsl:strip-space elements="*"/>
      <xsl:template match="/">
        <asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
          <asx:values>
            <ISHIPMENT>
              <xsl:apply-templates select="//OrderShipment"/>
            </ISHIPMENT>
          </asx:values>
        </asx:abap>
      </xsl:template>
      <xsl:template match="OrderShipment">
        <item>
          <VENDORNUMBER>
            <xsl:value-of select="VendorNumber"/>
          </VENDORNUMBER>
          <ORDERNUMBER>
            <xsl:value-of select="OrderNumber"/>
          </ORDERNUMBER>
          <ORDERTYPE>
            <xsl:value-of select="OrderType"/>
          </ORDERTYPE>
          <DATE>
            <xsl:value-of select="Date"/>
          </DATE>
        </item>
      </xsl:template>
      <xsl:template match="/">
        <asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
          <asx:values>
            <ISHIPDET>
              <xsl:apply-templates select="//OrderShipment/ShipmentDetail"/>
            </ISHIPDET>
          </asx:values>
        </asx:abap>
      </xsl:template>
      <xsl:template match="ShipmentDetail">
        <item>
          <TRACKINGNUMBER>
            <xsl:value-of select="TrackingNumber"/>
          </TRACKINGNUMBER>
          <FREIGHT>
            <xsl:value-of select="Freight"/>
          </FREIGHT>
          <SHIPMENTDATE>
            <xsl:value-of select="ShipmentDate"/>
          </SHIPMENTDATE>
          <SHIPMENTMETHOD>
            <xsl:value-of select="ShipmentMethod"/>
          </SHIPMENTMETHOD>
        </item>
      </xsl:template>
    </xsl:transform> .
    Any help is highly appreciated. If anyone encountered this situation before please let me know where i am going wrong in my XSLT transformation.
    Any Help will be highly apppreciated. Thanks in advance
    Regards,
    Jessica   Sam

Maybe you are looking for