cancel
Showing results for 
Search instead for 
Did you mean: 

Justification in Message Mapping

Former Member
0 Kudos

Hi

I am getting a string from SAP of field length '10'. Now I have to write it to the <b>fixed length file</b>. Now if I am getting the value for this as "ABC" then in the fixed length file it should be "ABC " ie., ABC 3 characters and rest 7 should be spaces. For this to achieve I think we have to make left justification in message mapping. Can you guys help me out in achieving this requirement?

---Satish

Accepted Solutions (0)

Answers (2)

Answers (2)

stefan_grube
Active Contributor
0 Kudos

When you use "fieldFixedLengths) in the content conversion of the file adapter, you need not provide the data with that length. It is OK, when the strings or shorter. Just do not provide strings, that are longer.

On the other side, when you have a sender file adapter with content converion, the fields become trimmed by default.

Regards

Stefan

moorthy
Active Contributor
0 Kudos

Hi,

Left or Right Justification is depends on the Business Requirements/process . You can not generalize for each fields saying that Left Justififation/right... Because for the currency etc right justification , but for the strings it depends. so first identify this..

Just write one User Defined function , to check the string length, based on that , add/concate that many spaces to the string..then pass it. You need to do for each field..

Regards,

Moorthy

Former Member
0 Kudos

Krishna

What you have told is absolutely right. Here in my scenario I need to write a user defined function. I will try to write the code for this. But if you already have the code can you please give me the code. If I write this then i think I can resolve my earlier issue also which is given in the thread

Regards,

---Satish

Former Member
0 Kudos

krishna

By the way I need Left justification only.

---Satish

Former Member
0 Kudos

Hi Satish...

you do not need to write a user defined function for this ...this can be achieved using standard fucntions itself....supposing you want the string to be 10 characters long with spaces at the end...you achieve by doing the following...

input_str --  trim 
                   
                    concat -- substring(0,10)---output
                   /
Constant(10 spaces)

output is what you want....

Thanks,

Renjith