on 02-20-2015 7:56 AM
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.
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
Hi Rico,
We are also experiencing the same problem. Did you happen to get a solution.
So far what I did was.
1.) In SOTR_EDIT, I added text label entry. The Alias is ZP_SRM/ZMAXORDER
2.) In SPRO ->Configure Extension and Field Controls, under View key wi_home_searchrslt, I added field name ZMAXORDER. With Binding Element ZMAXORDER and Label text for field ZP_SRM/ZMAXORDER
3.) In my code, I call the label text as
new sap.ui.commons.Label({ text : Appcc.getText("ZMAXORDER") + ":" })
I was able to get the data from ZMAXORDER but I cannot get the label for ZMAXORDER.
Thanks,
HMN
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Rico,
Have a look at how standard textcollection is created in the sap system /srmnxp/cl_gateway_utilities->get_otrs. You can do something similar.
Cheers,
Archish
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.