cancel
Showing results for 
Search instead for 
Did you mean: 

Extending a formatter

11-29-2023 3:19 PM
JaySchwendemann Active Contributor
561 views 0 comments
0 Likes
SAP Managed Tags
Subscribe

Hi all,

we have a requirement to extend the good ol' "Approve Purchase Orders" fiori app with an ECC (Business Suite) backend and a hub server based on FES for S4H 2021.

Within there lives a formatter called "accountingFormatter". My goal would be to prefix the normal outcome, say "Cost Center 123" with the internal type so say the result would be "K - Cost Center 123".

I followed this guide. My own /util/Conversions.js file looks like this

jQuery.sap.declare("ui.s2p.mm.purchorder.approve.MM_PO_APVExtension.util.Conversions");<br>jQuery.sap.require("ui.s2p.mm.purchorder.approve.util.Conversions");<br>// now actually redefining / overriding the standard formatter<br>ui.s2p.mm.purchorder.approve.util.Conversions.accountingFormatter = function(oHeaderInfo) {<br>    // exit when not yet ready<br>    if (!oHeaderInfo) {return;};<br>    // Debug<br>    return 'This is from the new custom formatter, but how to call the original one?';<br>}

However... now that I seemed to have bulldozered over the original implementation by jQuery.sap.declare/require I fail to call the original implementation.

Ideally I would like to have some "call super / parent" within my implementation and then only prefix the result from standard with my own calculation.

Currently, everything I tried resulted in calling my own implementation so I currently ended with basically duplicating all the code from the standard formatter and adjust to my own likings. However I would rather prefer just a "call super".

Is this possible? If so, was my general approach the way this should be done or would I need to do something completely different?

Many thanks and kind regards

Jens

0 Likes

Accepted Solutions (0)

Answers (0)