cancel
Showing results for 
Search instead for 
Did you mean: 

Hierarch structure to flat

Former Member
0 Kudos

I have looked at numerous blogs and posts and can't find a solution to this issue.

I have as an input

I need to have the whole structure flattened. The trouble is, not every element is always present.

PaymentAdjustmentHeader - always present - not mapped (and neither are sub-elements)

PaymentAdjustments - always present - not mapped

PaymentAdjustment - always present - mapped to Records

All other elements are mapped to their counterparts.

The trouble is while I always have Concept thru TruckID, I don't always have the PaymentAdjustmentItem node and all sub-elements. However, I need to have these elements in the output - so blanks are fine.

I have tried various combinations of useOneAsMany, collapseContents, the concat method from here http://scn.sap.com/thread/3265417

all to no avail.

Thanks for looking.

Dave

Accepted Solutions (1)

Accepted Solutions (1)

markangelo_dihiansan
Active Contributor
0 Kudos

Hello Dave,

Can you provide us a sample input XML and what is your expected output?

Here is the mapping that I did:

For Records

For Concept until TruckID, the mapping logic remains the same only the field changes

For ItemID until AdjustmentReasonDesc, the mapping logic is the same only the field changes (set context to PaymentAdjustment)

For all ASNs and Payment Fields, please use the mapping logic below

Sample request:

Records should be mapped to PaymentAdjustmentItem, since it is not possible to flat the entire structure when you are only using the first unbounded field.

Regards,

Mark

Former Member
0 Kudos

Mark,

Thank you for taking the time. It worked perfectly.

Dave

Answers (1)

Answers (1)

Harish
Active Contributor
0 Kudos

Hi Dave,

So if you are not having the structure PaymentAdjustmentItem then sub element is not populating in target and you are getting the error at mapping level. Please use the map with default with source field (in the same context).

Regards,

Harish

Former Member
0 Kudos

I have used MWD of blanks and it made no difference