Application Development 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: 

Dynamically declaring a field in the variant

Former Member
0 Kudos

Hi,

I have a requirement where in I have to create a variant for the program RBDMANI2. In the program, there is a field in the selection screen "Sender Partner number" by name.  The field value for Sender Partner Number field should be the name of the production server at EWM. I am supposed to reprocess the failed idocs at R/3 side and post it at EWM side. But the variant has to move from development through a transport request. SO, if I specify the production server name in the field :Sender Partner Number, it will throw a dump in development server. Is there any way, I can create a variant such that the server is picked up dynamically ? for eg: for developmen server in R/3, automatically EWM development server should appear in that field. SImilarly, for prod. server in r/, the corresponding prod. server in EWM should appear. Is this possible? Please suggest how to proceed.

Regards,

Pavan

3 REPLIES 3

Kanagaraja_L
Active Contributor
0 Kudos

You can write some Logic inside the Initialization Event by Implicit enhancement, already one Initialization event there inside the Program anyway you can have one more Initialization event

i.e.

If SY-SYSID = 'DEV'.

Assign Values to Selection screen.

elseif SY-SYSID = 'PRD'.

Assign Values to Selection screen.

endif.

Kanagaraja L

0 Kudos

Hi Kanagaraja,

It is a standard program. So, I ma not supposed to make any code changes. Also, SY-sysid is giving the current server name. I need the targetserver name and its client name. To be more clear, I am sending an idoc from R/3 to EWM server.So, the target should be EWM production server. For eg: the target should be like <EWMPRD>CLNT<client number>.


Regards,

Pavan

0 Kudos

Pavan,

If you are not getting any alternate solution, you can change Standard Program without access key by using Implicit Enhancement.

SY-SYSID is used to get  'Current Server Name' if you want to execute some logic based on Server (DEV or QUA or PRD). You can write with If Condition, the logic executes only on that particular server where If condition satifying.

I hope you can do like below

Initialization.

If ( SY-SYSID = '<Target Server Name ie EWMPRD>' and SY-MANDT = '<client number>' ).

     SO_SNPRN-OPTION = 'EQ'.

     SO_SNPRN-SIGN = 'I'.

     SO_SNPRN-LOW = '<Value>'  " Partner Number of Sender

     Append SO_SNPRN.

     clear SO_SNPRN.

endif.

Kanagaraja L