Hi,
last Week I started with SAPUI5 and JavaScript within my SAP SRM System. I never worked with JavaScript and so on before.
I followed the Cookbook to add Custom fields with my search result list.
Extensibility in SAP SRM User Interface Addon 1.0
The Cookbook was hiding one of the most essential parts , adding the custom fields to trex model, to keep this working. But I solved it by myself.
Now I wanted to add my Custom fields in other view, like Produkt Details to.
Therefore I created a Custom JS and put the path to the customizing.
function modify_dynamic() { if (sap.ui.getCore().byId('zcustomlayout') != undefined) { sap.ui.getCore().byId('zcustomlayout').destroy(); }; // "get DOM Element by classid" var oElement = document.getElementsByClassName("listProdDetails sapUiVlt sapuiVlt")[0]; if (oElement != undefined) { // "get oData model" var srview = sap.ui.getCore().byId('mini_search_results'); var data = srview.getController().getSelectedModel(); // "create customer fields" oRsaetze = new sap.ui.commons.TextView( { text: "{/RSAETZE}"}); zcontent2 = new sap.ui.commons.layout.HorizontalLayout("zcustomlayout", { content : [ new sap.ui.commons.Label({ text : Appcc.getText("RSAETZE") + ":" }), new sap.ui.commons.TextView().setText(data.RSAETZE) ] }); zcontent2.addStyleClass("listProdDetails"); var zid = oElement.attributes.valueOf("id")[0].nodeValue; var zcontent = sap.ui.getCore().byId(zid); //zcontent.addContent(zcontent2); zcontent.insertContent(zcontent2, 9); }
As you see within my Screenshot and Coding the Custom Field "RSAETZE" Appears and the Data is filled. Thats great but one Problem exists!
I found in severals SAP JS Coding a solution to add Label text from OTR depending on User language.
Coding is:
Appcc.getText("RSAETZE")
I found out, that this is an App Controller. Within Browser I found out there is an Object containing all these Texts translation Called Appcc textManager
Theare are several text stored in the logon language of the current user.
Long story short:
My Question is, how can I add texts to this textManager to call them within my Coding?
Is there another solution to get texts from OTR or from somewhere else depending on user logon language?
Hope someone can tell.
Thank you very much
Regards
Rico