cancel
Showing results for 
Search instead for 
Did you mean: 

sender flat file conversion

Former Member
0 Kudos
89

Hi,

I was wondering if anyone knows where there is comprehensive documentation on converting flat files to xml in a sender file adapter (other than the minimalistic stuff in the help files).

I have an input file with a key field, and a subkey field (the subkey is not in every record - it depends on the key field). Is it possible to convert this? If not, how do I get it into my mapper without converting it to XML?

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Stephen,

>>I was wondering if anyone knows where there is comprehensive documentation on converting flat files to xml in a sender file adapter (other than the minimalistic stuff in the help files).

Check these weblogs..

/people/venkat.donela/blog/2005/06/08/how-to-send-a-flat-file-with-various-field-lengths-and-variable-substructures-to-xi-30

/people/sap.user72/blog/2005/01/06/how-to-process-csv-data-with-xi-file-adapter

/people/michal.krawczyk2/blog/2004/12/15/how-to-send-a-flat-file-with-fixed-lengths-to-xi-30-using-a-central-file-adapter

/people/anish.abraham2/blog/2005/06/08/content-conversion-patternrandom-content-in-input-file

>>I have an input file with a key field, and a subkey field (the subkey is not in every record - it depends on the key field). Is it possible to convert this? If not, how do I get it into my mapper without converting it to XML?

Can you provide more information on this with a example of your input file ?

Regards

Anand

Former Member
0 Kudos

Hi,

Sample input is

01SP00000000000058820051201SPER

0201000000000158344061182077000000000

0202NAME1

0204NAME2

0201000000000158345059844241000000000

0202NAMEa

0204NAMEb

990000000110000000000000000

where col 1-2 is recrod type (appears on all records)

and col 3,4 is transaction type (does not appear on all records)

I would like to get the following message as generated from the map test

<ns0:Messages xmlns:ns0="http://sap.com/xi/XI/SplitAndMerge">

<ns0:Message1>

<ns1:SPER_Vendor_MT xmlns:ns1="urn:xxx:procurement">

<SPER_File_Header_DT>

<RecordType>01</RecordType>

<FileType>SP</FileType>

<FileSequence>000000000000588</FileSequence>

<FileDate>20051201</FileDate>

<SourceSystemId>9</SourceSystemId>

</SPER_File_Header_DT>

<SPER_Vendor_Record_DT>

<SPER_Vendor_Header_DT>

<RecordType>02</RecordType>

<TransactionType>01</TransactionType>

<TransactionID>000000000158344</TransactionID>

<PartyID>061182077</PartyID>

</SPER_Vendor_Header_DT>

<SPER_Vendor_Name_DT>

<RecordType>02</RecordType>

<TransactionType>02</TransactionType>

<VendorName1>NAME1</VendorName1>

</SPER_Vendor_Name_DT>

<SPER_Vendor_Details_DT>

<RecordType>02</RecordType>

<TransactionType>04</TransactionType>

<VendorName2>NAME2</VendorName2>

</SPER_Vendor_Details_DT>

</SPER_Vendor_Record_DT>

<SPER_Vendor_Record_DT>

<SPER_Vendor_Header_DT>

<RecordType>02</RecordType>

<TransactionType>01</TransactionType>

<TransactionID>000000000158345</TransactionID>

<PartyID>059844241</PartyID>

</SPER_Vendor_Header_DT>

<SPER_Vendor_Name_DT>

<RecordType>02</RecordType>

<TransactionType>02</TransactionType>

<VendorName1>NAMEa</VendorName1>

</SPER_Vendor_Name_DT>

<SPER_Vendor_Details_DT>

<RecordType>02</RecordType>

<TransactionType>04</TransactionType>

<VendorName2>NAMEb</VendorName2>

</SPER_Vendor_Details_DT>

</SPER_Vendor_Record_DT>

<SPER_File_Trailer_DT>

<RecordType>99</RecordType>

<Records>8</Records>

<Payments/>

</SPER_File_Trailer_DT>

</ns1:SPER_Vendor_MT>

</ns0:Message1>

</ns0:Messages>

The blogs are a handy reference, but I was hoping for a more detailed technical reference from SAP?

Thanks,

Stephen

Answers (5)

Answers (5)

Former Member
0 Kudos

Just a quick update on this problem - ultimately the solution lies in the fact that the key field does not have to be in the same position or be the same size in every record. It DOES have to be contiguous. Therefore, in my case, for the header and trailer records, the key field is defined as being 2 bytes long, occurring as the first field, and for the detail records, the key field is defined as being 4 bytes long occurring as the first field.

eg.

Key field name : RecordType

FileTrailer_DT.fieldFixedLengths : 2,9,16

FileTrailer_DT.fieldNames : RecordType,Records,Payments

FileTrailer_DT.keyFieldValue : 99

VendorCreateHeader_DT.fieldFixedLengths : 4,15,9,9

