This Space has blogs on various topics in the field of SAP. These blogs point out solutions to various technical and functional issues that consultants face during implementation or support of SAP Projects. Readers/followers are welcome to contribute to this space by emailing your content at bohra.mohammadi@gmail.com. You will be rewarded according to the topic/number of words/complexity of the topic/issue which are you addressing in your blog.
Monday, May 22
SAPUI5 Table Binding with Data Coming from Backend
The Data that need to be displayed on SAPUI5 Table control resides of a backend system. The Data is fetched via oData services read call and rendered in table UI Control in below fashion
oModelECST_FETCH.read(url5,null, null, true, function(oData, oResponse){ debugger;
oInvoices = new sap.ui.model.json.JSONModel({ "Invoices" : oData.results }); oInvoices.iSizeLimit = 100000;
var tab =this.getView().byId("invoicestable"); // invoicestable is the ID of Table UI Control
tab.setModel(oInvoices);
var i=0;
tab.bindAggregation("items", {
path: "/Invoices",
template: new sap.m.ColumnListItem({
cells: [
//
new sap.m.CheckBox({visible:invoicesThat.strtoBool(oData.results[tableIndex1].Count)}).setSelected(true),
new sap.m.CheckBox("cbinv",{visible:"{Count}", selected:"{Sel}"}),
new sap.ui.commons.TextView({ text: "{InvNo}", design:"Standard", semanticColor:"Default"}),
new sap.ui.commons.TextView({ text: "{InvDate}", design:"Standard", semanticColor:"Default"}),
new sap.ui.commons.TextView({ text: "{Tin}" , design:"Standard", semanticColor:"{semCol}"}),
// new sap.ui.commons.TextView({ text: "{FormNum}", design:"Standard", semanticColor:"Default"}),
new sap.ui.commons.TextView({ text:"{TypeOfTx}",design:"Standard",semanticColor:"Default"}),
new sap.ui.commons.TextView({ text: "{TaxableGoodsVal}", design:"Standard", semanticColor:"Default"}),
new sap.ui.commons.TextView({ text: "{AmtTaxVal}", design:"Standard", semanticColor:"Default"}),
new sap.ui.commons.TextView({ text: "{InclTaxVal}", design:"Standard", semanticColor:"Default", visible:inctaxval}),
new sap.ui.commons.TextView({ text: "{LabourChrgesVal}", design:"Standard", semanticColor:"Default",visible:labchargval}),
new sap.ui.commons.TextView({ text: "{OtherChrgesVal}", design:"Standard", semanticColor:"Default"}),
//new sap.ui.commons.TextView({ text: "{LabourChrgesVal}", design:"Standard", semanticColor:"Default"}),
new sap.ui.commons.TextView({ text: "{GrossTotalVal}", design:"Standard", semanticColor:"Default"}),
]
})
});
},function(err){
debugger;
});
oModelECST_FETCH.read(url5,null, null, true, function(oData, oResponse){ debugger;
oInvoices = new sap.ui.model.json.JSONModel({ "Invoices" : oData.results }); oInvoices.iSizeLimit = 100000;
var tab =this.getView().byId("invoicestable"); // invoicestable is the ID of Table UI Control
tab.setModel(oInvoices);
var i=0;
tab.bindAggregation("items", {
path: "/Invoices",
template: new sap.m.ColumnListItem({
cells: [
//
new sap.m.CheckBox({visible:invoicesThat.strtoBool(oData.results[tableIndex1].Count)}).setSelected(true),
new sap.m.CheckBox("cbinv",{visible:"{Count}", selected:"{Sel}"}),
new sap.ui.commons.TextView({ text: "{InvNo}", design:"Standard", semanticColor:"Default"}),
new sap.ui.commons.TextView({ text: "{InvDate}", design:"Standard", semanticColor:"Default"}),
new sap.ui.commons.TextView({ text: "{Tin}" , design:"Standard", semanticColor:"{semCol}"}),
// new sap.ui.commons.TextView({ text: "{FormNum}", design:"Standard", semanticColor:"Default"}),
new sap.ui.commons.TextView({ text:"{TypeOfTx}",design:"Standard",semanticColor:"Default"}),
new sap.ui.commons.TextView({ text: "{TaxableGoodsVal}", design:"Standard", semanticColor:"Default"}),
new sap.ui.commons.TextView({ text: "{AmtTaxVal}", design:"Standard", semanticColor:"Default"}),
new sap.ui.commons.TextView({ text: "{InclTaxVal}", design:"Standard", semanticColor:"Default", visible:inctaxval}),
new sap.ui.commons.TextView({ text: "{LabourChrgesVal}", design:"Standard", semanticColor:"Default",visible:labchargval}),
new sap.ui.commons.TextView({ text: "{OtherChrgesVal}", design:"Standard", semanticColor:"Default"}),
//new sap.ui.commons.TextView({ text: "{LabourChrgesVal}", design:"Standard", semanticColor:"Default"}),
new sap.ui.commons.TextView({ text: "{GrossTotalVal}", design:"Standard", semanticColor:"Default"}),
]
})
});
},function(err){
debugger;
});
Access UI Control and Its Children at Runtime to Modify Properties | UI5
Based on user actions/output of user action, sometimes, other UI control's properties change. This behavior can be achieved by accessing UI controls mAggregation node at run time and setting desired values in UI control properties. Example of modifying 'enabled' property of a button which resides within a List's Custom list Items at place number 2. First UI control is a label, Second is the Button whose property is required to be modified
Get Currently Logged in User in SAPUI5 application
Some times to your oData calls, you want to send logged in user as one of the attributes to the call. This is how you can obtain currently logged in user within SAPUI5 application.
var y = "/sap/bc/ui2/start_up";
var xmlHttp = null;
xmlHttp = new XMLHttpRequest();
xmlHttp.onreadystatechange = function() {
if (xmlHttp.readyState == 4 && xmlHttp.status == 200) {
var oUserData = JSON.parse(xmlHttp.responseText);
oLoggedinID = oUserData.id;
}
};
xmlHttp.open( "GET", y, false );
xmlHttp.send(null);
oLoggedinID will contain the login id of the person who has logged on.
thank you !
Mohammed Bohra
+91 8898030972
var y = "/sap/bc/ui2/start_up";
var xmlHttp = null;
xmlHttp = new XMLHttpRequest();
xmlHttp.onreadystatechange = function() {
if (xmlHttp.readyState == 4 && xmlHttp.status == 200) {
var oUserData = JSON.parse(xmlHttp.responseText);
oLoggedinID = oUserData.id;
}
};
xmlHttp.open( "GET", y, false );
xmlHttp.send(null);
oLoggedinID will contain the login id of the person who has logged on.
thank you !
Mohammed Bohra
+91 8898030972
UI5 screen not launching from MII Navigation menu
hi Aravinth,
When you run the application from MII navigation menu, perform a network trace to see which call is failing. Based on that further analysis can be done. Let me know if you can share your screen using AnyDesk software to enable me debug this further.
thank you !
Mohammed
Sunday, May 21
How modify the portal URL to browser default
Change the default portal URL to give users more user friendly URL that they are adapted to from the Internet. The following steps will show you how modify the URL from the default port of 50000 to 80 which is browser default
To Change the Port:
Switch to the J2EE Visual Administrator
Goto -> Cluster -> Dispatcher -> Services -> HTTP Provider
Choose Ports
Change the port number to 80 for HTTP and 443 for HTTPS (SSL)
Choose Update and save.
Stop and Start the HTTP Provider service.
Result:
http: http://hostname.company.com:50000/irj/portal to http://hostname.company.com
https: https://hostname.company.com:50000/irj/portal to https://hostname.company.com
To Change the Port:
Switch to the J2EE Visual Administrator
Goto -> Cluster -> Dispatcher -> Services -> HTTP Provider
Choose Ports
Change the port number to 80 for HTTP and 443 for HTTPS (SSL)
Choose Update and save.
Stop and Start the HTTP Provider service.
Result:
http: http://hostname.company.com:50000/irj/portal to http://hostname.company.com
https: https://hostname.company.com:50000/irj/portal to https://hostname.company.com
Friday, May 19
Portal Implementation Learning
@NIIT Technologies, Marwah Centre, Andheri (E), Mumbai
SAP Enterprise portal is single source of access various structured and unstructured information within an enterprise. In its raw format, sap_bluecrystal theme is assigned to portal desktop by default. Portal is delivered with various framework pages like classic, ajax, fiori launchpad etc...
I am trying to implement fiori launch pad. Few learning shared below
Iview Property for Fiori LaunchPad Tile Display
Object ID of Device Group property of iview governs the display of its tile on fiori launchpad. The value of the property must be set as com.sap.portal.dg.desktop;com.sap.portal.dg.smartphone;SmartphoneAndroid.
If the value is set to above, tile of this iview will display in Fiori launchpad else it will not display.
Activating UI Theme Designer in EP 7.3 and Above
From 7.3 version of portal onwards, UI Theme Designer tool is being delivered by SAP. This tool is better version of Theme Editor. It has better usability than Theme Editor which used to come during 7.0 version. UI Theme Designer link can be accessed from within Content Admin->Portal Display->Portal Themes->UI Theme Designer.
If you do not see UI Theme Designer link at above mentioned path, check for below
Go to nwa->configuration->infrastructure->application Modules. Search for 'lafservice' in Module list.In the 'Web Module Details', in the components tab, select 'laf'. In the portal service details, select 'Determine what will be the theme runtime provider'. Change its value to 'LESS'. By default it is blank. Click on Save. Now 'UI Theme Desginer' link should be visible in portal content admin->portal display->Themes.
Embedding EP Desktop within HTML Iframe
This is about a requirement from the client which requires EP desktop to be displayed within iframe of another website. If you give the URL of EP ie http://:50000/irj/portal directly as the scr value of iframe, portal will not load. There is a specific alias that SAP delivers to enable portal desktop to launch within an iframe. The Alias is called 'interop'. There is a special property, the alias has. It is called 'nested_window', the value of this property is set as 1. Check in system admin->system config->portal display->URL Alias Manager. Select Portal/interop
The limitation with interop desktop is only one iview which is the first iview of first page of first role assigned to the logged in user will be displayed. So basically, it displays only one iview at a time.
If you want to run EP end to end with all roles assigned to the logged in user, you can assign the same property to the desktop you are using. For example, if you are using fiori launch pad desktop, create a alias for that desktop and assign nested_window property the this alias. Now give EP URL alias to the src tag of iframe, EP Desktop will render fine within the iframe.
SAP Enterprise portal is single source of access various structured and unstructured information within an enterprise. In its raw format, sap_bluecrystal theme is assigned to portal desktop by default. Portal is delivered with various framework pages like classic, ajax, fiori launchpad etc...
I am trying to implement fiori launch pad. Few learning shared below
Iview Property for Fiori LaunchPad Tile Display
Object ID of Device Group property of iview governs the display of its tile on fiori launchpad. The value of the property must be set as com.sap.portal.dg.desktop;com.sap.portal.dg.smartphone;SmartphoneAndroid.
If the value is set to above, tile of this iview will display in Fiori launchpad else it will not display.
Activating UI Theme Designer in EP 7.3 and Above
From 7.3 version of portal onwards, UI Theme Designer tool is being delivered by SAP. This tool is better version of Theme Editor. It has better usability than Theme Editor which used to come during 7.0 version. UI Theme Designer link can be accessed from within Content Admin->Portal Display->Portal Themes->UI Theme Designer.
If you do not see UI Theme Designer link at above mentioned path, check for below
Go to nwa->configuration->infrastructure->application Modules. Search for 'lafservice' in Module list.In the 'Web Module Details', in the components tab, select 'laf'. In the portal service details, select 'Determine what will be the theme runtime provider'. Change its value to 'LESS'. By default it is blank. Click on Save. Now 'UI Theme Desginer' link should be visible in portal content admin->portal display->Themes.
Embedding EP Desktop within HTML Iframe
This is about a requirement from the client which requires EP desktop to be displayed within iframe of another website. If you give the URL of EP ie http://
The limitation with interop desktop is only one iview which is the first iview of first page of first role assigned to the logged in user will be displayed. So basically, it displays only one iview at a time.
If you want to run EP end to end with all roles assigned to the logged in user, you can assign the same property to the desktop you are using. For example, if you are using fiori launch pad desktop, create a alias for that desktop and assign nested_window property the this alias. Now give EP URL alias to the src tag of iframe, EP Desktop will render fine within the iframe.
Wednesday, May 17
Logon to SAP EP Programatically by using UMFactory's LogonAuthenticator.Logon
@ NIIT Technologies, Marwah Centre, Mumbai
I am trying to write a java program which logs on a user to SAP EP with a user and password provided to the program. Some literature about it is available on the internet but no luck since couple of days. People are talking about using UMFactory's LogonAuthenticator.Logon method to log the user in. I tried it with various authentication schemes like basicauthentication, uidpwdlogon, certlogon etc but failed every time unfortunately. There are no error logs getting generated in the stack traces of server to guide me further towards solution.
Logon by posting j_user and j_password to EP URL.
I am alternatively posting j_user and j_password variables to EP URL to log the user on. It works. See below form for reference.
For the former method, I am could see that in authentication of EP in nwa, below message about authentication policies is being displayed. I beleive, the warning being displayed in causing the problem
The message is 'There are conflicting policy configurations: [anonymous,default,certlogon,uidpwdlogon,UserAdminScheme,basicauthentication]'
My Source code the for the former approach
request.setAttribute(ILoginConstants.LOGON_UID_ALIAS,"useridtest");
request.setAttribute(ILoginConstants.LOGON_PWD_ALIAS,"passwordtest");
try
{
UMFactory.getLogonAuthenticator().logon(request, response, "uidpwdlogon");
}
catch(javax.security.auth.login.LoginException e)
{
out.println (e.getStackTrace());
}
Result printed on screen from stack Trace[Ljava.lang.StackTraceElement;@35ab660e
All suggestions to above problem are welcome.
I am trying to write a java program which logs on a user to SAP EP with a user and password provided to the program. Some literature about it is available on the internet but no luck since couple of days. People are talking about using UMFactory's LogonAuthenticator.Logon method to log the user in. I tried it with various authentication schemes like basicauthentication, uidpwdlogon, certlogon etc but failed every time unfortunately. There are no error logs getting generated in the stack traces of server to guide me further towards solution.
Logon by posting j_user and j_password to EP URL.
I am alternatively posting j_user and j_password variables to EP URL to log the user on. It works. See below form for reference.
For the former method, I am could see that in authentication of EP in nwa, below message about authentication policies is being displayed. I beleive, the warning being displayed in causing the problem
The message is 'There are conflicting policy configurations: [anonymous,default,certlogon,uidpwdlogon,UserAdminScheme,basicauthentication]'
My Source code the for the former approach
request.setAttribute(ILoginConstants.LOGON_UID_ALIAS,"useridtest");
request.setAttribute(ILoginConstants.LOGON_PWD_ALIAS,"passwordtest");
try
{
UMFactory.getLogonAuthenticator().logon(request, response, "uidpwdlogon");
}
catch(javax.security.auth.login.LoginException e)
{
out.println (e.getStackTrace());
}
Result printed on screen from stack Trace[Ljava.lang.StackTraceElement;@35ab660e
All suggestions to above problem are welcome.
Subscribe to:
Posts (Atom)