SAPUI5 and OData dynamic Login

can anybody share some standard code that sapui5 and odata dynamic login screen navigation ?
Means User has to pass input Username and Password atrun time and get login.
Thank you in advanced

I am getting error at validation time but in browser it is working fine.
The error is Unauthorised credential.
I want to pass the credential in the following fields when I enter login ,I want to pass the values to SAP.
I am using the following code:
var oLayout = new sap.ui.commons.layout.AbsoluteLayout({width:"340px",height:"150px"});
oLayout.addStyleClass("CustomStyle"); //Add some additional styling for the border
var oLabel = new sap.ui.commons.Label({text:"User Name"});
var oNameInput = new sap.ui.commons.TextField({width:"190px"});
oLabel.setLabelFor(oNameInput);
oLayout.addContent(oLabel, {right:"248px",top:"20px"});
oLayout.addContent(oNameInput, {left:"110px",top:"20px"});
oLabel = new sap.ui.commons.Label({text:"Password"});
oPWInput = new sap.ui.commons.PasswordField({width:"190px"});
oLabel.setLabelFor(oPWInput);
oLayout.addContent(oLabel, {right:"248px",top:"62px"});
oLayout.addContent(oPWInput, {left:"110px",top:"62px"});
var oLoginButton = new sap.ui.commons.Button({text:"Login",  press :"login", width:"133px"});
//oLoginButton.attachPress(login());
oLayout.addContent(oLoginButton, {left:"110px",top:"104px"});
// Attach the layout to the page
oLayout.placeAt("content");
</script>
  <script>
  login : function(oEvent) {
      jQuery.sap.require("sap.ui.model.odata.datajs");
      var serviceURI = "http://192.168.0.7:8000/sap/opu/odata/sap/YNEW_SRV/";
                var username = sap.ui.getCore().getControl("oNameInput") .getValue();
                var password = sap.ui.getCore().getControl("oPWInput") .getValue();
      var request = {
                headers : {
                                  "X-Requested-With" : "XMLHttpRequest",
                                   "Content-Type" : "application/atom+xml",
                                   "DataServiceVersion" : "2.0",
                                   "X-CSRF-Token" : "Fetch"
                                                                       requestUri : serviceURI,
                                                                       method : "GET",
                                                                       user : username,
                                                                       password : password
                                                               OData.request(request, function(data) {
                                                                       alert("success");
                                                             }, function(err) {
                                                                       alert('Error Code:'+ err.response.statusCode);
  </script>
Thank you Naveenraj

Similar Messages

  • SAPUI5 and oData: Task completion problem

    Dear all,
    We've got a BPM process which is based on WDJ approval screens.
    Now I would like to replace WDJ by SAPUI5.
    I've succeeded to display some task input data in my SAPUI5 application:
    oPanel.bindElement("/InputData('"+taskId+"')", {expand:"ContextTypeINPUT/Context/Requester"});
    var oInputFirstName = new sap.ui.commons.TextField("textFirstName", {
        value : "{ContextTypeINPUT/Context/Requester/FirstName}"
    var oInputLastName = new sap.ui.commons.TextField("textLastName", {
        value : "{ContextTypeINPUT/Context/Requester/LastName}"
    But I can't manage to complete the task.
    For a simpler example that worked for me.
    It seems that I don't fill the output data correctly.
    Normally I should fill the Status (fields Action, ChangedBy, ChangedOn and Details) and the Request->ReferenceNumber:
    Please find attached the XSD of the task.
    I tried the following:
    var outputData = {};
    var status = odataModel.getProperty("/InputData('" + taskId "') " +
                      "/ContextTypeINPUT/Context/Status");
    status.Action = "approved";
    status.ChangedBy = "TEST";
    status.ChangedOn = "2014-07-29";
    outputData.HandleRequestCompleteEventTypeOUTPUT = status;
    // send request to BPM Task Data OData service to complete
    odataModel.create("/OutputData", outputData, null,
        function sendData_OnSuccess(oData, response) {
            alert("Task has been completed successfully");
        function sendData_OnError(oError) {
            alert("Task could not be completed");
    But it stops when executing the second statement (var status = odataModel.getProperty("/InputData('" + taskId "')...).
    I would really appreciate if you could help me!
    Thanks in advance.
    Best regards,
    Thorsten.
    P.S.: Our system is running NW 7.40 SP07.

    Hi again,
    As most of the time, I had to solve my issues published on SCN on my own
    My mistake was, that I've retrieved the 'handleRequestType' of my OutputData from the InputData.
    It seems that having all subtypes in the structure causes trouble, because I fill only to fill two fields.
    In the end I build OutputData myself and it works now...
    So in fact it's possible to create an proper OutputData without a binding of InputData.
    controller.js
    completeTask : function() {
    // Get TaskID and data model
    var taskId = getValueOfURLParameter("taskId");
    var odataModel = this.getView().getModel();
    // Create OutputData
    var outputData = {};
    // Create all needed subtypes
    var handleRequestType = {};
    var status = {};
    var request = {};
    // Fill values for fields that need to be sent
    status.ChangedBy = sap.ui.getCore().byId("inputStatus").getValue();
    request.ReferenceNumber = sap.ui.getCore().byId("inputRequest").getValue();
    // Build OutputData
    handleRequestType.Status = status;
    handleRequestType.Request = request;
    outputData.HandleRequestType = handleRequestType;
    // Complete task with built OutputData
    odataModel.create( "/OutputData", outputData, null,
         function sendData_OnSuccess(oData, response) {
              alert("Task has been completed successfully");
         function sendData_OnError(oError) {
              alert("Task could not be completed");
    view.js
    createContent : function(oController) {
    // Text input fields which will feed the OutputData
    var oInputStatus = new sap.ui.commons.TextField("inputStatus");
    var oInputRequest = new sap.ui.commons.TextField("inputRequest");
    // Button to complete the task
    var oButton = new sap.ui.commons.Button( {
         text : "Complete",
         style : sap.ui.commons.ButtonStyle.Accept,
         press : (function() {
         oController.completeTask();
    Just make sure that you explore your OuputData before via a tool like Postman (Chrome Addon).
    First do a GET request:
    http://<host>:<port>/bpmodata/taskdata.svc/<taskID>/OutputData
    Then look for a "/XYZ" part in the response.
    In my case it looked like that:
    <link href="OutputData('<TaskID>')" rel="edit" title="OutputData"/>
    <link href="OutputData('<TaskID>')/HandleRequestType" .../>
    So I could go on to explore my output data, by sending the following GET request in Postman:
    http://<host>:<port>/bpmodata/taskdata.svc/<taskID>/OutputData?$expand=HandleRequestType
    Now you have to repeat that until you find the data type that you want manipulate.
    If you found out how your OutputData looks like, you can build it easily on your own (see my controller.js).
    Maybe I'll write my first blog about it

  • Create a record using SAPUI5 and ODATA Service

    Hi there,
    since SPS6, SAP HANA should allow CRUD operations using an ODATA Service.
    That sounds nice and so I wanted to give it a try.
    I've started by creating a simple table and set up a tiny application that displays the data in a grid (using a JSON Model) and allows to insert new records by entering data into two textfields and save them as a new record to the databse. That works well, the grid shows the records which I have created using the SAP HANA Studio.
    So I wanted to create new records, and the documentation says very clearly how to create a new record.
    I've tried it this way, but when the request is send I get an 501 Not Implemented error.
    Thats the code I'm using in my SAVE-Button:
    btnSave.attachPress(function() {
       var entry = {};
       entry.id = tfUserId.getValue();
       entry.username = tfUserName.getValue();
       oData.create('/tbl_user', entry, null,
       function() {
          alert("Create successful");
       function() {
          alert("Create failed");
    After that I've tried to create a record using the POSTMAN extension for Chrome browser as mentioned in this cool video by Thomas Jung.
    Unfortunately, this also doesn't work for me. After sending the request I get as respone a sap hana xs login window with Status Code 200 instead of a status code "201 created".
    Here's a screenshot:
    I'm using SAP HANA Cloud Trial.
    Anybody got an idea what I'm doing wrong? Or does ODATA CRUD not work an SAP HANA Cloud Trial?
    Many thanks,
    ben

    Hi Jason,
    exactly, it's the logon page returned that is opened when I open the service URL in the browser. After logging on I can see the results of the ODATA service call.
    The URL must be correctly defined, the grid shows up the data from the ODATA Service.
    And yes, the URL looks OK when expecting in Chrome developer tools...
    Thanks,
    ben

  • Dynamic Login Environment with LDAP and Database level security.

    JDeveloper 11.1.1.0.1 + ADF BC + ADF RC
    Hi everyone,
    We are ready to begin creating a dynamic login environment.
    We would like to be able to keep security on the database side, instead of in the application layer.
    We also want to be able to use Oracle LDAP for authentication.
    Can anyone suggest any good documentation for our situation?
    Highly appreciated. Thanks!

    Alexander,
    unlike in Forms, authentication is separate from connection. You can have individual user connections - like in Forms - but this most likely is not of best performance. A document and example for this to follow is
    http://radio.weblogs.com/0118231/2008/08/06.html#a902
    Note that authentication does not need to be hard coded in either way. If you use a single database connection and container managed authentication, then all users access the database from the same user account but can have their authenticated names passed through. In ADF BC you can use the prepareSession method on the ApplicationModule to pass the name to the database as a prepared statement (e.g. to set the predicate on a VPD database). However, using PLSQL for authorization is a bit difficult because the business logic, unlike in Forms isn't executed in PLSQL. You can look up PLSQ from ADF BC - or Java in general - but its a separate call.
    Frank

  • Dynamic Login Page & Logo

    How can I have a dynamic login page and logo. I am developing an app which will be used by two different groups, so depending on the group, they should see a different homepage/logo etc. Is that possible? Do I need to have two different login pages?
    Also the "Change a Logo in a Page Template" topic is obsolete in htmldb how to section:
    http://www.oracle.com/technology/products/database/htmldb/howtos/howto_change_logo.html

    Anonymous - The logout URL, which is editable as an attribute of the authentication scheme, specifies the page or URL to go to after logout. You might want to change that target to a common page that does a before-header branch to any of several pages based on session state. Or you can display different logout URLs without using the logout url and its substitution variable (&LOGOUT_URL.) in the navigation bar icon, but simply display whatever logout URL works for the current user so it results in their going to the desired page after logout.
    Scott

  • I am using the mac QQ and when I login it said login timeout.

    I am using the mac QQ and when I login it said login timeout.

    If you are missing using google maps - try the Nokia map app called "here"

  • How to change header and footer in login page in oracle apps r12

    Hi all,
    how to change header and footer in login page in oracle apps r12 and login button background color, please help me
    thanks
    saran

    how to change header and footer in login page in oracle apps r12 and login button background color, please help meTips For Personalizing The E-Business Suite R12 Login Page (MainLoginPG) [ID 741459.1]
    How to Personalize Login page in R12? [ID 579917.1]
    R12 Login Page: How to Personalize the Logo ? [ID 849752.1]
    Thanks,
    Hussein

  • EDGE and HTML dynamic text in a "box" with scroll bar

    I'm new to EDGE, a win7pro master collection cs5.5 suite owner. I'm mainly in the Film/Video post production field (mostly AE, PPro, Pshop, IA) but have been branching into web design the last couple of years.  I use Dreamweaver, Fireworks, Flash. While I'm a expert user with all the Film/video apps, I would say I only have intermediate ability with the web apps. While I understand a lot of programing logic bulding blocks I'm not a coder.
    So since we're told "flash is dead",  my interest in Edge is to try to do some of the things that I can currently do in flash in  EDGE. I was excited when Edge first came out but lost interest when it became obvious that Adobe was not going to offer Edge and Muse to "suite owners" but only in their force feeding of the "Cloud". Better known as the "golden goose" for adobe stockholders and a never ending perpetual hole in the pocket for users. Anyway....
    I spent the last couple of days doing some of the tuts and messing with the UI. It's matured a lot since I was here last.
    I've been working on a flash site for a sports team where one of the pages is a player profile page where college recuriters and other interested parties can view recuriting relavent info/stats about players. This is how it works. While on the "Team" page a users clicks on  a button labled "Player Profiles" . (Animation) A "page" flies in and unfurls from the upper right corner (3d page flips effect created in AE played by flash as a frame SEQ). Once it lands filling most of the center of the screen there is a bright flash. As the brightness fades we see the "page" is a bordered box with a BG image of a ball field(End). (Animation) from behind the border in fly small pictures (player head shots with name and jersey number). They stream in and form a circle like a wagon train and the team logo zooms up from infinity to the center of the circle(End). As the user mouses over a player's pic it zooms up a little and gets brighter (like mouseover image nav thumbs for a image slider). If the user clicks on a player's head shot it flips over and scales up to become a text box with a scrollbar. The content of the box is a mix of images, static and dynamic text fields populated from data in an "player info data base" XML file, and some hyperlinks. It's all kept updated dynamicaly with current stats, info and images from the XML file. There is also a "PDF" button that allows the user to open/save/print a PDF of the player's profile (the PDF's are static files for now but the choice of which pdf to retrive is dynamicaly supplied via the XML file.
    So.... Is Edge now able to do something like this?  Would it need to be a collection of small animations? could these be "assembled" and connected as an asset in dreamweaver ?
    I thought I would approach this from the end (ie click on an image and display a box with dynamic TEXT fileds. ) since that is the most important part, ie displaying the dynamicaly updated profile info.  Sooooo....
    Can Edge display a scrolling text box with Images, static text, and html dynamic text in it??
    Joel

    The code is in composition ready. Click the filled {}

  • I have version 3.6.16 and when I login to my hotmail account, and type the first letter of the email address, a drop down box appears with my hotmail address and I can choose it from that box with a click. How do I get version 4 to do this? Thanks.

    I have version 3.6.16 and when I login to my hotmail account, and type the first letter of the email address, a drop down box appears with my hotmail address and I can choose it from that box with a click.
    How do I get version 4 to do this?
    Thanks.

    The new but not-ready-for-prime-time autocomplete method searches for matches that contain the entered text, not just ones that begin with the string. Your options are:
    1) type in longer strings that narrow the search
    2) use an add-on to search just the beginnings:
    https://support.mozilla.org/en-US/questions/1037469
    3) install an older version of TB:
    http://ftp.mozilla.org/pub/mozilla.org/thunderbird/releases/

  • My Macbook Pro is frozen on the login page with a white screen and only my login picture. How do I fix this? I can't turn it off and I closed it and let it charge but it's still not working.

    My Macbook Pro is frozen on the login page with a white screen and only my login picture. How do I fix this? I can't turn it off and I closed it and let it charge but it's still not working. It's only 3 months old and was working perfectly fine 30min before this happened.

    Hello Kierasully,
    I would start your troubleshooting with the article below for issues of not being able to log in to your Mac. Start with booting up in to Safe Boot as well as resetting PRAM on your Mac. If that does not work, then verify the hard drive with booting to the Recover HD and go to Disk Utility to verify it.
    Mac OS X: Gray screen appears during startup
    http://support.apple.com/en-us/ts2570
    Regards,
    -Norm G. 

  • I have a iphone 5 and I can login with my apple id to purchase music. However, when I try to login into icloud using the very same username and password that I use in the apple store it does not work to enter icloud, so what what gives???

    I have a iphone 5 and I can login with my apple id to purchase music. However, when I try to login into icloud using the very same username and password that I use in the apple store it does not work to enter icloud, so what what gives???

    I could do that, however when I select the icloud button (or whatever the heck it is) I am asked to enter the apple id and password. So if you are suppose to create another one for icloud you'd think it would give you the option at this point which would be logical.

  • How to change the Default login script and the USER login script in Netware3.12

    I need to cut down the disk map from Neware 3.12 in Win98 client's PC.
    please tell me
    how to change the Default login script and the USER login script in
    Netware3.12 ?
    Or is there any other ways to do this thing?
    Thanks a lot!

    On 4/6/2006 [email protected] wrote:
    > how to change the Default login script and the USER login script in
    > Netware3.12 ?
    Please repost in the discontinued.forums.
    Edison Ortiz
    Novell Product Support Forum SysOp
    (No Email Support, Thanks !)

  • Why do my firewalls only use the domain username and password for login and enable passwords, not a different enable password like my switches do? The RADIUS config looks the same...

    /* Style Definitions */
    table.MsoNormalTable
    {mso-style-name:"Table Normal";
    mso-tstyle-rowband-size:0;
    mso-tstyle-colband-size:0;
    mso-style-noshow:yes;
    mso-style-priority:99;
    mso-style-parent:"";
    mso-padding-alt:0in 5.4pt 0in 5.4pt;
    mso-para-margin:0in;
    mso-para-margin-bottom:.0001pt;
    mso-pagination:widow-orphan;
    font-size:10.0pt;
    font-family:"Times New Roman","serif";}
    Issue:
    Cisco firewalls require only one level of password i.e. the domain username and password are used for both logging in as well as reaching global configuration mode.
    Background:
    We have multiple Cisco network devices set up which authenticate to our Windows domain controller using NPS (Windows 2008 R2). The switches we have set up all function exactly as we would hope as they require your domain username and password to login to the device. They then require a separate password when you use the enable command, this is stored in Active Directory:
    Switches:
    Username:domain-username
    Password:domain-password
    SWITCH>enable
    Password:enable-password-in-Active-Directory
    SWITCH#
    Firewalls (as they currently are):
    Username:domain-username
    Password:domain-password
    FIREWALL>enable
    Password:domain-password
    FIREWALL #
    With the firewalls however, they require your domain username and password first, and then your domain password again when using the enable command. I want the firewalls to use the enable level password that the switches currently use instead of the domain password again. The current configuration look like the following:
    Current switch configuration:
    aaa new-model
    aaa authentication login default group radius local
    aaa authentication enable default group radius enable
    aaa authorization exec default group radius local
    aaa session-id common
    radius-server host 192.168.0.1 auth-port 1645 acct-port 1646
    radius-server source-ports 1645-1646
    radius-server key 7 1234abcd
    Current firewall configuration:
    aaa-server DC01 protocol radius
    aaa-server DC01 (outside) host 192.168.0.1
    aaa authentication ssh console DC01 LOCAL
    aaa authentication enable console DC01 LOCAL
    key 1234abcd
    Any help would be great, thanks!

    Cisco ASA works that way by design. You could remove "aaa authentication enable" and then you could use the "enable password" command to set your enable password.
    But if you do that, then ASA would change your username to "enable_15". That would break Authorization and Accounting if you're using them. Let me clarify with an example
    Firewalls :
    Username:domain-username
    Password:domain-password
    FIREWALL>show curpriv
    Username : domain-username
    Current privilege level : 1
    Current Mode/s : P_UNPR
    FIREWALL>enable
    Password:enable-password-from-running-config
    FIREWALL #show curpriv
    Username : enable_15
    Current privilege level : 15
    Current Mode/s : P_PRIV
    If you're using Authorization and Accounting it's recommended to stick with your current behavior.

  • I am trying to setup iCloud account and when I login I see a popup. The Maximum number of free accounts have been activated on this iPhone. Pls, help me fix it. What other accounts? Thanks

    I am trying to setup iCloud account and when I login I see a popup. The Maximum number of free accounts have been activated on this iPhone. Pls, help me fix it. What other accounts? Thanks

    Then you'll have to use another iOS device or Mac running OS X Lion or higher to create a new account for you to use on your phone.  If you don't have one, perhaps a friend would allow you to create and account on their device (note: this will use one of their three maximum accounts).  To do this, they would need to go to Settings>iCloud, tap Delete Account (which will delete the account from their device but not from iCloud), then allow you to sign back in with your ID to create the new account.  Then tap Delete Account to delete the new account from their device, and finally, sign back in with their iCloud ID to restore their iCloud account to their device.  Then you can sign in with your ID on your phone in Settings>iCloud and use the new account.

  • Excel and Word dynamic VIs broken

    I upgraded from Labview 8.5.1 to 8.6 and tried to upgrade the microsoft office report generation toolkit at the same time but got an error as I am using office 2000 (not compatible with the new toolkit).  Now, I can add the word and excel dynamic VIs to a project and add them to an application build but when I try to build the exe I get an error saying the word and excel VIs are broken.  Looking at the Excel VI shows an error "SubVI 'NI_Excel.lvclass:Excel_Get_Properties.vi': required input 'report in' is not wired".  The Word VI gives three similar errors.  Is there a known problem or workaround for this?

    Hi zeppelin_79,
    Can you provide me with the screenshots of the error?
    From my experience, Common error came up when we upgrade the Microsoft Office versions. Since, different version of Microsoft Office might have different attributes that being access by the Report Generation Toolkit for Microsoft Office.
    In the meantime, try to do what this article recommended:
    Broken Run Arrow When Using Excel Get Data VI in My Application
    http://digital.ni.com/public.nsf/allkb/77D87AC905ECE51386256DE50077D6C0?OpenDocument
    Let me know if the problems are still persist.
    Sincerely,
    Krisna Wisnu
    Message Edited by Krisna Wisnu on 10-07-2008 03:09 AM
    Message Edited by Krisna Wisnu on 10-07-2008 03:10 AM
    Sincerely,
    Krisna Wisnu

Maybe you are looking for