# Gateway Service Setup - Hub scenario

## Create RFC Destination

If one does not already exist, create an SM59 destination which points from the gateway hub to the system where Looply is installed. It is recommended that a destination with the same name is created in all systems of the landscape (pointing to the relevant system each time) so that only 1 configuration entry covering all systems is created during the following steps.

## Create SAP System Alias

Create a System Alias using the RFC destination created in the previous step.

* In NW 740+ go to the IMG in transaction SPRO and open SAP Netweaver->SAP Gateway->OData Channel->Configuration->Connection Settings->SAP Gateway to SAP System->Manage SAP System Aliases
* In NW 7.0-731 go the IMG in transaction SPRO, and open SAP NetWeaver->Gateway->OData Channel->Configuration->Connection Settings->SAP Gateway to SAP System->Manage SAP System Aliases
* Alternatively you could also directly edit table /IWFND/V\_DFSYAL in sm30.

<figure><img src="https://2821138577-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFijY43dc9KNMQtgqYko2%2Fuploads%2FsWxXgswIaesevVKY4SeS%2Fcreate%20SAP%20System%20Alias.png?alt=media&#x26;token=c09b88aa-47ce-4909-b275-f047d793ddcc" alt=""><figcaption></figcaption></figure>

## Maintain SAP Gateway Settings

Maintain SAP Gateway Settings using the RFC Destination and Alias created in the previous steps.

* In NW 7.0-731 go the IMG in transaction SPRO, and open SAP NetWeaver->Gateway Service Enablement->Backend OData Channel->Connection Settings to SAP Gateway->SAP Gateway Settings
* In NW 740+ go to the IMG in transaction SPRO and open SAP NetWeaver->SAP Gateway Service Enablement->Backend OData Channel->Connection Settings to SAP Gateway->SAP Gateway Settings
* Alternatively, you could also directly edit table /IWBEP/C\_SYSTEM in SM30.

<figure><img src="https://2821138577-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFijY43dc9KNMQtgqYko2%2Fuploads%2F4ORXL6VhrQnQXQR6Z4Uk%2FSAP%20GW%20settings%202.png?alt=media&#x26;token=de19faf3-09e5-4514-8de4-33ef9539e93c" alt=""><figcaption></figcaption></figure>

## Activate SAP Gateway

Activate SAP Gateway in every system in the landscape (if it is not already activated).

* In NW 7.0-731 go the IMG in transaction SPRO ->SAP Netweaver->Gateway->OData Channel->Configuration->Activate or Deactivate SAP Gateway
* In NW 740+ go to the IMG in transaction SPRO->SAP Netweaver->SAP Gateway->OData Channel->Configuration->Activate or Deactivate SAP Gateway if you are on a NW 740 system) and make sure SAP Gateway is active.

## Create Package

In transaction se21, create package ZLOOPLY\_SERVICE.

## Add Service

In transaction /N/IWFND/MAINT\_SERVICE click on “Add service”. Then insert your alias in the "System Alias" field, "/LOOPLY/\*" in the "Technical Service Name" field and click on the “Get Services” button:

<figure><img src="https://2821138577-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFijY43dc9KNMQtgqYko2%2Fuploads%2Flj9YLYstIpRgNiAY5AT4%2FAdd%20Services.png?alt=media&#x26;token=55c5f013-cc27-42c7-a1d9-703ce0d8b36f" alt=""><figcaption></figcaption></figure>

Select the table row and click on "Add Selected Services". Here you may change the technical names for service and model. Enter the package created in the previous step and click on the "Enable OAuth for Service" checkbox:

<figure><img src="https://2821138577-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFijY43dc9KNMQtgqYko2%2Fuploads%2FGlKqhK15nXqZh2i3Hu9f%2FAdd%20Services%202.png?alt=media&#x26;token=4f608b7a-c93e-43e4-b35d-2138a2ba476d" alt=""><figcaption></figcaption></figure>

Back in transaction /N/IWFND/MAINT\_SERVICE, select the newly created service and click on "SAP Gateway Client" to test it:

<figure><img src="https://2821138577-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFijY43dc9KNMQtgqYko2%2Fuploads%2Fyi9nzxgz4VlLVrR8cGzo%2Ftest%20service.png?alt=media&#x26;token=96ba7dea-95d9-450f-9e3b-7a1e35c98cfd" alt=""><figcaption></figcaption></figure>

## oData Service Authorization <a href="#odata-service-authorization" id="odata-service-authorization"></a>

In order for users to be able to post data to SAP (to approve a card for example), they must have authorization for the underlying oData service. To add this to a (new or existing) role, do the following:

**In your Gateway hub system:**

* Add authorization object s\_service to the role
* Click on the “change” button next to “Program, transaction or functi”:

<figure><img src="https://2821138577-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFijY43dc9KNMQtgqYko2%2Fuploads%2F4sVfYR1QocGNWmqkG8S6%2FScreenshot%201.png?alt=media&#x26;token=63fb57e8-5968-4f03-bf34-5f68ce37303f" alt=""><figcaption></figcaption></figure>

* Select “TADIR Service” in the “Type” drop-down and add the following entry: \
  R3TR IWSG ZSERVICE\_SRV\_0001

**In your ECC system:**

* Add authorization object s\_service to the role
* Click on the “change” button next to “Program, transaction or functi”:
* Select “TADIR Service” in the “Type” drop-down and add the following entry: \
  R3TR    IWSV    /LOOPLY/SERVICE\_SRV                0001

## Transport changes

Transport all the changes made and new objects created in the above steps (including table entries) throughout your landscape.

## Activate sicf node

**In the system where Looply is installed**,  go to transaction SICF and activate the following node:

**/sap/opu/odata/looply/service\_srv**
