cancel
Showing results for 
Search instead for 
Did you mean: 

File to Soap Scenario using UDF

Former Member
0 Kudos

Hi Guys

We have a requirement that said:

IF ShortDescription is not u201CNULLu201D then

map ShortDescription

ELSE IF ShortDescriptionLang with LanguageCode u201CENu201D is not NULL

map ShortDescriptionLang

So what I did is:

if( ShortDescription != "NULL")

{

map ShortDescription;

}

else if( (ShortDescriptionLang != "NULL" ) && ( LanguageCode == "EN") )

{

map ShortDescriptionLang;

}

But everytime when pressing f7 to check for errors I get thid:

C:/usr/sap/PI1/DVEBMGS00/j2ee/cluster/server0/./temp/classpath_resolver/Map0b27cd32dc2611df84e7000c2973cb67/source/com/sap/xi/tf/_MM_MATERIAL_TO_CATALOGUE_.java:441: '}' expected

Can someone suggest on how can I test this fucntionality cause one thing that I don't understand is the "map ShortDescription" and "map ShortDescriptionLang"

How do I put it on my if statement

Thanks,

Yonela

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

This can be achieved with graphical mapping. I am not sure why are you using UDF for this.

1. Use If then Else. If Condition - If ShortDescription is not equal to NULL

2. Then Pass ShortDescription to target

3. Else Use Another if condition

4. If condition - ShortDescriptionLang with LanguageCode u201CENu201D is not NULL

5. Then Pass ShortDescriptionLang

If you use If then else in Step 3, then you can pass default value in Else Part.

Hope its clear. Let us know in case of any issues.

Warm Regards,

Gouri

stefan_grube
Active Contributor
0 Kudos

> If ShortDescription is not equal to NULL

NULL usually is an expression for an empty or a missing element.

You do not really compare the element with a string "NULL"

Former Member
0 Kudos

Hi Stefan,

You are right! What I mean is to map the field to 'Map with default' and compare it with constant blank.

-Gouri

Former Member
0 Kudos

Hi Guys

On my File to Soap Scenario, I have imported EllipseMDataWS.wsdl and the MDM_MATERIAL.sxd, the .SXD is my Source and .WSDL is Target, the WSDL must return a response message.

Now the issue here is when configuring my SOAP Receiver, what must I put on the Target URL, and on the SOAP Action

Thanks,

Yonela

Former Member
0 Kudos

Hi,

Check out this How to use SOAP Adapter guide.

[https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/40611dd6-e66e-2910-f383-e80fb44f9cd4]

Warm Regards,

Gouri

Former Member
0 Kudos

Hi All

On my SOAP to FILE Scenario, I want to map a fields that is on the Target Message like:

Sorce - Target

- CorrelationID

Action - Action

My CorrelationID is a unique ID that is generated in SAP PI against the message.

So How do I map using the UDF cause on my Source I dont have this fields.

On the sxmb_moni -> technical Routing i should see something like this.

<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:mas="http://za.co.abc/ellipseWS/masterdata/">

<soap:Header/>

<soap:Body>

<mas:MaintainCatalogueItem>

<mas:CorrelationID>C30B7EEF686E4758352E9E54732A6FD7</mas:CorrelationID>

<mas:Action>A</mas:Action>

Thanks

Yonela

Former Member
0 Kudos

Hi All

On my FILE to SOAP Scenario I awant to map a field from my Target to get a Message ID on the moni like in the code below:

DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters()

.get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);

DynamicConfigurationKey key1 = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/SOAP","XHeaderName1");

String value = conf.get(key1);

return value;

My is like this:

DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters()

.get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);

DynamicConfigurationKey key1 = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/SOAP","Messageid");

String id = conf.get(key1);

return id;

But the when presing f7 I get error:

C:/usr/sap/#####/DVEBMGS00/j2ee/cluster/server0/./temp/classpath_resolver/Map1fee8942e00c11df9d67000c2973cb67/source/com/sap/xi/tf/_MM_MDM_MATERIAL_TO_CATALOGUE_.java:591: cannot return a value from method whose result type is void return value; ^ 1 error

So is it possible for me to use statement like this:

("http://sap.com/xi/XI/System/SOAP","Messageid");

Thanks

Yonela

Answers (2)

Answers (2)

rajasekhar_reddy14
Active Contributor
0 Kudos

You dont required UDF for this requirement,

if you want to use UDF search in sdn how to write UDF and google it for syntax/

use equalS function and if then else function to check logic.

Regards,

Raj

stefan_grube
Active Contributor
0 Kudos

> if( ShortDescription != "NULL")

This can't work.

> Can someone suggest on how can I test this fucntionality cause one thing that I don't understand is the "map ShortDescription" and "map ShortDescriptionLang"

If you do not understand the requirement of your customer, then ask him.

Former Member
0 Kudos

Hi All

Thanks for replying, so another question ,is there a way that on my if statement after checking I can use the statement

(e.g map field; ) like in the function below.

if( ShortDescription != "NULL")

{

map ShortDescription;

}

else if( (ShortDescriptionLang != "NULL" ) && ( LanguageCode == "EN") )

{

map ShortDescriptionLang;

}

Thanks

Yonela

Former Member
0 Kudos

Hi,

As I said, u dont need to use UDF. n Still if you insists, then you have to pass UDF Output to target field. In UDF code, you have to make sure you will return correct value.

Warm Regards,

Gouri