Skip to Content
0
Former Member
Feb 10, 2011 at 03:38 PM

Dynamic Variable Declarations

40 Views

In a program I'm writing we are consuming webservices from another server. There are two webservices, one on a DEV server, and another on a PRD server.

What I'm wondering is if there is a way I can use the same variable name, but change it's TYPE based on if the program is being used in the DEV or PRD system.

Pseudo-example

if sy-sysid = 'DEV'

data: my_webservice type ref to Z_DEV_WS_CLASS

else

data: my_webservice type ref to Z_PRD_WS_CLASS

endif

I do know I could use different variable names, but with all the structures and such that go with them, I was wondering if this could be done or something else to make it easier to read instead of huge if thens where i'm only changing variable names.

Any suggestions would be appreciated.

Thanks,

Curtis