Hi experts.
I have problems with a file content conversion.
I get the attached file incomingfileorders.txt from an FTP server.
In this file there will be multiple orders and they are to be converted into the XML struucture of the uploaded file TargetOrderXML.xml.
The line starting with F0000 are the startrecord of the file and is to be transferred into the StartRecord segment.
Line will be represented as follow
Fileds: KEY,ID,Date,Time,TransactionCode
Positions: 5,40,8,10,4
The Line starting with H0101 is the orderheader and is to be transferred into the corresponding OrderHeader Segment.
Fields: KEY, OrderType, Company, DistributionChannel, Operational
Positions: 5,4,4,2,2
The Line starting with H0402 is customerdata and is to be transferred into corresponding CustomerData segment.
Fields: KEY,CustomerNumber,Operational,VersionNumber
Positions: 5,10,20,4
The Line starting with H4002 is the invoicefee and is to be transferred into the corresponding segment InvoiceFee.
Fields: KEY,Value
Positions: 5,2
Line starting with R0402 is the lineitems and are to be transferred into the corresponding segment LineItems.
Fields: KEY,Material,Quantity
Positions: 5,18,19
Line starting with R0457 is the profitunit and is to be transferred into the corresponding segment ProfitUnit.
Fields: Key,Value
Positions: 5,10
Lines starting with R0620 is the pricerecords and is to be transferred into corresponding segment PriceRecords.
This line has special rules. If the last 16 digits of the first PriceRecord is 0000000000000,00 then the second PriceRecord line will miss the last 16 digits, conclusion SecondValue will not be populated and I would prefer if the SecondValue field is created as an empty field.
Fields: KEY,PEFirst,FirstValue,PESecond,SecondValue
Positions: 5,4,16,4,16
Lines starting with H0150 is itemtexts and are to be transferred into correcponding segment ItemTexts. I’m not sure if I need the KEY field in the segment or if it could be removed. If the solution is to remove the KEY field then that is totally ok. Each line is to be transferred into a field called Text.
In the example target file I removed the KEY field.
Lines Starting with F9999 is the endrecord of the file and is to be transferred into the corresponding segment EndRecord.
Fields: KEY,Date,Time,NumberOfRecords,NumberOrderHeader,NumberOfItems,OrderValue
Positions: 5,8,10,10,10,10,10
Attached in the post you find the incoming text file named incomingfileorders.txt and you also have an example of the target file created from the txt file. Target file is named TargetOrderXML.xml.
Been trying to get this conversion to work with no luck. Would be appreciated if you experts are able to help me with the conversion.
Best Regards
Andreas
Was an error in the target file. There was an EndRecord to much. Also adding file describing target structure.