cancel
Showing results for 
Search instead for 
Did you mean: 

Message mapping issue

Former Member
0 Kudos

Hi All,

I have a field (Partner) which can have WHL,GPOI,GPOO , WHL corresponds to xyz.xyz and GPOI/ GPOO corresponds to abc.abc rest of the entry's will have 'Independent'.

I have used FixValues function to do the mapping but when there is no name entered (blank) in the Partner field, I'm getting message mapping transformation error.

I even left a blank in the key column and 'Independent' in the value column, but no use.

Any way to solve this?

Thanks,

Srini

Accepted Solutions (0)

Answers (2)

Answers (2)

GabrielSagaya
Active Contributor
0 Kudos

You can provide default value as 'independant' in fix values

page 68

The FixValues function provides a simple generic value mapping (or key mapping) in the Integration Repository

https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/190eb190-0201-0010-0ab3-e69f70b6...

Edited by: Gabriel Sagaya Selvam on Jun 25, 2008 1:20 AM

Former Member
0 Kudos

Gabriel,

I did that but it doesn't work when the field is blank

GabrielSagaya
Active Contributor
0 Kudos

In PI 7.1 you can have the options like

Return inital value,

Return a default

Throw an exception

https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/f06d11f2-e7c2-2a10-04a9-f2f6f374...

But if you use PI 7.0 you dont have the option to provide blank value in default.

https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/9202d890-0201-0010-1588-adb5e89a...

Former Member
0 Kudos

Hi,

Create a Java UDF and have if else logic. That will solve your problem in PI 7.0

Thanks

Amit

Reward points if solution works

Former Member
0 Kudos

Is there no work around, because its the business requirement.

Former Member
0 Kudos

Amit,

can you give the code for the UDF?

Former Member
0 Kudos

Hi,

Create UDF and you can achieve that. sample UDf for doing the same below.

public String fixValueMapping(String a,Container container){

-


String finalStr="Independent";

if(a.equals("WHL"))

{

finalStr="xyz.xyz ";

}else if (a.equals("GPOI"))

{

finalStr="abc.abc ";

}else if (a.equals("GPO"))

{

finalStr="abc.abc ";

}

return finalStr;

-


}

Thanks

Amit

Reward points if it works

Former Member
0 Kudos

Thanks UDF works, but my problem is not solved probable there must be something else going wrong

Former Member
0 Kudos

This is the error:

Check xml instance is valid for source xsd and target-field mapping fulfills requirements of target xsd at com.sap.aii.mappingtool.tf3.AMappingProgram.start

any suggestions

Former Member
0 Kudos

Hi,

It looks like there is some mandatory field which you are not mapping or something else. Is there any root node 1..unbounded which you would have not mapped. Please check that and try again. This is some other problem.

Thanks

Amit

Reward point if it helps

Former Member
0 Kudos

Amit,

I have mapped everything, but in UDF theres an error:

cannot return a value from method whose result type is void return finalStr;

Former Member
0 Kudos

Hi,

Have you created a normal UDF or Advanced UDF. Normal UDF always as return type String. How it can be void?

Have you selected the Cache option as "value" or some other thing. please check it again. If it doesnt work send me screen shot of your udf and mapping.

Thanks

Amit

<ASKING FOR POINT AFTER TODAY WILL RESULT IN A REMOVAL OF YOUR USER>

Edited by: Craig Cmehil on Jul 16, 2008 10:29 AM

Former Member
0 Kudos

Sorry man when I tested i put cache option as value, but later I selected context.

But i have to test the mapping weather I'm getting the same error or not, I will post if an errors occur.

Former Member
0 Kudos

I'm still getting the error:

com.sap.aii.utilxi.misc.api.BaseRuntimeException: RuntimeException in Message-Mapping transformation: Cannot produce target element /ns0:MT_SPGPDS010_CUSTDATA/CUSTOMER_INFO_RECORDSET/CUSTOMER_TYPE. Check xml instance is valid for source xsd and target-field mapping fulfills requirements of target xsd at com.sap.aii.mappingtool.tf3.AMappingProgram.start

Former Member
0 Kudos

Alright, Just try that and let me know in case of any errors.

Former Member
0 Kudos

Hi,

