cancel
Showing results for 
Search instead for 
Did you mean: 

Mapping on Idoc

Former Member
0 Kudos

hi all,

i want to map records obtain from a table into an idoc. the xml representation has two parts on which i need to map my record. the first one is the header node and the second one is the item node. the item node is a sub element of header node.

so i am trying to build a mapping rule which can cater for records(obtained from the table) don't have a header or don't have an item line.

i was able to create such a rule but now whenever i have a record with a proper header and several items my resulting idoc gives me a header and n+1 items i obtained from the record(table) the surplus item is empty.

that is if i have one 1 header and 3 items, the idoc produce 1 header with 4 items. the first items is blank.

i figures out that since i implemented the rule to create an empty segment for item when i got a header only, each time the system is generating a header it is acting as if there is no item and creating this blank item.

so i want to have a rule which allow me to

1. create an idoc with empty items if i got only header

2 .and secondly to create an idoc with a header and n items i got from the table.

hope i was able to explain my problem clearly.

thanks in advance.

Edited by: click_17 on Sep 11, 2009 1:53 PM

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

HI,

To achieve your first point: before you insert the blank segemnt, check the condition Item exits or not. and create only if no item exist.

If you put this condition then you will achieve your second mapping as well.

Shweta.

Former Member
0 Kudos

hi shweta,

i already tried that. but the crashes whenever i get only a header. so i change the rule and give the segment a blank constant as the segment for the item is required.

i have one more question, if i applied a check in an element does the does the check apply to its sub-element also or i must specify the same check for all its sub element.

anyone plz help me...

Former Member
0 Kudos

Yes, the check you put at header level is applicable to all the sub elements. there is no need to check that condion again for the subelement.

If you provide ur current mapping then I can tell you why it is not working.

Shweta.

Former Member
0 Kudos

hi,

i was able to prevent the system to create an empty segment. the problem was the idoc i was using was restricting the header an item segment to occur, having a minOccur as 1. hence i must modify the attributes and import the new idoc. having the minOccur as 1, the mapping crashes since the segment is required and hence when it was failing the check condition the system was throwing an error.

however i stil have a problem. i must be able to create several item segments for a header. i am not able to find the correct mapping rule to create this scenario.

thanks in advance.

Answers (1)

Answers (1)

Former Member
0 Kudos

hi,

the solution was to play with the context(using the node functions) and using splitByValue function.