cancel
Showing results for 
Search instead for 
Did you mean: 

Spaces in recevier file adapter

Former Member
0 Kudos

Hi,

We are converting IDOC -> fixed length file. There are several fields which may not exsist in IDOC but still need to be populated in file with spaces. Is there anyway I can set some param in file adpater to default field value to spaces if it is not provided?

When I specify length =25 for certain field in file adapter and it receives field value of length 20.. will it be possible to include extra spaces at the end so that the field length is 25. In this example - extra 5 spaces ' ' will be needed.

Thanks

Kunal

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Kunal,

In the file you also create the column and link that column to a constant and fill spaces according to your requirement. Also go through the url:

/people/shabarish.vijayakumar/blog/2006/02/27/content-conversion-the-key-field-problem

/people/shabarish.vijayakumar/blog/2005/08/17/nab-the-tab-file-adapter

By the way you have told fixed length file, then why do you want to change the fields length?

---Mohan

Answers (3)

Answers (3)

Former Member
0 Kudos

We fixed it by specifying length in the Data type definition and using mapWithDefaultValue Node function in mapping.

Thanks

Kunal

Former Member
0 Kudos

Hi,

In mapping,

If <Sfield>> exists> then -> <Tfield>

Else <UDFunction>-> <Tfield>

In the UDFunction,

Take the Sfield as input, get its length, and maxlength,

If it is lesser than the max length, pad the field with spaces. Your job can be made easier by using the resultlist object in the UDF.

Regards,

Smitha.

moorthy
Active Contributor
0 Kudos

Hi,

You can achieve this in the Mapping may be user defined functions.

Need to do -

You need to use node functions "Exists" and then "if else if " function with userdefined functions.

If the field exists in the source field, and its lenght is equal to the as desired then do map with the source field to target field else map with spaces to the Target field with adding spaces. May be you need to use paddwith spaces function.

Hope this helps,

Regards,

Moorthy