cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with reciver file adapter in the content conversion.

Former Member
0 Kudos

I have starnge situation where the fileds in the file created after the content conversion are center aligned.

Can someone let me know how to make it right aligned?

For eg, i have a field with Char(6) in the file it looks as follows:

1.23 -> | 1.23 |

10.23 -> |10.23 |

100.23-> |100.23|

I want it to be like this :

1.23 -> | 1.23|

10.23 -> | 10.23|

100.23-> |100.23|

Please let me know ASAP as its a critical issue for the customer.

Warm Regards,

Nilesh Kumar

Accepted Solutions (1)

Accepted Solutions (1)

former_member181985
Active Contributor
0 Kudos

Hi Nilesh,

if You are using file content conversion on Sender Adapter, then do you java mapping between your two interfaces(sender and receiver)

use java.text methods for formatting the values according to your requirement.

first check the java API 1.4.2....

with in that check java.text.* methods

Also there will be lot of examples availble on internet on this. Check online.

Also check this link this will definitely solve issue

[http://www.iro.umontreal.ca/~vaucher/Java/tutorials/Formatting.html]

Sample code on this link

double x = 1.0 / 7;

for (int n = 1; n<5; n++)

System.out.println( "1/7 : " + format( x, n, -6)

+ format( x, n, 10));

Thanks

Gujjeti

Edited by: Praveen Gujjeti on Apr 16, 2008 6:16 AM

Former Member
0 Kudos

Hi Gujjeti,

I am using file content conversion on Reciver Adapter.

Is there anyway i can do the alignment directly in the file content conversion in the communication channel without changing the mapping?

Thanks

Nilesh

former_member181985
Active Contributor
0 Kudos

Hi,

then implement the same logic in Adapter module for receiver file adapter.

Means you need to develop a module according to SAP standards and you have to deploy it into J2EE engine inorder to use this in Module tab of Receiver file adapter.

Remember you have to call this module just before the call adapter module.

Thanks,

Gujjeti

Former Member
0 Kudos

refer

UDF wud be better than going for an adapter module

former_member181985
Active Contributor
0 Kudos

Hi arvind,

your solution would be correct if it is on sender side.

But here the case is on receiver side.

thanks,

Gujjeti

Former Member
0 Kudos

Hi Arvind,

I am using UDF instaead of Adapter module but i have to appened space i.e.' ' instead of zero.

But when i use " " instead of "0" it does not work. can you please help?

If the field length is 6 and field value is 1.00

1.00 should be | 1.00| and not |001.00| .

Regards,

Nilesh

Former Member
0 Kudos

this shud work

a = " " + a; (a space within the quotes )

Answers (1)

Answers (1)

Former Member
0 Kudos

Thanks a lot!! for the valuable comment.

I implemented the following code which take cares of right alignment with space.

StringBuffer pad= new StringBuffer();

String ret_string="";

int add=0;

int trunc=0;

int cont;

int length=a[0].length();

cont=Integer.parseInt(b[0]);

if(a[0].length()<=cont)

add =cont-a[0].length();

for(int i=0;i<add;i++)

pad.append(" ");

ret_string = pad.toString()""a[0];

result.addValue(ret_string);

SDN Rocks!!