Skip to Content
avatar image
Former Member

Spaces in recevier file adapter

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

4 Answers

  • Best Answer
    avatar image
    Former Member
    Apr 20, 2006 at 07:47 PM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Apr 20, 2006 at 07:16 PM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Apr 21, 2006 at 03:48 AM

    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.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Apr 24, 2006 at 06:15 PM

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

    Thanks

    Kunal

    Add comment
    10|10000 characters needed characters exceeded