cancel
Showing results for 
Search instead for 
Did you mean: 

Data Services - field order in the file doesn't match file format definition

0 Kudos
604

Hi,

Working on a data services interface that reads a file and load documents into SAP. Created a file format with '|' delimited. However, the source system can send the file with field names matching the file structure but not in the same field order.

Is there a way to read file in SAP DS with dynamic field order but the field names will be exactly same?

In SAP LSMW, there is a check box where it says the field order matches source structure definitions but this provision doesn't seem to be available in DS.

Accepted Solutions (0)

Answers (2)

Answers (2)

Nawfal
Active Participant
0 Kudos

Hi Siva,

One idea I thought of, perhaps it could help you.

Since the source file is sent with field names, you can manipulate the first row to adapt it to the output file in order to match the changed columns order.

  1. Create a source file format with generic field names (field1,field2,field3,etc...), add extra ones in case new columns are added in the source in the future. Also since the source content received match the structure in your case, the order would not be an issue as you can easily specify the data types with the required structure or set all fields to a generic varchar type.
  2. Map all the generic fields from source to the query mapping.
  3. Create a target file format similar to the source, make the schema adaptable and write row header set No.
  4. When you run your dataflow, the source file format, query mapping and target columns name structure and order won't matter.
  5. LSMW, upon the file check it will find the column headers in the right order and it would then be able to match the structure of the source all the time.

Please let me know if this helps.

Thanks

Nawfal

0 Kudos

Hi Nawfal,

Thanks for your response. At some stage, I need to convert field1, field2, .... field n with generic type lets say varchar(100), to real field names so that transformation can happen. I am not using LSMW, Just gave an example of how this can be done in LSMW.

The DS interface Extracts, transforms and Loads data in to SAP.

How do we convert the generic fields to real fields?

Nawfal
Active Participant
0 Kudos

Hi,

If you are loading data directly to SAP then I'm not sure. However if you are passing via text file then you don't need to rename the fields as the first row will have actually headers, and if you are loading to a db table then you can set the option to compare columns by position rather name, assuming that the table is always set to much the source.

thanks.

Julian_Riegel
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi,

there is no way of doing that within the input file format afaik.

Why don't you adapt your file format within DS as per the source system format and then map each attribute within a query as per your target SAP system column order?

0 Kudos

Thanks Julian for the response.

We have been doing the same for all the interfaces so that the DS file format aligns with the source.

However, in this particular case (don't know what the reasons), Source system guys couldn't agree for a predefined format with specific order.