cancel
Showing results for 
Search instead for 
Did you mean: 

Mapping problem.

Former Member
0 Kudos

Hi all.

Bellow you can see a message that I will get after file content conversion.

The structure repeats it self after each orderheader.

The number of segments bellow the OrderHeader can differ but there will always be at least one of each segment.

For example there can be 1...unbounded LineItems in one OrderHeader.

Bellow is a picture of the of the mapping structures.

As you see there are two entrys of OrderHeader and that is just because I tested to create one with a RecordSet befor.

This is what i would like to achive.

Each entry of the OrderHeder in the incoming message should trigger either OrderHeader in the bottom of the target structure or a RecordSet including a OrderHeader.

For me it doesen't matter wich one because i will make an other mapping after thisone.

At the moment I have no problems triggering a RecordSet for each OrderHeader but the problem is the rest of the segments.

The context does not work for me so i just populate the first OrderHeader in the target with all the values for CustomerData, LineItems, PriceRecords, ItemTexts and so on.

How would i perform the mapping to keep the segments for each OrderHeader to turn upp in the correct OrderHeader in the target structure?

Result of RecordSet mapping.

Thanks for all help I can get.

Andreas

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi

Please provide your input structure and the expected output structure so that we can help you better.

Former Member
0 Kudos

Hope the files attached will help.

Former Member
0 Kudos

The last problem for me is the LineItem tag.

If I could get help solving that then i'm home with the mapping.

//Andreas

former_member187010
Participant
0 Kudos

Hi Andreas,

You said for any field occurrence would be 1..unbound.

But they will also be in proper format. I mean suppose Lineitem is comming two time in input file they will come one after another. Not like the way you have shared in incomming xml.

I believe for each LineItem one PriceRecords is associated. You can change the context level for FirstValue to to ProfitUnit and then map to target field. Hope it will work.

If still facing issue, please let us know, will try to create dummy mapping.

Regards

Jitender

Harish
Active Contributor
0 Kudos

Hi Andreas,

you can not achieve the output with graphical mapping because of line item. How you will differetiate the line item belongs to first order header or second order header.

the possible options are

  1. Use Java map and parse the whole XML to output structure
  2. If you doing content conversion then try to convert that into simle structure which has grouped line item.

regards,

Harish

Former Member
0 Kudos

Please explain more.

Each segment in the source XML file is one line in the txt file.

How can I make the structure more simple?

//Andreas

Harish
Active Contributor
0 Kudos

Hi Andreas,

please provide the source file (flat file), if you are doing the content conversion.

Former Member
0 Kudos

Can do that tomorrow.

not ot at the office at the moment.

Former Member
0 Kudos

I'm not that good at Java.

How would the code look for a Java mapping?

Harish
Active Contributor
0 Kudos

The code will be complex in Java.. It is better to check the flat file and find the best solution

Former Member
0 Kudos

Then I think we will continue tomorrow.

Thanks for all the help.

//Andreas

former_member184720
Active Contributor
0 Kudos

Hi Andreas - How did you configure the record set structure?

Incase you would like to have a separate recordset for each orderheader from the input file set it to

orderheader,1,other segments... instead of orderheader,*,other  segments...

If your requirement is to create separate file/message for each order header then you can even set the recordset per message to 1.

Former Member
0 Kudos

Like this?

Or are we talking about the ESR settings?

//Andreas

Former Member
0 Kudos

Morning.

Attached you have an axample of the incoming text file.

Line with F0000 is the stratrecord of the file. Has to be present and valid or the file is to end up in error.

Line with H0101 is the orderheader start.

Line with H0402 is CustomerData.

Line with H4002 is the InvoiceFee

Line with R0402 is the LineItem

Line with R0457 is the ProfitUnit

Line with R0620 is the PriceRecords

Line with H0150 is the ItemTexts

Line with F9999 is the EndRecord and has to be present and valid or the file should end up in error.

//Andreas

former_member184720
Active Contributor
0 Kudos

Yes.. i was referring to the channel configuration itself..

Incase you always get separate StartRecord per each order then what the above configuration does is

whenever it encounters the StartRecord in the input file, it creates separate recordset from there..

But if you get just one StartRecord per file and has multiple orders in it then it doesn't work.. like in your case

former_member184720
Active Contributor
0 Kudos

May be you can go for java mapping to convert flat xml to nested xml

Make use of the below blog..

http://scn.sap.com/community/pi-and-soa-middleware/blog/2013/02/28/simplest-way-to-convert-flat-file...

Former Member
0 Kudos

That is exactly what I have.

One startrecord with mutiple orderheaders.

And one endrecord.

//Andreas

Former Member
0 Kudos

Made the following chnages in content conversion.

Made Document offset 1 to avoid StartRecord.

Removed all entrys for StratReord in the content conversion.

Noe i get the following error.

Line 28 is the line of the second OrderHeader in the file.

Why do i get that error?

//Andreas

former_member184720
Active Contributor
0 Kudos

Change the record set sequence to ascending so that whenever it finds new OrderHeader separate recordset will be created..