cancel
Showing results for 
Search instead for 
Did you mean: 

consume SAP BUSINESS service layer odata into SAPFIORI app

Former Member
0 Kudos
  • Step 1: create XS project in HANA Studio

    Step 2: copy SAP WEB-IDE sapui5 code(web-content folder) to project.

    Step 3: make AJAX POST call as per below

    var jData = JSON.stringify({UserName: "manager", Password: "1234", CompanyDB: "XXXX"});
    var t;
    $.ajax({
    // the URL for the request

    <strong> url: "<a href="https://192.168.1.156:50000/b1s/v1/Login">https://<Public server IP>:50000/b1s/v1/Login</a>",</strong>

    // the data to send (will be converted to a query string)

    data: jData,

    // whether this is a POST or GET request
    type: "POST",
    async:false,
    //headers: { 'Access-Control-Allow-Origin:': '*' },
    // the type of data we expect back
    //dataType: "jsonp",
    //dataType : "text",
    // code to run if the request succeeds;
    // the response is passed to the function
    success: AjaxSucceeded,

    // code to run if the request fails; the raw request and
    // status codes are passed to the function
    error: AjaxFailed
    });
    function AjaxSucceeded(result) {
    alert("hello"+result);
    alert(result.d);
    }
    function AjaxFailed( XMLHttpRequest, status, errorThrown ) {
    $('#connectedError').modal('show');
    console.log( "Error: " + errorThrown );
    console.log( "Status: " + status );
    console.dir( XMLHttpRequest );
    }

    Step 4: Publish code to HANA XS engine by right click to HANA studio project and inside team --> publish

    Step5 : Access project in browser from below URL.

    https://<HANA IP>:4300/<project Name>/WebContent/index.html

    Step6 : showing error in consoleattachment1.png. But in Network tab its showing 200 ok .Attachment 2.attachment2.png

    So AJAX request success function won't call and because of that I unable to get session ID for login request

Accepted Solutions (0)

Answers (1)

Answers (1)

duncanspeidel
Advisor
Advisor
0 Kudos

Did you set

  1. “MetadataWithoutSession”: true
  2. “WCFCompatible”:true
in your b1s.conf file? This is described in more detail on

https://blogs.sap.com/2015/07/15/how-to-consume-service-layer-odata-services-from-net-via-wcf/

. Best regards,

Duncan