cancel
Showing results for 
Search instead for 
Did you mean: 

How to delte empty segments/fields from input XML graphical mapping

Former Member
0 Kudos

Hi

I would like to delete segments which don have any values in their child segments in graphocal mapping?

How should i use createif and existsmapping functions for this?

Edited by: Rajesh on Jun 15, 2009 8:42 PM

Accepted Solutions (0)

Answers (5)

Answers (5)

Former Member
0 Kudos

Hi All,

This has been achieved by using a XSLT mapping.

  • I have been used two XSLT mapping. One is to remove all empty segments and empty fields.I prefered XSLT rather that grpahical mapping due to nested XML structure.

  • The XSLT mapping program can be accessible at

https://wiki.sdn.sap.com/wiki/display/XI/RemoveemptytagsfromanXMLvia+XSLT.

  • The second XSLT is been used to pass the whole XML structure to one node.

Shabarish_Nair
Active Contributor
0 Kudos

try this https://wiki.sdn.sap.com/wiki/display/XI/RemoveemptytagsfromanXMLvia+XSLT

former_member200962
Active Contributor
0 Kudos
I would like to delete segments which don have any values in their child segments in graphocal mapping?
How should i use createif and existsmapping functions for this?

If you want to check if a value if present in a particular node or not then I dont think exists function will help you....exists function will only check if the node is existing or not.....

<SRC>

<Node1>

<Field1>SAP</Field1>

</Node1>

<Node2>

<Field2></<Field2>

</Node2>

</SRC>

If above is your structure on which you want to implement the logic..then as per your req you dont need to have the Node2 as the field(s) within it is not having any value....then you need to implement the below logic:

Field
                         ----------> equalS ----> Not ---> If...then / createIf ----> Target
Constant(keep it blank)

Regards,

Abhishek.

Former Member
0 Kudos

Hey

You can do this by doing you message mapping in 2 phases.

create First Message mapping and do perform your business logic there(not delete empty segments here),this mapping will be Source to Target

Create Second message mapping and write an advanced UDF which will check for the existence of child node,and delete the parent node if child node is not found,this will be a Target to Target mapping.

then specify both these mappings under one Interface mapping.

Thanks

Aamir

MichalKrawczyk
Active Contributor
0 Kudos

Hi,

for creteif you have a good example here:

http://help.sap.com/saphelp_nw04/helpdata/EN/d9/3033f96c79674f90e3ab8d101a595b/content.htm

but I'd write a UDF which would check if any child segment exist and if not remove the parent segment

Regards,

Michal Krawczyk

Former Member
0 Kudos

Hi Both,

If possible can u gime me teh UDF if you have any