How to pass the table name dynamically in xml parsing

Hi All,
I have created one procedure for parsing xml file which is working perfectly.
FORALL i IN t_tab.first .. t_tab.last
         INSERT INTO Test_AP VALUES t_tab(i);Now I want to put the table name dynamically+. For that I have added one query and modify above code as follow:-
I have already declare dml_str varchar2(800) in declaration part.
Query is as follows:-
select table_name into tab_name from VERSION_DETAILS where SUBVERSION_NO=abc;  -- here abc is variable name which contains values.
FORALL i IN t_tab.first .. t_tab.last
          dml_str := 'INSERT INTO ' || tab_name || ' values :vals';
          EXECUTE IMMEDIATE dml_str USING t_tab(i);But it's not working. How I will resolve this or through which way I achieved the intended results. Anyone can guide me on this matter.
Thanks in advance for your help...

Hi,
But it's not working.Don't you think it would help to give the error message?
Put the assignment before FORALL.
FORALL only accepts one subsequent DML statement (static or dynamic SQL) :
dml_str := 'INSERT INTO ' || tab_name || ' values :vals';
FORALL i IN t_tab.first .. t_tab.last          
EXECUTE IMMEDIATE dml_str USING t_tab(i);

Similar Messages

  • How to get the table name in the trigger definition without hard coding.

    CREATE  TRIGGER db.mytablename
    AFTER UPDATE,INSERT
    AS
        INSERT INTO table1(col1)
        SELECT InsRec.col1   
        FROM
        INSERTED Ins
       --Below i am calling one sp for which i have to pass the table name
       EXEC myspname 'tablename'
      In the above trigger,presently i am hard coding the tablename
      but is it possible to get the table name dynamically on which the trigger is defined in order to avoid hard coding the table name

    I really liked your audit table concept.  You inspired me to modify it so that, the entire recordset gets captured and added a couple of other fields.  Wanted to share my end result.
    USE [YourDB]
    GO
    /****** Object: Trigger [dbo].[iudt_AutoAuditChanges] Script Date: 10/18/2013 12:49:55 ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    ALTER TRIGGER [dbo].[iudt_AutoAuditChanges]
    ON [dbo].[YourTable]
    AFTER INSERT,DELETE,UPDATE
    AS
    BEGIN
    SET NOCOUNT ON;
    Declare @v_AuditID bigint
    IF OBJECT_ID('dbo.AutoAudit','U') IS NULL BEGIN
    CREATE TABLE [dbo].[AutoAudit]
    ( [AuditID] bigint identity,
    [AuditDate] DateTime,
    [AuditUserName] varchar(128),
    [TableName] varchar(128) NULL,
    [OldContent] XML NULL,
    [NewContent] XML NULL
    ALTER TABLE dbo.AutoAudit ADD CONSTRAINT
    PK_AutoAudit PRIMARY KEY CLUSTERED
    [AuditID]
    ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    CREATE NONCLUSTERED INDEX [idx_AutoAudit_TableName_AuditDate] ON [dbo].[AutoAudit]
    ( [TableName] ASC,
    [AuditDate] ASC
    )WITH (STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    END
    Select * Into #AuditDeleted from deleted
    Select * Into #AuditInserted from inserted
    While (Select COUNT(*) from #AuditDeleted) > 0 OR (Select COUNT(*) from #AuditInserted) > 0
    Begin
    INSERT INTO [dbo].[AutoAudit]
    ( [AuditDate], [AuditUserName], [TableName], [OldContent], [NewContent])
    SELECT
    GETDATE(),
    SUSER_NAME(),
    [TableName]=object_name([parent_obj]),
    [OldContent]=CAST((SELECT TOP 1 * FROM #AuditDeleted D FOR XML RAW) AS XML),
    [NewContent]=CAST((SELECT TOP 1 * FROM #AuditInserted I FOR XML RAW) AS XML)
    FROM sysobjects
    WHERE
    [xtype] = 'tr'
    and [name] = OBJECT_NAME(@@PROCID)
    Set @v_AuditID = SCOPE_IDENTITY()
    Delete from AutoAudit
    Where AuditID = @v_AuditID
    AND Convert(varchar(max),oldContent) = Convert(varchar(max),NewContent)
    Delete top(1) from #AuditDeleted
    Delete top(1) from #AuditInserted
    End
    END

  • How to see the Table Names & Field Names by other than F1 help

    Hi Experts
       How to see the Table Names & Field Names by other than F1 help, & How to see the List of MM Table Names.
    Rgds

    The only option to see the active table/ field name is through F1 --> Technical Information. Apart from this, you can use any 3rd part application like GUIex (INbuilt in SAP ECC 6.0 ... can be activated by clicking on the tri-color button on the top right), but you need technical knowledge to understand the information. As far consolidated list of MM tables is concerned, SAP don;t provide you the same at one place, it experience and knowledge which help you in this regard. For your immediate reference MM tables are as under :
    EBAN  - Purchase Requisition 
    EBKN  - Purchase Requisition Account Assignment 
    EBUB   - Index for Stock Transport Requisitions for Materi
    EINA    - Purchasing Info Record: General Data 
    EINE     - Purchasing Info Record: Purchasing Organization D
    EIPA     - Order Price History: Info Record 
    EKAB   - Release Documentation 
    EKAN   - Vendor Address: Purchasing Document 
    EKBE    - History per Purchasing Document 
    EKBEH - Removed PO History Records 
    EKBZ    - History per Purchasing Document: Delivery Costs 
    EKBZH  - History per Purchasing Document: Delivery Costs 
    EKEH    - Scheduling Agreement Release Documentation 
    EKEK    - Header Data for Scheduling Agreement Releases 
    EKES     - Vendor Confirmations 
    EKET     - Scheduling Agreement Schedule Lines 
    EKETH   - Scheduling Agreement Schedules: History Tables 
    EKKI      - Purchasing Condition Index 
    EKKN    - Account Assignment in Purchasing Document 
    EKKO    - Purchasing Document Header 
    EKPA     - Partner Roles in Purchasing 
    EKPB     - "Material Provided" Item in Purchasing Document 
    EKPO    - Purchasing Document Item 
    EKPV    - Shipping-Specific Data on Stock Tfr. for Purch. D 
    EKRS    - ERS Procedure: Goods (Merchandise) Movements to b 
    EKUB    - Index for Stock Transport Orders for Material 
    EORD    - Purchasing Source List 
    EQUK    - Quota File: Header

  • How to know the table name of an InfoCub if we know cube technical name?

    How to know the table name of an ODS if we know the ODS technical name?
    Thanks
    Message was edited by: Kevin Smith

    hi kevin
    if the ODS is a standard ODS then you check the following way in SE16
    (for custom ODS objects)
    /BIC/A<ODS technical name>00 (Active Data Table)
    /BIC/A<ODS technical name>40  (Activation Queue)
    /BIC/B<10 digit number> (Change Log Table)
    (for SAP defined ODS Objects)
    /BI0/A<ODS technical name>00 (Active Data Table)
    /BI0/A<ODS technical name>40  (Activation Queue)
    /BI0/B<10 digit number> (Change Log Table)
    and for Transactional ODS Object you will have only the active data Table. So you need to check with /BIC/A<ODS technical name>00 for the custom ODS objects and /BI0/A<ODS technical name>00 for SAP defined ODS objects.
    hope this helps.
    regards
    vijaykumar

  • How to include the file name as an XML field

    Hi,
    I'm using a file adapter for process a flat file and convert it into an XML. Does anybody knows how to include the file name into an XML field.
    Ex.
    I process the file named <b>XXIMN21022007.txt</b> and I need an XML like:
    <MT_FILE>
    <field1></field1>
    <field2></field2>
    <field3></field3>
    <filename><b>XXIMN21022007.txt</b></filename>
    </MT_FILE>
    Regards
    Gonzalo

    Just go for dynamic configuration.
    Check the sender file adapter to write the filename in the header (as explained in Michal's blog) and then read that header in some mapping.
    U can use that even in simple message mappings.
    http://help.sap.com/saphelp_nw2004s/helpdata/en/43/03612cdecc6e76e10000000a422035/frameset.htm
    Your code for the filename tag would be something like:
    <i>DynamicConfiguration conf = (DynamicConfiguration) container
        .getTransformationParameters()
        .get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
    DynamicConfigurationKey key = DynamicConfigurationKey.create(
        “http://sap.com/xi/XI/System/File”,
        “FileName”);
    return conf.get(key);</i>
    Regards,
    Henrique.

  • How to pass the feild names of a select query dynamically?

    Hi
    How can we pass the feilds names in select query dynamically?
    For example in my selection screen i wil be giving the table name, and feilds in that table.....
    those feilds should be taken in my select query...
    instead of
    PARAMETERS : tab_name TYPE ddobjname .
      SELECT *
        FROM (tab_name)
        INTO TABLE <newtab>
       UP TO 25 ROWS.
    parametrs : feild1 like-------
                     feild2----
    i need select feild1 feild2 feild3    FROM (tab_name)
        INTO TABLE <newtab>
       UP TO 25 ROWS.

    by the way, contrary to popular belief there is no performance problem when using
    SELECT * FROM dbtab INTO CORRESPONDING FIELDS OF TABLE itab WHERE ...
    as long as the structure of itab contains only the required fields.
    I ran some benchmarks against this and above construct is maybe 0.1% slower (Oracle 10g) than a
    SELECT f1 f2 f3 f4 ... FROM dbtab INTO TABLE itab WHERE ...
    but is saves you from maintaining a potentially very long field list in your code. So when you need additional fields later on, you just add them to the DDIC structure or type definition and that's it.
    Maybe something you want to factor in here.
    Cheers
    Thomas

  • How to configure the schema name dynamically based on user input.

    configure the schema name dynamically based on user input.
    For ex:
    We have two schemas:
    Schema1  - base schema having 15 tables.
    Schema2 -  tables which is specific to modules. Having only 10 tables which is also available in Schema1
    Login to application using Schema 1
    Access a particlular module and select the country. Here country selection is identified.
    Based on the country selection, we need to connect the schema respectively.
    If the user selects France --> It should connect Schema1
    If the user selects Germeny --> It should connect schema2.
    Used: Eclipselink

    You may want to have a different persistence unit for each country, then you just need to switch persistence units, and can put the schema in your orm.xml file.
    You may also want to investigate EclipseLink multi-tenant support,
    http://www.eclipse.org/eclipselink/documentation/2.5/jpa/extensions/a_multitenant.htm
    You can the schema in a persistence unit in code using a SessionCustomizer and the tableQualifier.

  • How to get the table name and bind columns names in an INSERT statement ?

    I have an INSERT statement with input parameters (for example
    INSERT INTO my_table VALUES (:a, :a, :a)) and I want to know
    without parsing the statement which is the name of table to
    insert to and the corresponding columns.
    This is needed to generate the SELECT FOR UPDATE statement to
    refetch a BLOB before actually writing to it. The code does not
    know in advance the schema (generic code).
    Thanks in advance,
    Joseph Canedo

    Once you have prepared your statement, you can execute the
    statement with the OCI_DESCRIBE_ONLY mode before binding any
    columns. Then you can use OCIParamGet to find out about each
    column (column index is 1-based). You should get OCI_NO_DATA or
    ORA-24334 if there are no more columns in the statement. Note
    that the parameter descriptor from OCIParamGet is
    allocated/freed internally by OCI; you do not need to manage it
    explicitly. The parameter descriptor is passed to OCIAttrGet in
    order to obtain for instance the maximum size of data in the
    column OCI_ATTR_DATA_SIZE. You can also get the column name in
    this way, although I do not remember the #define off the top of
    my head. Getting the table name appears to be much more
    difficult; I have never had to do that yet. Good luck. -Ralph

  • How to get the table name of a field in a result set

    hi!
    i have a simple sql query as
    select tbl_customerRegistration.*, tbl_customerAddress.address from tbl_customerRegistration, tbl_customerAddress where tbl_customerAddress.customer_id = tbl_customerRegistration.customer_ID
    this query executes well and gets data from the database when i get ResultsetMetaData from my result set (having result of above query) i am able to get the field name as
    ResultSetMetaData rsmd = rs.getMetaData();//rs is result set
    String columnName = rsmd.getColumnName(1);
    here i get columnName = "Customer_id"
    but when i try to get the tabel name from meta data as
    String tableName = rsmd.getTableName(1); i get empty string in table name....
    i want to get the table name of the respective field here as it is very important to my logic.....
    how can i do that.....
    please help me in that regard as it is very urgent
    thanks in advance
    sajjad ahmed paracha
    you may also see the discussion on following link
    http://forum.java.sun.com/thread.jspa?threadID=610200&tstart=0

    So far as I'm aware, you can't get metadata information about the underlying tables in a query from Oracle and/or the Oracle drivers. I suspect, in fact, that the driver would have to have its own SQL parser to get this sort of information.
    I'm curious though-- how do you have application logic that depends on the name of the source table but not know in the application what table is involved? Could you do something "cheesy" like
    SELECT 'tbl_customerRegistration' AS tbl1_name,
           tbl_customerRegistration.*
    ...Justin
    Distributed Database Consulting, Inc.
    http://www.ddbcinc.com/askDDBC

  • How to find the tables name in R3 datasource

    I am looking to find out the tables were used for that Datasources(0m_cc0_9). Pls let me know the steps to find out thsi.
    Thanks
    Taj

    Hi Tamkris
    1. First go to help.sap.com and simply search for the datasource. You would come to a page where detailed description of the datasource is given.Just note that SAP sometimes plays spoilsport and for few Datassources it doesnt give the table names. But in your case for 0CO_OM_CCA_9, details are given.
    2. If in some cases table names are not given, simply go to rsa3. open another session ST05. Activate the trace.In Rsa3, enter the datasource name. And then run extraction. Go to ST05 switch off the trace and then view the log.
    In the log, all tables that are hit are shown
    3. And if all this doesnt help, start debugging the datasource. TYpically these would be function module based. So dig in!
    Hope this info helps
    Prakash
    Assigning points is a way of saying thanks on SDN!

  • Can we pass IT table name dynamically to READ and SORT stmt

    Hello All,
      i have a requirement in which i am passing table name using a variable and want to read the same table: so my question is can we execute read and sort stmt with dynamic IT name. please see below for explaination.
    v_itname = <it_2>.
    now read using variable
    READ table ( v_itname ) with key <field>.
    and
    SORT ( v_itname ) by (otab).
    thanks
    Mani

    Hi ,
    This can be done. Please refer to the  codes below. Please note that the code will work if the itabs are of type standard table else it may dump.
    You just need to replace the variables form the values from your internal table.
    DATA: v_table1(10) TYPE c VALUE 'I_MARA',
          v_field(10)  TYPE c VALUE 'MATNR',
          i_mara TYPE STANDARD TABLE OF mara.
    FIELD-SYMBOLS : <fs_tab>   TYPE STANDARD TABLE,
                    <fs_field> TYPE ANY.
    DATA: otab TYPE abap_sortorder_tab,
    oline TYPE abap_sortorder.
    SELECT * UP TO 10 ROWS
      FROM  mara
      INTO TABLE i_mara.
    IF sy-subrc = 0.
      ASSIGN (v_table1) TO <fs_tab>.
      IF sy-subrc = 0.
        oline-name = v_field.
        APPEND oline TO otab.
        SORT <fs_tab> BY (otab).
        READ TABLE <fs_tab>
        WITH KEY (v_field) = '000000000020000989' "
        BINARY SEARCH
        TRANSPORTING NO FIELDS.
        IF sy-subrc = 0.
        ENDIF.
      ENDIF.
    ENDIF.
    Regards,
    Dev.

  • How to know the table names n field names 2

    hi,
    with the use of the below fileds
    Vendor number, material number, PO number, Purchasing group/Buyer, PO creation date, PO delivery date, PO created by
    I should get the out put with the fields....
    PO, PO date, PO group/buyer, purchasing org, vendor, PO line, order quantity, Unit, Material, Description, ST LOC SHELF BIN, ST LOCBULK BIN, QTY TO BE RECV, QTY  RECEVED.
    Can anyone let me know  the corresponding fields and tables based upon the input fields
    SRI

    Hi,
    1.   press F1 functional key on the field you required
    2. Click on the technical information button which will be beside the book button
    3. Then Double click on the field name
    4. IF the display one is a structure then double click on the data type
    5. Now you are in Domain of the field name.. keep a cursor on the domain
        and  choose the where used list (with arrows)
    6. As MIGO transaction is related to the GOODS receipt..
        check one among the following tables:
        1. MKPF,
        2. MSEG,
        3. EKBE
        4. MVER
        5. SO31
        6 SO13
        7. SO 11.
    Award points if it is helpful
    Br,
    Laxmi

  • How to change the table name

    hi
    instead of copying and renaming
    is there any other way to change the ztable name .
    I have wrong named the table and activated now i need to
    change the table table from ztest to zvk01
    thanks

    these r the steps to change table  name ..
    goto se11 tcode.
    give ur oldtable.
    goto top of the se11 ->goto dictionary objects ->copy->
    give from table name to table name .
    And the copy of ur table will be new table name ..
    And to delete oldtable name.
    goto se80->goto ur package ->select datadictionary ->select the old table name ->rt click ->delete.
    I think its some what useful.

  • How to know the table names n field names

    hello Experts,
    can anyone let me the corresponding field names and table names plz....
    Vendor number, material number, PO number, Purchasing group/Buyer, PO creation date, PO delivery date, PO created by...
    Please can one shed some light on it...
    SRI

    hi
      material number - matnr - mara
    vendor number - lifnr  - ekko
      PO number- vbeln - ekko
      Purchasing
    > group/Buyer -   ekgrp - ekko
    PO creation date - aedat -ekko
    PO created by  - ernam - ekko
    we get details regarding the details of vendors or customers in the header data table
    and regarding the item in item data tables...here ekko is the header table for purchase order details.....
    hope this helps
    > hello Experts,
    >
    > can anyone let me the corresponding field names and
    > table names plz....
    >
    > Vendor number, material number, PO number, Purchasing
    > group/Buyer, PO creation date, PO delivery date, PO
    > created by...
    >
    > Please can one shed some light on it...
    >
    > SRI

  • How to change the Table name during the Run Time

    Hi
    I have to generate a Oracle Developer/2000 report.
    The input paramater is Vendor ( Ex:- Aetna,Cigna,BCBS...)
    If the input paramater is Aetna then the table report should use is Aetna_Emp_Data or
    If the input is Cigna then The table is Cigna_Emp_Data.
    The Layout and fileds selected for the report remains the same.
    Please let me know !
    Regards
    Kiran Ravuri
    Workscape

    Why don't you check with you co-worker Goran he has done this.

Maybe you are looking for

  • Problem with iTunes and iTouch.

    Hello, I have my iPod Chromatic Nano which appears to work fine with iTunes, but as soon as I insert my iPod Touch, within seconds I get the blue screen, having to reboot my computer, I've tried reinstalling my iTunes yet it still doesn't fix the pro

  • Baseline Date Change

    Hi Experts, While doing MIRO, , the baseline date will be default as document date based on Payment Terms. But in my case, both invoice date and base line date is different. I assure that baseline date will set as default invoice date and it was chan

  • Since updating ios8 I can't synchronise the music from my mac, any ideas?

    Since updating ios8 I can't synchronise the music from my mac, any ideas?

  • Feature request : Crossfade when skipping to next song ...

    Hello, Is there any feature request area for iTunes ? I really love the program and think it is great. I would like to request implementation of crossfading between songs when hitting the next song button. This is the only reason I still have to use

  • Simple blank page/insert

    How do i inset just a blank page at the end of my project movie, just simply to put wordings such as 'thanks for listening etc' for example at the end of this video: http://www.youtube.com/watch?v=2VF4nh7hEeg