Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

SYNONYM

Former Member
0 Likes
1,328

Hi,

can any one tell me what is synonym.

I created one synonym with sql

EXEC SQL.

createsynonym sapr3.abcde

ENDEXEC.

then it is creating the synonym.

and i checked whether it is exist or not using DB_EXISTS_TABLE and even DB_EXISTS_VIEW function module also.

i executed those function modules and in the view name or table name tab i entered synonym name.but it is throughing sy-subrc as 4 , even i created the synonym already.

can any body tell me exact function module to checkthe existence of synonym.

thanks.

4 REPLIES 4
Read only

Former Member
0 Likes
921

Hi,

A synonym is a DB object which can reference to a table, view, package..., regardless whether it belongs to the same schema or to a different one, and regardless whether it belongs to the same database or not.

For example, suppose you are working in SAP R/3 with Oracle. Then the main schema may have the name "SAPR3". Well, it may not be a nice procedure, but you may have more schemas into the same SAP R/3 machine (for test purposes, for example). Let's suppose there is another schema, say TESTSAP, with DB tables that are NOT created via SAP R/3. Well, you can create a public synonym, so that these tables are accesible from the whole machine. For example:

CREATE PUBLIC SYNONYM my_remote_table

FOR testsap.my_table

So every time you access "my_remote_table" (for instance, in a SELECT statement), it will automatically be redirected to the table "my_table" in schema "TESTSAP".

Another utility is to link several databases in several machines. This can be achieved via db-links. You may also create synonyms for that:

CREATE PUBLIC SYNONYM my_remote_table

FOR admin_1.salaries@another_db

So every time you access "my_remote_table", it will be redirected to the table "salaries" of schema "admin_1" into database "another_db", which can be another database different fom SAP.

Regards,

Padmam.

Read only

Former Member
0 Likes
921

Hi,

synonym is an alias for tables/views/program unit.

1.A synonym is another name for a table.

Every synonym has a name that is unique within the entire database system and differs from all the other table names.

2.The Function Module For Checking whether the Synonym(Table) is exist or not is DB_EXISTS_TABLE.

check this link

http://sapdb.org/7.4/htmhelp/48/8af5a1a54f11d2a97100a0c9449261/content.htm

Regards,

Omkar.

Message was edited by:

Omkaram Yanamala

Read only

sreeramkumar_madisetty
Active Contributor
0 Likes
921

Hi

Hi,

1.A synonym is another name for a table.

Every synonym has a name that is unique within the entire database system and differs from all the other table names.

2.The Function Module For Checking whether the Synonym(Table) is exist or not is DB_EXISTS_TABLE.

Regards,

Sree

Read only

0 Likes
921

Yes,I know that this function module used to check existence of synonym.but it is not working.

i created one synonym sapr3.abcde.

and it is created.and i checked with db_exists_table.but subrc is returning as 4 only.i think this is not the one to check.