cancel
Showing results for 
Search instead for 
Did you mean: 

currency format

Former Member
0 Kudos

Hi

I want to format many price textview with a correct format number for currency choose by user. I see in simple type com.sap.dictionary.predefined.currency that contain a table with currency and description (for example USD-US Dollar), but it not contains nothing about format (number of decimal).

I try for a solution...

Thanks!

Andrea

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Andrea,

Create a datatype in your local dictionary say "Curr" and choose the Base Type "Currency".

It will give you a message. Choose Ok.

Then in the Representation Tab, click on the Edit Icon next to Format. Put a format like #,###.00##

depending on your requirement. The above format gives you result till 2 decimal places.

So now you should create a variable in your context of this new local type and attach this to the textview. Then copy the actual value to this new varaible.

Hope this is helpful.

Regards,

Shubham

Former Member
0 Kudos

thank you,

but in this case I apply format for all currency. I need to apply many kind of format type. For example #,###.00## for US Dollar and #,###.000# for Argentine Peso.

Andrea

Former Member
0 Kudos

Andrea,

You may alter format with ISimpleTypeModifiable at run-time:


final IWDNodeInfo niNode 
  = wdContext.nodeMyData().getNodeInfo();
/* Any node you are displaying */
final IWDAtrributeInfo niAttr
  = niNode.getAttribute("MyCurrencyField");

niAttr
  .getModifiableSimpleType()
    .setFormat("#,###.000#");

VS

Answers (0)