Get table name
How to get a table name based on two fields...?
Hi,
there are many ways.
Goto se15 -> ABAP dictionary -> Fields -> Table Fields .
Now enter field name in field name screen.execute
All tables having that field will come.
Repeat same for second field.
Out of two results find comman tables.
Also if u know data element of fields -> Goto se11 -> data type -> enter De name -> F7.
Then click on where used -> table fields .
Select from list appear.
Hope u will find it out
Regards
Similar Messages
-
Hello Friends..
I need your Help My Friends...
we are working currently on Oracle Applications : 12.1.1
i would like to know the best way to get Table name from Web Based Form..
Regards
Yas.Hi Yas;
Please follow below 2 thread i belive you will find some hint in those thread
table name for a jdeveloper page
Re: EBS, 11.5.10, table name
Hope it helps
Regard
Helios -
How to compare 2 different database to get table name which are not present in second database
How to compare 2 different database to get table name which are not present in second database
Sorry cannot test it right now
use db1
go
select * from sys.tables t where not exists
(select * from db2.sys.tables s where t.object_id=s.object_id)
Best Regards,Uri Dimant SQL Server MVP,
http://sqlblog.com/blogs/uri_dimant/
MS SQL optimization: MS SQL Development and Optimization
MS SQL Consulting:
Large scale of database and data cleansing
Remote DBA Services:
Improves MS SQL Database Performance
SQL Server Integration Services:
Business Intelligence -
Getting table name from a query
Hi, I'm trying to get the table name from my sql query
My code is as follows;
ResultSetMetaData metadata = rs.getMetaData();
for (int i = 1; i < metadata.getColumnCount(); i++)
System.out.println(metadata.getTableName(i));
I just get a blank output. Yet my sql query executes and I can pull down the records, and grab the column names from the result sets.
Any ideas on how I can get the table name for the columns. The reason being is on one of my querys I'm using join statements and i need to retrieve the table name for the column i'm displaying, as some tables have similar column names.
Thanks in advance.Hi,
What db are you using?
I also get a blank output with ResultSetMetaData.getTableName because Oracle doesn't implement this method.
Why do you not know the table name anyway?
regards
Nick -
Reg. Getting Tables name from interbase
Hi,
I like to get interbase database table name using a query from JDBC program .I am connecting interbase through interclient driver.
Regrads,
VikkiOnce you have a Connection to the database, use its getMetaData() method to get a DatabaseMetaData object, which can give you that information.
-
From one user, how to get tables names of other user.
hi all,
now i connected to Oracle with one user let us assume 'pavan/pavan'. and i need to get the table names that are in user: pavan and in user: gupta (gupta/gupta).
one way is,
from Java, first get connection to pavan user, execute the query and store the results and disconnect to it and againg connect to user 'gupta', execute the query and add these results to first results.
but this is very expensive and time consuming also.
is there any query to get this one. or need to create 'Database Link' and access through that link.
regards
pavan.First you have to grant permission (like SELECT,UPDATE,DELETE....etc..) to PAVAN on objects that are belongs to GUPTA. Then you can make use the GUPTA user objects.
Suppose you connected to PAVAN and you want see the data in table A which exist in GUPTA user.
Connect GUPTA user first and execute following statement
GRANT SELECT,UPDATE,DELETE ON A TO PAVAN;
After executing the above query connect to PAVAN user and execute following statement.
SELECT * FROM GUPTA.A; -
Select query to get table names
Hi,
Can i retrieve a table name from a select query if i know value of one of the columns in the table?
GlenCan't you take a look at the source code and see what table those values are coming from? That's likely the easiest solution.
Barring that, you could use dynamic SQL, but it's going to be awfully inefficient. Something like
FOR x IN (SELECT * FROM user_tab_cols WHERE data_type = 'VARCHAR2')
LOOP
EXECUTE IMMEDIATE
'SELECT COUNT(*) FROM ' || x.table_name ||
' WHERE ' || x.column_name || ' = <<literal value>>'
INTO l_cnt;
IF( l_cnt > 1 )
THEN
DBMS_OUTPUT.PUT_LINE( 'Found the value' );
END IF;
END LOOP;This assumes that you know at least what data type the value is stored in. It's also going to generate a tremendous number of full table scans, so it'll be slow as molasses on a system of any size.
Justin -
Hello every body,
I am trying to create a procedure in pl/sql which can takes in input a record and its output is the table name of the record....i don't know how to do this in pl/sql...can u help me?
Thanks.Can you be more specific as to what you need? From what I understood is, you are bulding a procedure that takes input and when it matches record in any table, you want to display that table name. Am I right?
-
FM to get table names for a given Apllication Component.
Hai Friends,
I have to create a function module which functions exactly as the INFORMATION SYSTEM button in se16 table help.
i have written something like this but this is not giving exact results as INFORMATION SYSTEM IN SE16.
for ex. for componet sd-bil it gives 376 records where as in se16 you get only 30 to 40 table...
So pls help me with the tables and logic...
SELECT
B~DEVCLASS
INTO CORRESPONDING FIELDS OF TABLE IT_TDEVC
FROM DF14L AS A
INNER JOIN TDEVC AS B
ON A~FCTR_ID = B~COMPONENT
WHERE A~PS_POSID = COMPONENT.
LOOP AT IT_TDEVC.
SELECT TABNAME TABCLASS FROM DD02L
appending corresponding fields of table TABLE_LIST
WHERE APPLCLASS = IT_TDEVC-DEVCLASS
AND ( TABCLASS = 'TRANSP'
OR TABCLASS = 'POOL' OR TABCLASS = 'CLUSTER')
AND AS4LOCAL = 'A'.
* append table_list.
* endselect.
ENDLOOP.
This is just a test program so ignore the performance issues .
Waiting for your help..
Reshali.Hi,
Try the below code....
REPORT zsen_information_system.
PARAMETER w_comp TYPE ufps_posid.
TYPES : BEGIN OF y_tdevc ,
devclass TYPE devclass,
END OF y_tdevc.
TYPES : BEGIN OF y_table ,
tabname TYPE tabname,
tabclass TYPE tabclass,
END OF y_table.
DATA : it_tdevc TYPE STANDARD TABLE OF y_tdevc WITH HEADER LINE
, it_tab_list TYPE STANDARD TABLE OF y_table WITH HEADER LINE
SELECT b~devclass
INTO TABLE it_tdevc
FROM df14l AS a
INNER JOIN tdevc AS b
ON afctr_id = bcomponent
WHERE a~ps_posid = w_comp.
SELECT tabname FROM info_tabl
INTO TABLE it_tab_list
FOR ALL ENTRIES IN it_tdevc
WHERE as4local IN ('L','A','N')
AND tabclass IN ('TRANSP','VIEW','CLUSTER','POOL')
AND devclass = it_tdevc-devclass.
IF sy-subrc EQ 0.
LOOP AT it_tab_list.
WRITE /: it_tab_list-tabname.
ENDLOOP.
ENDIF.
Hope this will solve your problem
Thanks and regards,
Senthil Kumar Anantham. -
Get Target table name and its count
Hi Experts,
I have created a Procedure where I want to get the Target table name and its count of the previous Interface in a Package and insert these values into the Audit table.
I am able to get the number of Inserts in previous step using getPrevStepLog() API, but I also want the Target table name and its total count of the previous Interface. Is there any generic way or code to bring these Information without hardcoding the table name. Kindly help to sort this issue.Thanks!
Warm Regards,
VBVHi VBV,
Please follow the below steps to audit ur execution.
Please note i coded in such a way that u can use ur existing procedure to capture the table name no need to query ur repository as its not advisable to query the repository as Oracle may change the structure in future which i personally feel right.
I created a Audit table with the below structure.
CREATE TABLE AUDIT_TABLE
INSERT_COUNT VARCHAR2(100 BYTE),
TABLE_NAME VARCHAR2(4000 BYTE)
Step 1 :
This step needs to be added in ur existing IKM after Commit step where i am using API to capture the target table name.
Step Name: Get Table Name
Command On Source
Technology: Oracle
Schema: Any Oracle related Schema
Command:
SELECT '<%=odiRef.getTargetTable("RES_NAME")%>' AS TGT_NAME FROM DUAL
Command On Target
Technology: Jython
Command:
TargetTable='#TGT_NAME'
Step 2:
In ur existing procedure add the below or add a new procedure.
Step Name: Audit Log
Command on Source
Technology : Oracle
Schema: Whichever schema holds the audit table
Command on Target
Technology : Jython
Command:
import java.sql as sql
import java.lang as lang
myCon =odiRef.getJDBCConnection("SRC")
MyStmt=myCon.createStatement()
myRs = MyStmt.executeQuery("INSERT INTO ODITGT.AUDIT_TABLE (INSERT_COUNT,TABLE_NAME) VALUES (<%=odiRef.getPrevStepLog("INSERT_COUNT")%>,'"+TargetTable+"')")
Thats it.
OTN doesnt allow me to put + sign in front of any word ( its assume its a Italic) so please add + (plus) sign before and after TargetTable in the above script.
This way u can capture the table name, insert count in to ur audit table.
Please note u need to call this Procedure after the successful completion of the interface in a package and make sure u selected the right IKM which capture the table name as in Step 1.
I tested in my local and its working fine. Let me know if u find any difficulties in implementation.
Thanks,
Guru -
Field symbols as Table name and in where condition in a select statement
Hello All,
I have a scenario where I need to get user input on table name and old field value and new field value. Then based on user input, I need to select the record from the database. The column name for all the tables in question is different in the database, however there data type is the same and have same values.
I am not able to use a field symbol for comparing the old field value to fetch the relevant record in my where clause.
I cannnot loop through the entire table as it has 10 millilon records, please advice on how to add the where clause as field symbol as the table name is also dynamically assigned.
Here is my code:
DATA: TAB LIKE SY-TNAME,
TAB_COMP1 LIKE X031L-FIELDNAME,
TAB_COMP2 LIKE X031L-FIELDNAME,
NO_OF_FLD TYPE N.
DATA: BEGIN OF BUFFER,
ALIGNMENT TYPE F,
C(8000) TYPE C,
END OF BUFFER.
FIELD-SYMBOLS: <WA> TYPE ANY,
<COMP1> TYPE ANY,
<COMP2> TYPE ANY.
GET TABLE NAME GIVEN BY USER IN LOCAL VARIABLE
TAB = TAB_NAME.
CREATE FIELD NAME BASED ON THE TABLE NAME ENTERED.
CASE TAB_NAME.
WHEN 'OIUH_RV_GL'.
KEY FIELD
TAB_COMP1 = 'GL_GL_SYS_NO'.
NO_OF_FLD = 1.
WHEN 'OIUH_RV_OPSL'.
KEY FIELD
TAB_COMP1 = 'OPSL_GL_SYS_NO'.
NO_OF_FLD = 1.
WHEN 'OIUH_RV_OTAX'.
NOT THE ONLY KEY FIELD
TAB_COMP1 = 'OTAX_GL_SYS_NO'.
TAB_COMP2 = 'OTAX_TAX_POS_NO'.
NO_OF_FLD = 2.
WHEN 'OIUH_RV_GTAX'.
NOT THE ONLY KEY FIELD
TAB_COMP1 = 'GTAX_GL_SYS_NO'.
TAB_COMP2 = 'GTAX_TAX_POS_NO'.
NO_OF_FLD = 2.
WHEN OTHERS.
EXIT.
ENDCASE.
SET FIELD SYMBOL WITH APPROPRIATE TYPE TO BUFFER AREA.
ASSIGN BUFFER TO <WA> CASTING TYPE (TAB).
How to add where clause and remove the if condition in the select -- endselect
SELECT * FROM (TAB) INTO <WA>.
ASSIGN COMPONENT TAB_COMP1 OF STRUCTURE <WA> TO <COMP1>.
IF NO_OF_FLD = 2.
ASSIGN COMPONENT TAB_COMP2 OF STRUCTURE <WA> TO <COMP2>.
ENDIF.
IF <COMP1> = OLD_SYS_NO.
code for updating table would come here
WRITE: 'MATCH FOUND'.
EXIT.
ENDIF.
ENDSELECT.
Please advice. Thanks much.
Edited by: Shipra Jhunjhunwala on Jul 22, 2009 1:33 PM
Edited by: Shipra Jhunjhunwala on Jul 22, 2009 1:34 PM
Edited by: Shipra Jhunjhunwala on Jul 22, 2009 1:35 PM1. Create single column table for holding field name depending on the table entered.
2. Take input from user: for e.g. table_name
3. Using case load single column table with required fields
for e.g.
CASE TAB_NAME.
WHEN 'OIUH_RV_GL'.
Append 'GL_GL_SYS_NO' to KEY_FIELD --> KEY_FIELD is the single line internal table as mentioned in step 1.
WHEN 'OIUH_RV_OPSL'.
Append 'OPSL_GL_SYS_NO'.
WHEN 'OIUH_RV_OTAX'.
Append 'OTAX_GL_SYS_NO' to KEY_FIELD.
APPEND 'OTAX_TAX_POS_NO' to KEY_FIELD.
WHEN 'OIUH_RV_GTAX'.
Append 'GTAX_GL_SYS_NO' to KEY_FIELD.
APPEND 'OTAX_TAX_POS_NO' to KEY_FIELD.
WHEN OTHERS.
EXIT.
ENDCASE.
Now depending on the table name you have required column ready
4. Create dynamic internal table using following sudo code
Fill the fieldcatlog using the single column field table and DD03L table, See what all columns from DD03L you want to fill in field catlog table
loop at internal table with all the fields.
move it to field catalog.
append field catalog.
endloop.
5. Pass this field catalog table to static method create_dynamic_table method
DATA table TYPE REF TO DATA. --> data object for holding handle to dynamic internal table.
call method cl_alv_table_create=>create_dynamic_table
exporting
it_fieldcatalog = fieldcatalog_tab
importing
ep_table = table.
6. Now assign table reference to field symbol of type table.
ASSIGN table->* to <field-tab>.
7. Also create work area <field-wa> using refrence of table.
create data object wa LIKE LINE OF <field-tab>.
ASSIGN wa->* to <field-wa>.
8. Also define field symbol for field name.
for e.g. <field_name>
4. Dynamic internal table is ready
5. Now execute the select statement as follows:
SELECT (KEY_FIELD)
INTO <ITAB> --> created dynamically above
FROM (TABLE_NAME)
WHERE (WHERE). --> WHERE is single line internal table having line type of CHAR72. So for every old value there will be one line
Where condition is same as like we give in static way only difference in this case it will stored in internal table line wise.
In this case you need to append all your where condition line by line in to WHERE.
5. To fill this dynamic internal table using ASSIGN COMPONENT <Comp_number> OF STRUCTURE <field-wa> TO <field-name>
So in this case if first field of structure STRUCT1 is user_id then sudo-code will be
loop at internal table containing list of fields into field_wa --> single column field table
ASSIGN COMPONENT field_wa OF STRUCTURE <field-wa> TO <field>. "Here field_wa is wa area for single column internal table holding all the fieldnames.
Now <field-name> points to user_id field. Move some value into it as nornally we do with variables.
Move <your_new_value> to <field-name>. --> Assign new value
or
<field-name> = <your_new_value>.
Endloop.
6. After completing all the fields one row will be ready in <field_wa>.
APPEND <field_wa> to <field_tab>.
Hope this helps you.
Thanks,
Augustin. -
Need bapi to give table name on basis of field or stucture.
Hi,
Many a times wan we want to know table name of field from tecnical information but there we gets stucture.
It is very time consuming to find table for that field.
Is there any bapi or program where we insert information related to that program or transaction , such as structure name and field
and we get table name where actually data is getting stored?
Regards.Hi,
We have solution for that follow below steps,
Go to SE 84->ABAP Dictionary-Fields
enter field name (which you got from structure i mean from F1.) Execute ,you will find list of tables where this field is used with that you can find table for structure field.
Hope this may useful
Thanks and Regards,
Manjunath M -
hi,
i have a foxpro .dbf file. I want to view this file's content. I try to import data to access, but it fails. I search alot. Finally I make a connection to this file using
jdbc.
My file name is 3006.dbf , i added it to "user dns" (mic->control panel->admin. tools ->data source) and write a small class. No exception occured , i think connection is ok.
import java.sql.*;
public class jdbc3 {
public static void main(String[] args) {
String data = "jdbc:odbc:3006";
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection conn = DriverManager.getConnection(data);
} catch (Exception e) {
e.printStackTrace();
System.out.println("Error -" + e.toString());
}But i dont know, table names, column names etc. How can i view content of this file.
İ also found a code at this forum, which shows , how to get table names
i tried
import java.sql.*;
public class jdbc3 {
public static void main(String[] args) {
String data = "jdbc:odbc:3006";
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection conn = DriverManager.getConnection(data);
DatabaseMetaData metadata = conn.getMetaData();
String[] names = { "TABLE" };
ResultSet tables = metadata.getTables(null, "%", "%", names);
while (tables.next()) {
String tableName = tables.getString("TABLE_NAME");
String tableSchema = tables.getString("TABLE_SCHEM");
String tableType = tables.getString("TABLE_TYPE");
System.out.println("Table Name:" + tableName
+ " Table Schema: " + tableSchema + " Table Type: "
+ tableType);
} catch (Exception e) {
e.printStackTrace();
System.out.println("Error -" + e.toString());
}but i got this exception,
java.sql.SQLException: [Microsoft][ODBC Visual FoxPro Driver]Driver not capable
at sun.jdbc.odbc.JdbcOdbc.createSQLException(Unknown Source)
at sun.jdbc.odbc.JdbcOdbc.standardError(Unknown Source)
at sun.jdbc.odbc.JdbcOdbc.SQLTables(Unknown Source)
at sun.jdbc.odbc.JdbcOdbcDatabaseMetaData.getTables(Unknown Source)
at jdbc3.main(jdbc3.java:16)Well, I had that problem, but it's when we don't select a Database. That is to say I didn�t put the path of the database file. Or maybe you're not using the correct odbc.
-
How to retreive table names ?
Hi Gurus,
Having query using DatabaseMetaData..
I am trying to get Tables names from my database using code below..
try{
String[] type = {"TABLE"};
con2 = MyConnection.getConnection();
DatabaseMetaData metaData = con2.getMetaData();
ResultSet rs = metaData.getTables(null, null, "%", type);
System.out.println("Table Names:");
while (rs.next())
ResultSetMetaData rm = rs.getMetaData();
String s = rs.getString("TABLE_NAME");
System.out.println(s);
This code works fine and it gives me table names.. BUT my que is it retreives ALL table names including some system tables. (it gives me tables, for example, like: DR$NUMBER_SEQUENCE).
I just want to retreive ONLY table-names that I have created.
Is there any other override available for getTable() I can use ? OR any other solution ?
Thanks in advance!You see where you have this?
ResultSet rs = metaData.getTables(null, null, "%", type);Specifically where you have the nulls and the %?
You can pass actually useful things in there if you wanted and that might help. Consult the Javadoc API for more information on this. -
Getting country Name using from a Telephone tower
Hi,
We are currently doing a project on iphone where we are in need of country name. We can get this using Mapkit and using google reverse geocoding. But the map kit is not available in 2.0 and googles core reverse geocoding is not consistant. Is there a way to get details of cellID from the nearby telephone tower. This is definately possible using other platforms such as symbian and android not quite sure on iphone.
Any other suggestion are also welcome.
ThanksI think you should be working more closely with your TCS colleague (as Marcelo pointed out above): Getting Table names from Query
Per the other thread you'll see that when using Query mode the portions of the select statement are kept separately and could be retrieved for simple queries. Columns, Tables, FilterExpr, SortExpr, and others would be available to you in the query object (http://help.sap.com/saphelp_mii121/helpdata/en/45/cca31a93696f74e10000000a1553f6/content.htm)
If you are using a FixedQuery you could consider using
[Param.1]
for the FROM clause and then you could simply request document.APPLETNAME.getQueryObject().getParam(1) to retrieve it at runtime, otherwise you will have to parse the Query property string yourself.
Try using
SELECT * FROM [Param.1]
and defaulting the value Employees in the Parameters tab of the Template, then you can easily retrieve this in javascript with the syntax above.
Maybe you are looking for
-
My history is no longer showing up in the history menu, is there any way I can it back?
When I click on the history menu it used to show all my history but a few days it stopped doing that.
-
Find my iPhone doesn't Work on my 3GS - It Works Perfectly on my iPad2
I just got phone support from apple France where I am located for now but they could not solve the problem. Here are the main Problem elements : 1/ Purchased iPhone 3GS in France for use worldwide with on my Chinese Telco SIM ( CHINA MOBILE ) as I li
-
How can I get the language of the user logged on using only DI API?
Hello, how can I get the language of the user logged on using only DI API, without invoking the UI? Can I read the value from some table using sql? I could write to file the first user's connection to the language code in SAP and then use it from ext
-
How to define complex type with table per record?
Hi, for one of my tasks I'm dealing with XML export. After short investigation of the postings in the forum I found an acceptable solution: Re: Convert ABAP to XML and Vice versa The issue is that I need an XML file like this: <plant> <material>
-
How to restore face time?
My son accidently deleted the face time icon. How can i restore it?