How to dynamic set table names
In our application, the table name can be set at runtime by the customer. So is there a way in Toplink JPA to set table name at runtime (thru annotation or orm.xml) or programatically? Thanks.
Our application will host several domains at once. Each domain will get its own set of database tables for each module it uses. We keep them seperate by using a unique prefix. An example would be domainA.com's blog post table would be called domainA_blogPost, while domainB.com's will be domainB_blogPost. Both tables are the same, except for the name. The name needs to be specified at runtime since the central service controller tells the rest of the application which domain it is servicing and thus which set of tables to use. We will be adding domains dynamically all the time and we can't afford to create new entity sets and recompile the back end for every domain we add. I have been looking at the API and wonder if this is as simple as implementing a solution in our application, or am I going to have to tweek the implementation of toplink?
Similar Messages
-
How to dynamically set column name in Answers
Hi.
How to dynamically set column name in Answers, for example I want to put presentation variable in column header. Is this possible?
Regards,
Goran Ocko
http://108obiee.blogspot.com/May be a rude way .. but it works.
Add narrative view and use Java script to change the column headings based on the variables.
<script language="javascript" type="text/javascript">
var a = document.getElementById('idResultsTableParent');
var rows= a.getElementsByTagName('tr');
rows[1].cells[1].innerText ="@{Presentation Variable}";
</script>
Editing the same post to remove irrelevant information.
- Girish -
How to dynamically set the name of the generated PDF file sent by email
Hello,
I am using Reports 10g and I managed to send PDF reports by email, specifying the recipient, subject, format etc, using the reports servlet URL.
But there is one thing that I cannot find a way to do: I want to dynamically set the name of the attached file. It defaults to the name of the RDF file (eg monthly_sales.pdf). I would like it to be something more meaningful (eg monthly_sales_072010.pdf, where 072010 is the month and year passed by parameters).
Is it possible to do it?
Thanks
LuisUse System.load(...) instead of System.loadLibrary(...).
-
Hi,
I need to know how get a source table name. I need to get a source table name and do some transformation. I am adding the step in IKM to do this and therefore need source table name in there.
<%=odiRef.getSrcTablesList("","[RES_NAME]","","")%> gives work table name (C$_0XXXXX) whereas actual source table name is expected.
Could someone please help?
Thanks.Hi,
May i add a point?
In IKM level, if u use this API it will always return u C$ table name only since for IKM C$ is the source. You need to capture and use this API in LKM level.
In LKM add a step in Command on target and technology as Jython and try the below code.
mySourceTable= '<%=odiRef.getSrcTablesList("", "[RES_NAME]", ", ", "")%>'
And later in IKM use this variable for ur transformation.
Thanks,
Guru -
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.
RgdsThe 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 setting iview name to use multi language(ex, english,japan)?
how to know setting iview name to use multi language(ex, english,japan)?
We want use multi language when create iview.
ivew name english version
ivew name japan version
ivew name korean versionHi Joohyun,
you can translate the PCD objects (like iViews etc) with the portal's translation mechansim, see http://help.sap.com/saphelp_erp2004/helpdata/en/74/641640b7b6dd5fe10000000a155106/frameset.htm
Hope it helps
Detlev
PS: Please consider rewarding points for helpful answers on SDN. Thanks in advance! -
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 Smithhi 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 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); -
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=0So 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 -
Dynamic physical table name vs. Cache
Hello, Experts!
I'm facing quite an interesting problem. I have two physical tables with the same structure but with a different data. Requirement is to show same reports with one or another table. Idea is to have dynamically changed physical table name with session variable usage. Session variable can be change in UI so it was working until cache was turned on. When cache is turned on logical statements sent to OBI backend are the same even for different values of session variable that stores physical table name. Once cache is populated every users will get values from cache. This is possible source of discrepancy because some users might run reports with tableA values and some with tableB values.
Are there any options to set OBI to use data related to proper physical table name (i.e. accordingly to session variable value)? Model clone is not an option because it will be way to hard and complex to maintain both, beside same reports need to work sometimes with one table name and sometimes with other...
PS. Cache is set to be common for all users.
Lucasthank you, I've found another way to make it running. In fact there are two ways of doing it: filter LTS and have all data filtered from single table with session variable or use fragmentation content also with session variable.
Now tricky part is to set variable from UI, currently I'm using issue raw sql: call NQSSetSessionValue( 'String SV_SIGNOFF=aaa;' ) but I have to figure out how to change session non system variable value without need of administrator user rights.
There is GoURL method, but it's not working...
2. Add In ORACLE_HOME/bifoundation/web/display/authenticationschemas.xml
<RequestVariable source="url" type="informational" nameInSource="lang"
biVariableName="NQ_SESSION.LOCALE" />
inside the top <AuthenticationSchemaGroup> </AuthenticationSchemaGroup> tag -
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 nameI 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 get source table name according to target table
hi all
another question:
once a map was created and deployed,the corresponding information was stored in the repository and rtr repository.My question is how to find the source table name according to the target table,and in which table these records are recorded.
somebody help me plz!!
thanks a lot!This is a query that will get you the operators in a mapping. To get source and targets you will need some additional information but this should get you started:
set pages 999
col PROJECT format a20
col MODULE format a20
col MAPPING format a25
col OPERATOR format a20
col OP_TYPE format a15
select mod.project_name PROJECT
, map.information_system_name MODULE
, map.map_name MAPPING
, cmp.map_component_name OPERATOR
, cmp.operator_type OP_TYPE
from all_iv_xform_maps map
, all_iv_modules mod
, all_iv_xform_map_components cmp
where mod.information_system_id = map.information_system_id
and map.map_id = cmp.map_id
and mod.project_name = '&Project'
order by 1,2,3
Jean-Pierre -
How to use a table name in the select statement using a variable?
Hi Everybody,
I got a internal table which has a field or a variable that gets me some tables names. Now I need to retrieve the data from all these tables in that field dynamically at runtime. So could you suggest me a way out to use the select query which uses this variable as a table ?
Regards,
Mallik.Hi all,
Actually i need some more clarification. How to use the same select statement, if i've to use the tabname in the where clause too?
for ex : select * from (tab_name) where....?
Can we do inner join on such select statements? If so how?
Thanks & Regards,
Mallik. -
How To Find Out Table Name At Database Level Trigger
Table Name
How do I will come to know the name of table on which currently DML statement is fired ?
e. g. My current user is SCOTT. So Scott should realize the event of DML Statement fired. Hence my question is how the trigger on User Level is to be written & how to catch the event & table name on which the statement is being executed.
Suppose my table is as follows
Table Name : EMP
EMPNO number
ENAME varchar2(10)
JOB varchar2(9)
MGR number
HIREDATE date
SAL number
COMM number
DEPTNO number
Bcd number
Brcd number
Rec_id number
Scn_no number
Sequences for above table
1. EMP_REC_ID - minimum value is 1 increment by 1 & max value is unlimited
2. EMP_SCN_NO - minimum value is 1 increment by 1 & max value is unlimited
I have written a trigger as follows :
CREATE OR REPLACE TRIGGER UPD_EMP_REC_SCN BEFORE INSERT OR UPDATE OR DELETE ON EMP REFERENCING NEW AS NEW OLD AS OLD FOR EACH ROW
DECLARE
BEGIN
IF (INSERTING) THEN
SELECT EMP_REC_ID.NEXTVAL INTO :NEW.REC_ID FROM DUAL;
ELSIF (UPDATING) THEN
SELECT EMP_SCN_NO.NEXTVAL INTO :NEW.SCN_NO FROM DUAL;
ELSIF (DELETING) THEN
INSERT INTO DELETED_ROWS (TAB_NAME, BCD, BRCD, REC_ID)
VALUES (‘EMP’, :OLD.BCD, :OLD.BRCD, :OLD.REC_ID);
END IF;
END;
Hence My problem is
If my database user contains 800 tables then I have to write down 800 triggers (i.e. for each table).
I want to write only one trigger at database level so that I can dynamically take actions, for this I need table name and the event on which the dml event has taken place.
Any help in this matter will be greatly appreceiated.
Regards
VikrantYou cannot write a single trigger that applies to multiple tables. If you need a trigger for every table, you will need to generate 800 triggers.
Rather than manually generating 800 triggers, you might write a code generator that generates triggers for each of the tables by querying the data dictionary (i.e. DBA_TABLES, DBA_TAB_COLS, etc).
Justin -
How to find out table name for the field in the webUI
Hi.
I am in CRM2007.
So i go to the transaction code BSP_WD_CMPWB
In that i provide the component name as CRM_UI_FRAME.
I press the Test button.
So, it opend the WebUI.
I want how to find out table of the particular input field?
I mean from which table the data is retrived how to find out?
When i enter some thing in the input field how to find out in which table that data is stored?
By pressing F2 on the input field it opend View and Component Name.
I want find out table of that particular field. How to find it?
If anybody know about this explain it with Screen shorts if possible.
Thank You.
Krishna. B.hi
goto tx genil_model_browser. Suppose you want to find fields reated to your order header eg sold to name. In component set write all and press F8. Then goto access object and in access object click on node BTAdminH. Click on attribute structure. Here you will find structure and attributes. If you click relationship then you will see all the relationship wrt btadminh. open any r/s that you require. and click on other object and attribute. You will get to know the structure.
Best regards
Pankaj kumar
Maybe you are looking for
-
I have good idea about HR. But Im not that much expert .Id like if you guys share your ABAP HR experience and give me some hints like how to read time data what are the basic ways and macros to read time management data. What are the different ways
-
HT4799 Apple TV and Hulu plus: I don't see a Hulu plus app on my apple tv
Apple TV and Hulu plus: I don't see a Hulu plus app on my apple tv
-
Hi i wanted to know how much we have purchased(values) across plant for a given period. how to check it is there any tcode available? or we to do customized report. if want to prepare report what is related table? regards sun
-
Can you lock the background image orientation?
Hello all Is there a way to lock the image orientation? When I turn the iPad, I want the apps to rotate, but I want the background image to stay portrait. If not, is there someplace i can suggest the feature? Thanks!
-
I have accidently out in an incorrect email address as my icloud ID.
I have accidently out in an incorrect email address as my icloud ID. It is asking me to verify each time I sign in, but because the email address was incorrect, I cannot verify. I am going round in loops- HELP!