cancel
Showing results for 
Search instead for 
Did you mean: 

how to remove nodes in Message mapping

Former Member
0 Kudos

Hi XI friends,

in my idoc to file..

i have number of segments..all segments are optional...

i want to remove in resultanat xml file..

please tell me how to remove if the values are not exsisted for that Segment ..

i think its possible in message mapping..

please guide me..

Munna

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

tried with exsists also...i am gettin unused segments in resulatant xml..

please guide me

Munna

Former Member
0 Kudos

Hello Munna,

Try to map exists with the node of the destination field if its occurance is 0 to unbounded.If the field in the source exists then the target element will be produced otherwise not.

Thanks

Amitanshu

Former Member
0 Kudos

Hi Munna,

Try Creating a UDF in your mapping name it like: "Create"

Paste the below mentioned code in it

========================

String str = a;

if(str != null && str.length()>0)

return "true";

else

return "false";

========================

2) Save this function .

3) Now Map like this

(Source Node->UDF Create)->Check if it returns a string "true"--> if yes Map it with source node->add this in the "then" of an "if with out else"---->Target node.

4) Test now in testing tool in Message mapping.

Try it.

it will work

regards

Pl: reward points if it worked

Answers (9)

Answers (9)

henrique_pinto
Active Contributor
0 Kudos

No need for UDF.

Just use IfWithoutElse and as input use a compare (using EqualS) between the field you want to check and an empty string (using constant).

Regards,

Henrique.

Former Member
0 Kudos

Hi Prabhu,

thanks for your response..

i did the same thing..but i am getting the unused segment in xml..

and also...i used segment->exists>ifwithoutelse---->targetsegment

segment

same..i am getting unuseed segments in xml..

please guide me

regards

Munna

prabhu_s2
Active Contributor
0 Kudos

if u can throw a screen shot of what is expected and what is coming to mailprabhu@gmail.com i can look into it

Former Member
0 Kudos

Hi Amitanshu ,

thanks for your response..

could you please in detail..how it can be with IF and exsists..

regards

Munna

prabhu_s2
Active Contributor
0 Kudos

there is exists node function in graphical mapping.

Source Node --- Exists ---target Node

Former Member
0 Kudos

Hi munna,

Use exists to determine whether a particular source field exists in the XML instance to be processed in source system. If it exists() returns the value true, if not it returns the value false.

http://help.sap.com/saphelp_nw2004s/helpdata/en/db/83f7b88528424c9113b15d5e0fb516/content.htm

Thanks

Amitanshu

Former Member
0 Kudos

Hi Chandra..

thank you very much for your response..

i dont want to display in the resulatant xml file if that segment does not contains data in the idoc....i want to eleminate the segments which dont have data in Idoc..

so that resultant xml file will have only segments which have data..

is this possible to achive this in Message Mapping

please guide me

regards

Ram

Former Member
0 Kudos

Hello Munna,

You can achieve this bu using inbuilt functions EXISTS and IF block.

Please incorporate these functions in your message mapping for the optional fields .

Thanks

Amitanshu

Former Member
0 Kudos

Hi freinds,

thank you so much for your responses,

idoc contains some 100 segements..

all the time..all idocs are not contains all segments..

my requirement is if that segement doent contain data in idoc ....

that segement should be removed in message mapping..that means no message mapping should perform for that particular segment

please guide me..

regards

Munna

Former Member
0 Kudos

HI,

As explained above in message mapping , just map the required fields/required segments , next need not to disable or remove in messamapping in target structure , if the receiver side segment /element is mandatory i mean red color then you should map with a value / or empty constant or right click and disable

if it is not mandatory i mean if it is optional then do not map thats all it will not in resultant structure ..

But display purpose all the rest of 100 segments will display only ,

if you want to hide , we have one filter symbol in mapping editor click on that symbol , all the unmapped elements or segments will be hidden.

if you want to disply again click on filter symbol again.

Regards

Chilla

Former Member
0 Kudos

Hi Munna,

Map only those fields which u want to put in XML file....from IDOC structure to File structure in Message Mapping.

regards,

Ansar.

MichalKrawczyk
Active Contributor
0 Kudos

Hi,

right click on the target segment in the message mapping

and <b>remove</b>

this will remove this segment

Regards,

michal

sbhutani1
Contributor
0 Kudos

Hi

Just right click on segment during mapping and click on disable/remove field to remove the node.

Regards

Sumit

bhavesh_kantilal
Active Contributor
0 Kudos

Do not map the source fields to the target in your mapping which you do not want to be sent.

Regards

Bhavesh