cancel
Showing results for 
Search instead for 
Did you mean: 

How to check runtime environment of UDF?

r_herrmann
Active Contributor
0 Kudos

Is there a way to detect where an UDF runs? I like to detect if a UDF runs/was called by...

  • ...in productive environment
  • ...from "Test"-button in the ESR

Background: In my UDF I'm using DynamicConfiguration. The values therefore only exist in productive environment, so I get exceptions when running the mapping test in ESR. Therefore I like to detect the environment, so that I can handle it and call the DynamicConfiguration code only, when the UDF was called by the "productive" environment.

Accepted Solutions (1)

Accepted Solutions (1)

markangelo_dihiansan
Active Contributor
0 Kudos

beat me to it. System.getProperty is the one widely used.

r_herrmann
Active Contributor
0 Kudos

Hi Mark, that isn't what I'm searching for. Please see my answer to

markangelo_dihiansan
Active Contributor
0 Kudos

Hi Raffael,

Sorry I replied too soon. Well for one, dynamic configuration won't ever get executed in test tab. The mapping test will always error unless the test is done at runtime. To answer your question:

  • I wan't to know "who" called the mapping. For example mapping was called by "SAP PI itself due to an incoming messages" or mapping was called by "User who clicked the Test button in Enterprise Services Builder".

The test tab would not generate a messageID unless you are using lookups (RFC, JDBC or SOAP). The user can be traced by looking at the table sxmspmast once you know the messageID.

Regards,

Mark

r_herrmann
Active Contributor
0 Kudos

Perfect! Thanks for that explanation.

Answers (1)

Answers (1)

iaki_vila
Active Contributor
0 Kudos

Hi Raffael,

Check this thread How to identify environment dev,qa,prd in java ... | SCN

In this way with getHostName(), you can have a value-mapping to identify host names with the environment.

I haven't tried Martin Sommer suggestion.

Regards.

r_herrmann
Active Contributor
0 Kudos

Ok, I think my question was a little bit misleading. So let me try to clarify:

  • I don't want to know, if the mapping was called on dev, qu, prd
  • I wan't to know "who" called the mapping. For example mapping was called by "SAP PI itself due to an incoming messages" or mapping was called by "User who clicked the Test button in Enterprise Services Builder".

Nevertheless, thank for your help and effort so far.

bhavesh_kantilal
Active Contributor

Instead of testing the Message Mapping, you can always test the Operation Mapping. What this would mean is then that the Dynamic Configuration code will not lead to an error. While not a direct answer to your question, an alternate i hope can help!