VendorCreateHeader_DT.fieldNames : RecordType,TransactionId,PartyId,VendorId

SPERVendorCreateHeader_DT.keyFieldValue: 0201

etc.

Former Member
0 Kudos

hi Stephen,

i think the blog below answers ur question

/people/venkat.donela/blog/2005/06/08/how-to-send-a-flat-file-with-various-field-lengths-and-variable-substructures-to-xi-30

Former Member
0 Kudos

Ok - so really I have three questions here - none of which have really been answered.

1. How do I process a file that does not go through conversion - obviously there must be some way to process an unconverted file - why else would the content conversion be optional?

2. Where is the extended documentation - for example I have seen sample code that use an entry such as "<structure>.<tag>.optional=YES" or (as in the 1818 blog) "<structure>.processFieldNames=from configuration" - these are NOT documented in the help files - where did this person find out that they could do this?

3. My input file has a key field that appears in all of the records, and a subkey field that appears in only some of the records - is it possible to deal with this in the file adapter - or do I have to use two conversions or one conversion and then two maps or a custom mapping program?

The blogs suggested are fine for basic stuff, however none of them address the more complicated issues.

Former Member
0 Kudos

Hi Stephen,

>>1. How do I process a file that does not go through conversion - obviously there must be some way to process an unconverted file - why else would the content conversion be optional?

not sure if it is possible to process unconveretd file, but the content conversion is optional for processing XML files directly. Content convesrion is requiren only for comma seperated, fixed lenght..etc file. XML files can directly be sent to IS without conversion.

>>2. Where is the extended documentation - for example I have seen sample code that use an entry such as "<structure>.<tag>.optional=YES" or (as in the 1818 blog) "<structure>.processFieldNames=from configuration" - these are NOT documented in the help files - where did this person find out that they could do this?

The documentation currently available in help.sap.com is for SP14, the parameter mentioned could be of older service pack.

I have seen case where one such paramater mentioned in SAP training material was not present in current documentation.

>>"<structure>.<tag>.optional=YES"

This parmeter is mentioned in SAP training material.

So I think parameter mismatch is because of different service packs.

>>3. My input file has a key field that appears in all of the records, and a subkey field that appears in only some of the records - is it possible to deal with this in the file adapter - or do I have to use two conversions or one conversion and then two maps or a custom mapping program?

Format of the message from content conversion is of the following format..

<documentName>...

<recordset>

<NameA>

<field-nameA1>field-value</field-nameA1>

<field-nameA2>field-value</field-nameA2>

<field-nameA3>field-value</field-nameA3>

</NameA>

<NameB>

<field-nameB1>column-value</field-nameB1>

<field-nameB2>column-value</field-nameB2>

<field-nameB3>column-value</field-nameB3>

</NameB>

</recordset>

...

<recordset>

...

</recordset>

</documentName>...

As far as i know , you will not be able to do the content conversion based on main key and sub key, so I guess you need to use combination of content conversion and custom mapping to convert it to target structure.

Regards

Anand

Former Member
0 Kudos

Thanks Anand,

I guess that is sad that a company of the stature and reputation of SAP is not capable of providing complete and up to date documentation of its product.

Thanks again,

Stephen

Former Member
0 Kudos

Hi Stephen,

I guess, the documentation is complete for SP14. Please refer the documentation for the service pack which you are working on for the correct info. Some of the older features might have been changed in latest service packs.

Regards

Anand

Former Member
0 Kudos

Hi Anand,

I am working on SP 14 and theoretically the online documentation is for SP 14 and should include everything from every SP prior to 14. It remains that there are many options available that are NOT contained within the documentation as it now stands. Just as a further comment, only 9 mapping functions are documented in the "standard functions" section yet there are many many more functions available - where is, for example, "formatbyexample" documented? Certainly not in the online help files! Nor are there blogs or notes for this function!

I am just finding it difficult to accomplish anything when half of the stuff I need to know is either extremely difficult to find - or does not exist.

Sincerely,

Stephen

Former Member
0 Kudos

Hi Stephen,

I hope they have not changed/removed those old features from newer service packs )

Anyway's just experiment to see if they work in newer service packs.

Regards

Anand

Former Member
0 Kudos

hi,

while doing content conversion you have to mention the field names in header of data type.fieldNames. hence if the key field is not present it will throw an error in adapter monitoring, FIELD NOT FOUND.

Then about the other query mapping cannot be performed with a flat file as XI understands only XML.hence content conversion required.

Former Member
0 Kudos

The official help is at http://help.sap.com/saphelp_erp2005/helpdata/en/2c/181077dd7d6b4ea6a8029b20bf7e55/content.htm

The parameters: NameA.fieldFixedLengths

, NameA.fieldFixedType

, NameA.fieldNames

, NameA.keyFieldValue

, etc should be useful to you.

Former Member
0 Kudos

Check this weblog, I found it very useful: /people/anish.abraham2/blog/2005/06/08/content-conversion-patternrandom-content-in-input-file