cancel
Showing results for 
Search instead for 
Did you mean: 

Displaying Number Format according to User Country in WebDynpro

Former Member
0 Kudos

Hi All,

We devlop WebDynpro application using BAPI.....

we got all the values correctly.....now my dout is i need to disply number format i.e quantity field according user based country.

for example if user is from Germany i need to display quantity field(i.e number format) like : 123.345.563,33

if user is from US i need to display quantity field(i.e number format) like : 123,345,563.33

first my dout is how can i get portal user details according to country based in webDynpro

and according to country specific how can i display my number format.

i need to diaplay my number format for only two countries ( Germany and US)

Could you please solve my problem....

This is very urgent....

Really i appreciate.

Thanks and Regards,

Abhi.

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Solved By Meself

former_member182294
Active Contributor
0 Kudos

Refer the following threads:

Regards

Abhilash

Former Member
0 Kudos

Hi Abhilash,

Thanks for your reply, regarding date format we got the solution and coming to number format we got the solution partially but when we are trying the according to country specific webDynpro is not picking up the user locale.

The below is my code:

try {

IUser user = WDClientUser.getCurrentUser().getSAPUser();

} catch (Exception e) {

wdThis

.wdGetAPI()

.getComponent()

.getMessageManager()

.reportException(

e.toString(),

false);

}

NumberFormat formatter=null;

Locale locale=null;

if(country.equals("GERMAN"))

{

locale=Locale.GERMAN;

formatter = new DecimalFormat("#.###.###,##");

}

else

{

locale=Locale.US;

formatter = new DecimalFormat("#,###,###.##");

}

try{

String s1=ele.getQuantity().trim();

Number number = NumberFormat.getNumberInstance(locale).parse(s1);

String s= (formatter.format(number.doubleValue()));

ele4.setQuantity(s);

}

catch(Exception e)

{

wdThis

.wdGetAPI()

.getComponent()

.getMessageManager()

.reportException(

e.toString(),

false);

}

}

the above coding i am using for number format

when i am assing my user to Germany it won't picking up the German number format....again it shows US number format....

please let me know if there is any mistakes in my code.

Really i appreciate.

Thanks and Regards,

Abhi.

former_member182294
Active Contributor
0 Kudos

I looked at all possible ways. But finally I ended here:

- Its difficult to understand the format from , to . and . to , using number formatting in java.

- Only possible way is you should get the data from SAP in the required format. So while executing the BAPI we should set the language to DE or EN based on user profile. But right now its hard coded in JCO Destinations. I tried to look at possible options to change the language before executing the BAPI but I failed to find an API.

You can try by changing the language property in JCO Destination maintanace to German and see how it works. Then we can further investigate how to change language setting based on user profile.

I will let you know if I find some thing...

Regards

Abhilash