cancel
Showing results for 
Search instead for 
Did you mean: 

Schema names hard coded into procedures

shyam_uthaman
Participant
0 Kudos

Hi All,

I have 4 ECC systems coming in via SLT to four target schemas. Lets call them schema A, B, C and D. I have the same table..lets say VBAK in all of them.

Now I have a stored procedure which takes an input parameter called schemaName


The procedure has logic like:

if schemaName  = 'A'

{

select from A.VBAK

}

elseif schemaName  = 'B'

{

select from B.VBAK

}

elseif schemaName  = 'C'

{

select from C.VBAK

}

elseif schemaName  = 'D'

{

select from D.VBAK

}

Now the problem is that A,B,C,D map to M,N,O,P in the Quality environment and W,X,Y,Z in the prod.

Hard coded values won't undergo schema mapping upon transport and mentioning a default schema doesn't help since I have multiple schemas.

Confused on what to do.. How do i make the schema names switch in the If condition and in the select statement?

Let me know your thoughts on this.

Thanks,

Shyam

Accepted Solutions (1)

Accepted Solutions (1)

former_member226419
Contributor
0 Kudos

Hi,


Use public synonyms for the same.

https://scn.sap.com/thread/3568988.

Br

Sumeet

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Shyam,

You can create some default schema and create synonyms in that schema to maintain the mappings to the respective objects of respective schema.

These synonyms can be used in your procedure which will take out entire if else logic.

When migrating to different systems . These synonym definition can be changed to point to respective schemas which will avoid code change as well.

Regards,

Anil

amitdev_solanki
Explorer
0 Kudos

Hi,

you can create a custom table to maintain the system id with schema names & can get the schema based on system id at run time.

or

Use variant in the system.

Br,

Amit

shyam_uthaman
Participant
0 Kudos

Hi Amit,

Thanks for the reply.

Option 1 that you mentioned is the last resort.

Can you expand on the second option of using a variant? Am not clear on how that is to be implemented.

Thanks,

Shyam

amitdev_solanki
Explorer
0 Kudos

Please try following steps:

1: SM30->TVARV-> maintain your values

2: Select Parameter or Select-Options tab based on single value (like transaction type) or multiple values/range of values can be maintained

3:Make sure that  transport request check box is checked to include this in  a TR.

4: Write your logic to read table TVARVC.

shyam_uthaman
Participant
0 Kudos

Hi,

That may not be an option. We only have the enterprise HANA system.

It's not BW on HANA or ECC on HANA to to be able to navigate to TCODES.

Regards,

Shyam

amitdev_solanki
Explorer
0 Kudos

You can also use :

CASE system_id.

WHEN 'DEV'." example only, u can use actual values here.

if....else statement for DEV schema.

WHEN 'QAS'

if....else statement for QAS schema.

WHEN 'PRD'

if....else statement for PRD schema.

ENDCASE.

It could not be a best solution, but if u like u can use it.

Br,

Amit