Skip to Content
avatar image
Former Member

OTR-Label for Custom fields SRM UI Add-on

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • avatar image
    Former Member
    Jul 09, 2015 at 12:20 AM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Feb 08, 2016 at 12:06 PM

    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

    Add comment
    10|10000 characters needed characters exceeded