Skip to content

B1 Actions

The B1 actions allow you to interact with SAP Business One Service Layer, enabling authentication and currency rate management directly through the robot.


b1.login

Logs in to SAP B1 via Service Layer and returns the active connection to be used in other actions.

Parameters:

  • service_layer_url – Service Layer URL.
  • company_db – Company database name.
  • username – SAP B1 username.
  • password – SAP B1 password.
  • verify – (optional, default True) Whether to verify the SSL certificate.

Returns:

  • b1_connection – Active connection object with SAP B1.
Usage Example
script.mvn
result = b1.login(
    service_layer_url="https://sap-server:50000/b1s/v1",
    company_db="SBODEMO",
    username="manager",
    password="1234"
)

prompt.alert("Connected to SAP B1")

b1.set_currency_rate

Sets the exchange rate for a specific currency in SAP B1.

Parameters:

  • b1_connection – Active connection obtained with b1.login.
  • currency – Currency code (e.g., "USD", "EUR").
  • rate – Exchange rate value (float greater than 0).
  • rate_date – Rate date in format YYYYMMDD.

Returns:

  • {} – Empty return on success.

Exceptions:

  • SapB1InvalidRate – When rate is less or equal to zero.
  • SapB1InvalidDate – When the date is invalid.
  • SapB1InvalidCurrency – When the currency is invalid.
  • SapB1ConnectionError – When communication with B1 fails.
Usage Example
script.mvn
conn = b1.login(
    service_layer_url="https://sap-server:50000/b1s/v1",
    company_db="SBODEMO",
    username="manager",
    password="1234"
)

b1.set_currency_rate(
    b1_connection=$conn.b1_connection,
    currency="USD",
    rate=5.15,
    rate_date="20230822"
)

prompt.alert("Currency rate set successfully!")