cancel
Showing results for 
Search instead for 
Did you mean: 

String padding in FCC

Former Member
0 Kudos

Hello All,

I have receiver FCC and have requirement of Right padding strings and left padding numerics. FCC is of fixedLength.

String data type fields have to be end padded with " " e.g. "Data "

Numeric or Decimal data type have to be forward padded with "0" e.g. "000001234". Can we handle something like this in FCC itself. Is there any solution except writing and using UDF for each field.

Regards

Arpil

Accepted Solutions (1)

Accepted Solutions (1)

markangelo_dihiansan
Active Contributor
0 Kudos

Hi,

For zero padding for numbers, you can use the Arithmetic Function "FormatNum". As for the spaces, I guess java mapping or xslt mapping would do. Let's wait for the other opinions.

Hope this helps,

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

As you mentioned it is fixedLength, so for data type there will be no problems.

The data will be written on file from it's initial position. e.g. suppose I have two fields, first one 15 char long and second one 10 char long. Now if in first field a value comes like "helloworld" (of length 10) and in second field it comes like "12345", then it will be written on file like this

helloworld-----12345-----

where "---" represents the spaces between field1 and field2.

So for Numeric value just use the standard function FormatNum to pad it with zeros and rest everything is going to be fine.

Regards,

Sarvesh

Former Member
0 Kudos
String data type fields have to be end padded with " "

I don't think you need right padding as it is already fixed lenght FCC, the space will be added to the string if its shorter than the specified length.

To control this behaviour you can use NameA.fixedLengthTooShortHandling.

http://help.sap.com/saphelp_nw70/helpdata/EN/d2/bab440c97f3716e10000000a155106/content.htm

And for left padding zero's, you either need to use numFormat function as mentioned or write a udf. I dont think this can be handled in FCC.

Refer this link for UDF-

http://wiki.sdn.sap.com/wiki/label/padding