cancel
Showing results for 
Search instead for 
Did you mean: 

Formatting data in Models in Web Dynpro

Former Member
0 Kudos

Hi all,

I have created java bean with date (currency, etc.) attribute and then i have imported this bean as a model in my Web Dynpro project. I want to bind data from this model directly to table UI element, but before I want to format date value using specific customer requirements.

Now I use secondary context structure of string elements, fill it from that model and create table binding from structure. So I want to explore easier way - is there place for formatting routine after creating binding?

Regards,

Michal

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Michal,

Sure, you can use solution mentioned by Bharathwaj (@Bharathwaj: thanks for refering my blog).

However, if/when you have control of JavaBean model it's better to add formatting right here as property -- with calculated attributes you have to duplicate these calculated attributes in every non-mapped node. If you are using formatted output only for display you may use read-only properties (getter only). Otherwise just create something like getPhoneFormatted / setPhoneFormatted right into your JavaBean (same logic as for getter/setter in blog post).

After adding properties to JavaBean you have either to re-import model or add properties manually to corresponding Model Classes generated by wizard. Follow standard naming convention in later case: <i>String getPhoneFormatted()</i> becomes property <i>phoneFormatted</i> of built-in DDIC type <i>string</i>.

Valery Silaev

SaM Solutions

http://www.sam-solutions.net

Former Member
0 Kudos

Bharathwaj and Valery - thank you for your posts... I will check your suggestions.

Regards,

Michal

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

Have you explored the possibility of using calculated attributes for this requirement !

<a href="/people/valery.silaev/blog/2005/11/29/800format-your-way Data - Valery 's Weblog</a>

Search for calculated attributes in help.sap.

This might help.

Regards

Bharathwaj