web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Custom Connector for S...
Power Automate
Unanswered

Custom Connector for SAP Business One using Service Layer

(0) ShareShare
ReportReport
Posted on by

Hi there Community!

Happy 2022!!

So, we’ve developed an app to register some useful information to our production lines. To be specific, we use SAP Business One on Hana and whenever we have a production order we read this information from our app and should register new info on specific user fields already created on SAP. We can already read tables and info without problem, but when we want to write the trouble begins…

To write on SAP Hana we should use Service Layer but we get error 401 / 301, see below.

We try connecting with POSTMAN and everything is ok, but when we try the same GET on powerapps we can’t get to save cookie/session , so we get invalid session.

Your help is pretty much appreciated and please let me know if we could move forward on something…. below all the info I have:

Entries:

B1SESSION=9382da7c-68aa-11ec-8000-005056a0f6df; ROUTEID=.node2

 

Body:

{

  "error": {

    "code": 301,

    "message": {

      "lang": "en-us",

      "value": "Invalid session or session already timeout."

    }

  }

}

 

Header:

{

  "Vary": "Accept-Encoding",

  "DataServiceVersion": "3.0",

  "x-ms-apihub-cached-response": "true",

  "Date": "Wed, 29 Dec 2021 13:24:22 GMT",

  "Set-Cookie": "ROUTEID=.node3; path=/",

  "WWW-Authenticate": "Basic realm=/b1s/v1/InventoryGenEntries(26193)",

  "Content-Type": "application/json; charset=utf-8",

  "Content-Length": "164"

}

 

-------

 

Unprocessed entries:

{

    "host": {

        "connectionReferenceName": "shared_conexion-20postman-20sap-20-2d-20no-20auth-5fbb-be18e6deead69675",

        "operationId": "GET_ReciboProduccion_26193"

    },

    "parameters": {

        "Cookie": "B1SESSION=9382da7c-68aa-11ec-8000-005056a0f6df; ROUTEID=.node2"

    }

}

 

Unprocessed outputs:

{

    "statusCode": 401,

    "headers": {

        "Vary": "Accept-Encoding",

        "DataServiceVersion": "3.0",

        "x-ms-apihub-cached-response": "true",

        "Date": "Wed, 29 Dec 2021 13:24:22 GMT",

        "Set-Cookie": "ROUTEID=.node3; path=/",

        "WWW-Authenticate": "Basic realm=/b1s/v1/InventoryGenEntries(26193)",

        "Content-Type": "application/json; charset=utf-8",

        "Content-Length": "164"

    },

    "body": {

        "error": {

            "code": 301,

            "message": {

                "lang": "en-us",

                "value": "Invalid session or session already timeout."

            }

        }

    }

}


Error details:
image001.png

Example GET:
image002.png

 

Thank you for your help!!

Categories:
I have the same question (0)
  • Patrick Hess Profile Picture
    on at

    jcfabres,

     

    This looks like a pretty straightforward 401, that seems like the thing to focus on. POSTMAN is a great start but it's not always enough because you're adding additional layers when you put this into practice with a canvas app.

     

    We have to account for...

     

    • Licensing of the account making the request, needs to be a Premium type.
    • Permissions on the SAP itself to honor the request, especially if some stored procedure or function is involved.
    • Sufficient security roles assigned to the user on the environment housing the canvas app.
    • Permissions over the on-premises gateway allowing you to interact with the on-premises API/configuration.
    • Permissions to any Azure AD apps that you're leveraging.
    • Azure AD may have other considerations, as well; for example, are you using a service principal?

     

    You may not be capturing all of these additional concerns in your POSTMAN setup.

     

    The below covers a lot of what I'm referring to:
    https://docs.microsoft.com/en-us/connectors/custom-connectors/ 
    https://powerapps.microsoft.com/en-us/blog/on-premise-apis/

     

    Related note, we do have a SAP ERP connector at this point:
    https://powerapps.microsoft.com/en-us/blog/introducing-the-sap-erp-connector/

     

    This connector works with HANA but I'm admittedly not sure if this is a fit for your SAP configuration.

     

    If you set up a support incident with us, we can give you some additional insight into the Flow errors and backend telemetry. I'll be up front that we are not design experts, though and we won't necessarily be able to take away the trial and error involved.

     

    Let us know!

     

    Patrick

  • Community Power Platform Member Profile Picture
    on at

    Hi there? Any luck with that?

    I have the Same problem

  • IamDrix Profile Picture
    2 on at

    try this.

    go to /usr/sap/SAPBusinessOne/ServiceLayer/conf
    open b1s-lb.conf

    look for <ifmodule mod_headers.c>

     

    then remove it the line or comment out with something like below.

    IamDrix_0-1663565681148.png

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 501 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 323 Moderator

#3
abm abm Profile Picture

abm abm 237 Most Valuable Professional

Last 30 days Overall leaderboard