Can you send me the screen shot for source and target structure and maping as well. It is very much clear that the element mentioned in th error is not mapped correctly. With what field it is mapped and is it direct mapping?

Thanks

Amit

Former Member
0 Kudos

Hi ,

In this case u can pass a 'blank' as an fixed value and give the target as independent (or) u can try this udf;

String op;

if(a.equals("WHL"))

{

op="xyz.xyz ";

}

else if (a.equals("GPOI")||a.equals("GPO"))

{

op="abc.abc ";

}

else if (a.equals(" "))

{

op="independent";

}

return op;

regards,

Murugavel

Former Member
0 Kudos

Hi,

Is your problem respoved? The solution which I provided should work. If it helped you please close the thread with status as answered

Thanks

Amit

Former Member
0 Kudos

Amit,

Issue is linked with this problem:

I have a DEBMAS06 structure,

DEBMAS06

E1KNA1M

KUNNR

LAND1

NAME1

ORT01

PSTLZ

REGIO

STRAS

BRAN1

E1KNVVM

E1KNVPM

PARVW

KUNN2

and PARVW can have AG, RE, WE

Ex:

KUNNR PARVW KUNN2

0000300027 AG 0000300027

0000300027 RE 0000300016

0000300027 WE 0000300016

I'm having problem mapping, I have a situation where,

if WE partner = KUNNR , assign PRIMARY else rest all Independent.

So here I need to query PARVW and see weather it has WE and later compare its KUNN2 with KUNNR.

This is a complex mapping so we have to use UDF any suggestions or code would help.

--

Srini

Former Member
0 Kudos

Hi,

You can still do it. The code will be something like this. Define three string parameters in your udf while defining the signature a,b, c

public String generateIndependent(String a,String b,String c,Container container){

-


String finalStr;

if(a.equals("WE"))

{

if(b.equals("C"))

{finalStr= "PRIMARY";}

else{ finalStr ="Independent";}

}

return finalStr;

-


There might be some errors. pls let me knwo in case of any error.

Thanks

Amit

Reward points if it helps .

Former Member
0 Kudos

Amit,

This is the error:

.java:201: variable finalStr might not have been initialized return finalStr;

I have intialized finalStr = "Independent", but still the code is not working.

I have one more doubt, what if there is no parvw field coming from the idoc, i.e the field itself is missing in the idoc.

Then the source structure xsd and target xsd will not match right there will be mesage mapping trasformation error right.

--

Srini

Edited by: Srinivas Davuluri on Jun 26, 2008 1:22 PM

Former Member
0 Kudos

Hi,

Do like this

String finalStr ="Independent"; instead of String finalStr. It will work.

If there is no field coming and you have used that in your udf for mapping, yes it will fail. To avoid that you can use the standard Node function "exists" to check if the node is coming or not. If it is coming pass it else map udf input parameter with constant.

Hope this solves all your problems.

Thanks

Amit

Former Member
0 Kudos

Amit,

That UDF logic is not working, its always giving Independent even when the field is WE.

--

Srini

Former Member
0 Kudos

Hi,

It is not possible. It must be some problem with data. If still it doesn't work, the code is very simple to understand. Just understand the above code and do some tweaking as per your requirement. It is very simple if else logic. See if your conditions are getting satisfied or not else change the logic. I gave you solution now you have to make it working and surely it will work.

Thanks

Amit

Former Member
0 Kudos

Amit,

But in the code there is no logic to do a comparision like,

if WE partner = KUNNR , assign PRIMARY else rest all Independent.

So here I need to query PARVW and see weather it has WE and later compare its KUNN2 with KUNNR.

We are not doing any query with the KUNNR or KUNN2 fields.

--

Srini

Former Member
0 Kudos

Hi,

I am not able to understand your logic. Please try to implement the same whatever you are saying in the code I have given. I have just tried to provide you a sample code. Feel free to modify as per your requirement

Thanks

amit

Former Member
0 Kudos

Hi,

Why you need Partner in FixValue? I am not able to see any thing named Partner in FixValue.

Are you referring to Value Mapping?

Thanks

Amit

Former Member
0 Kudos

Amit,

Partner is the name of the source field which i'm trying to map using FixValue function to corresponding target field