on 04-16-2008 4:40 AM
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
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
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!!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
85 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.