cancel
Showing results for 
Search instead for 
Did you mean: 

Basic Message Mapping Question

Former Member
0 Kudos

Hi all,

I have a basic doubt in message mapping.

The requirement is, if a particular source field has value, only then the target node should get created.

If the Field has no value then the node should not be created.

I tried doing this using the “exist” and “createif” functions but couldn't do it.

The basic doubt is how to check if a field is initial or not.

Illustration of my requirement:

Source Target

-


NodeA TargetNode

Field 1 Field 1

Now the requirement is

If field1 = "Some value" only then the target node has to be created .

Regards

Venu

Accepted Solutions (0)

Answers (2)

Answers (2)

moorthy
Active Contributor
0 Kudos

Hi venu,

Exists Node function should work here.

First of all make sure that you are getting source xml tag for the field .

For e.g Your Source message is

<NodeA>

(there is no value here right ?)

</NodeA>

If so you can try with Exists Function with if then logic.

For e.g

Field1->Exits->If then->TargetField1

Else Constant->TargetField1

If there is no value, you can ,map with empty tag to get the xml structure in the target message.

Are you getting any error in this ? Or how are you testing this ? You need to test by deleting the <Field1> </Field1>Tag not the value in the Field1..

Hope this helps,

Regards,

Moorthy

Former Member
0 Kudos

Venu,

Make sure your target node has minOccurs as 0. And try the mapping with equals, and createIf.

praveen

Former Member
0 Kudos

Praveen/Krishnamoorthy,

Can you please tell me the basic thing as to how to check whether a field has some value or not. I mean only when there is some value in the field the condition should be executed.

regards

Venu

moorthy
Active Contributor
0 Kudos

Do you mean

<Field1><Field1> Is this is not having value ?

In this case you are able to get the XML Tag. In this case Exists will not work. Exists is a node function

http://help.sap.com/saphelp_nw2004s/helpdata/en/1a/318c4024d26e1de10000000a1550b0/content.htm

If you want to check for the values in this case, then write small java user defined function to check for null.

Exists will work if the nodr exists or not . it will not check for the node values.

Please update .

Hope this helps,

Regards,

Moorthy

Former Member
0 Kudos

Krishnamoorthy,

So we don't have a easy way to check the field value existence other than writing an user defined function is it ?

Thanks for your suggestion.

I got some clarity now.

Cheers

venu

Former Member
0 Kudos

Venu, you check the length of the field thats in question. and if its length is Zero then it has nothing init.

moorthy
Active Contributor
0 Kudos

As mentioned you can check for null/length zero etc.

I have already given the standard functions link- Only that is possible.

http://help.sap.com/saphelp_nw2004s/helpdata/en/2c/2d8c4024d26e1de10000000a1550b0/content.htm

If it answered please close the thread.

Thanks,

moorthy

Former Member
0 Kudos

Mohan/Krishna,

Thanks for your reply.

It helped me to an extent , i will take it forwar from here.

Thanks once again

Venu

Former Member
0 Kudos

Actually I;'m having some problem with my connection here, I will make sure that I award points to you guys.

Thanks

Venu