Overview

The ERP SD Customer Proxy service is used for manipulating SAP ERP customer master data.

Using this service, you can:

  • Create SAP ERP customers
  • Update SAP ERP customers

Before you use the service, you need to configure the ERP system settings in the ERP SD Configuration service.


API Reference

/{tenant}/customers

Manage ERP customers for a given tenant.

/{tenant}/customers

post

Create a customer in the SAP ERP system via BAPI BAPI_CUSTOMER_CREATEFROMDATA1. In case the BAPI returns error message, the response status will be 400 and the error message will be displayed in the response body.

Required scope: hybris.sdcustomerproxy_manage

/{tenant}/customers/{customerNumber}

Update an ERP customer for a given tenant.

put

Update the customer profile in the SAP ERP system via BAPI BAPI_CUSTOMER_CHANGEFROMDATA1. In case the BAPI returns error message, the response status will be 400 and the error message will be displayed in the response body.

Required scope: hybris.sdcustomerproxy_manage

delete

Mark this customer for deletion in the SAP ERP system using the customized BAPI ZSAP_BAPI_CUSTOMER_DELETE. Before starting the operation, implement the SAP note 2407371 to create a custom function module.

For more information, see the [SAP Note 2407371] at http://service.sap.com/sap/support/notes/2407371.

Required scope: hybris.sdcustomerproxy_manage

get

Get detailed customer information in the SAP ERP system via the BAPI BAPI_CUSTOMER_GETDETAIL1. If the BAPI returns an error, the response status is 400 and the error message appears in the response body.

The three query parameters, qDistributionChannel, qDivision, and qSalesOrganization are optional for querying customer information. Basic customer data can be retrieved from the service when the customerNumber is correct, whether these query parameters are transferred to the service or not. However, if the optional parameters are transferred to the service, the relevant optional customer data is determined from the customer master. If the customer is a person, fill in the data for PE_OPT_PERSONALDATA_NEW and PE_OPT_PERSONALDATA. If the customer is a company, fill in the data for PEOPT COMPANYDATA NEW and PE COMPANYDATA.

Required scope:hybris.sdcustomerproxy_view

/{tenant}/customers/{customerNumber}/salesareas

Manage sales areas of a given ERP customer for a given tenant.

/{tenant}/customers/{customerNumber}/salesareas

get

Retrieve payment card list of a given ERP customer for a given tenant.

Required scope: hybris.sdcustomerproxy_view

/{tenant}/customers/{customerNumber}/creditCards

Retrieve the payment card list of a given ERP customer.

/{tenant}/customers/{customerNumber}/creditCards

get

Retrieve the payment card list of a given ERP customer for a given tenant. For more information, find [SAP Note 2405050] at http://service.sap.com/sap/support/notes/2405050.

Required scope: hybris.sdcustomerproxy_view


Scopes

The table shows the scopes that the ERP SD Customer Proxy service supports.

SCOPEDESCRIPTION
hybris.sdcustomerproxy_viewRetrieve customer information in the SAP ERP system
hybris.sdcustomerproxy_manageCreate, retrieve, and update a customer account in the SAP ERP system

For more information about scopes, authorization, and authentication procedures for YaaS services, see Scopes and Authorization.


Create a Customer in the SAP ERP system

The ERP SD Customer Proxy service uses the BAPI BAPI_CUSTOMER_CREATEFROMDATA1 to create customers in the SAP ERP system and the same data structure as the BAPI.

You can create a customer in the SAP ERP system based on the entered personal data (import parameter PI_PERSONALDATA) or company data (import parameter PI_COMPANYDATA). You can transfer only one structure (personal data or company data) to the service. For more information, see the documentation for the BAPI BAPI_CUSTOMER_CREATEFROMDATA1 in the SAP ERP system.


Update a Customer in the SAP ERP System

The ERP SD Customer Proxy service uses the BAPI BAPI_CUSTOMER_CHANGEFROMDATA1 to change the personal or company data of SAP ERP customers and the same data structure as the BAPI.

You can update a customer in the SAP ERP system based on the entered personal data (import parameter PI_PERSONALDATA) or company data (import parameter PI_COMPANYDATA). You can transfer only one structure (personal data or company data) to the service. For more information, see the documentation of the BAPI BAPI_CUSTOMER_CHANGEFROMDATA1 in the SAP ERP system.


Retrieve a Customer from the SAP ERP system

The ERP SD Customer Proxy service uses the BAPI BAPI_CUSTOMER_GETDETAIL1 to retrieve either the mandatory or optional personal data of SAP ERP customers. The mandatory personal data is stored in PE_PERSONALDATA_NEW and optional data is stored in the PE_OPT_PERSONALDATA_NEW part of the response data. The same BAPI retrieves the mandatory or optional company data. The mandatory company data is stored in PE_COMPANYDATA and optional company data is stored in PE_OPT_COMPANYDATA part of the response data.

For more information, see the documentation for the BAPI BAPI_CUSTOMER_GETDETAIL1 in the SAP ERP system.


Retrieve Sales Area for a Customer from the SAP ERP system

The ERP SD Customer Proxy service uses the BAPI BAPI_CUSTOMER_GETSALESAREAS to retrieve a list of sales areas of specified customers from the SAP ERP system and the same data structure as the BAPI. For more information, see the documentation of the BAPI BAPI_CUSTOMER_GETSALESAREAS in the SAP ERP system.


Retrieve Credit Cards for a Customer from the SAP ERP system

The ERP SD Customer Proxy service uses the BAPI ZSAP_BAPI_SD_CCARD_READ to retrieve a list of credit cards for specified customers from the SAP ERP system, and has the same data structure as the BAPI.

For more information, see the SAP Note 2405050.


Create a Customer in the SAP ERP system

To create a customer in SAP ERP, you need:

  • Method: POST
  • Request URL: https://api.beta.yaas.io/hybris/sdcustomerproxy/v2/{tenant}/customers
  • Headers

    • Authorization: This includes a valid OAuth2 access token. To access this method, the access token must be issued for the requested tenant and have the scope hybris.sdcustomerproxy_manage.
  • URI Parameters

    • {tenant}: The name of the current tenant
  • Body: To create a new customer, enter personal data (import parameter PI_PERSONALDATA) or company data (import parameter PI_COMPANYDATA) in the request body.

{
  "PI_COMPANYDATA" : {},
  "PI_CONSUMEREN" : "",
  "PI_COPYREFERENCE" : {
     "SALESORG" : "1000",
     "DISTR_CHAN" : "10",
     "DIVISION" : "10",
     "REF_CUSTMR" : "0003000275"
  },
  "PI_CREDIT_CONTROL_FLAG" : "",
  "PI_OPT_COMPANYDATA" : {},
  "PI_OPT_PERSONALDATA" : {},
  "PI_PERSONALDATA" : {
    "TITLE_P" : "",
    "FIRSTNAME" : "Derek",
    "LASTNAME" : "Zhang",
    "MIDDLENAME" : "",
    "SECONDNAME" : "",
    "DATE_BIRTH" : "",
    "CITY" : "Chengdu",
    "DISTRICT" : "",
    "POSTL_COD1" : "610041",
    "POSTL_COD2" : "",
    "PO_BOX" : "",
    "PO_BOX_CIT" : "",
    "STREET" : "",
    "HOUSE_NO" : "",
    "BUILDING" : "",
    "FLOOR" : "",
    "ROOM_NO" : "",
    "COUNTRY" : "CN",
    "COUNTRYISO" : "CN",
    "REGION" : "",
    "TEL1_NUMBR" : "",
    "TEL1_EXT" : "",
    "FAX_NUMBER" : "",
    "FAX_EXTENS" : "",
    "E_MAIL" : "derek.zhang@sap.com",
    "LANGU_P" : "1",
    "LANGUP_ISO" : "ZH",
    "CURRENCY" : "CNY",
    "CURRENCY_ISO" : "CNY",
    "TITLE_KEY" : "",
    "ONLY_CHANGE_COMADDRESS" : ""
    }
}

Response

The successful response returns a 201 status code. An example JSON content looks similar to the following:

{
   "id": "0003002539"
}


Update a Customer in the SAP ERP system

To update a customer in SAP ERP, you need:

  • Method: PUT
  • Request URL: https://api.beta.yaas.io/hybris/sdcustomerproxy/v2/{tenant}/customers/{customerNumber}
  • Headers

    • Authorization: This includes a valid OAuth2 access token. To access this method, the access token must be issued for the requested tenant and have the scope hybris.sdcustomerproxy_manage.
  • URI Parameters

    • {tenant}: The name of the current tenant
    • {customerNumber}: The specified customer number
  • Body: To update a customer, specify the customer number in field CUSTOMERNO. This customer number should be the same as the one specified in the URL parameter customerNumber. You must also enter personal data (import parameter PI_PERSONALDATA) or company data (import parameter PI_COMPANYDATA).

{
  "CUSTOMERNO": "0003000275",
  "PI_COMPANYDATA": {},
  "PI_COMPANYDATAX": {},
  "PI_DISTR_CHAN": "10",
  "PI_DIVISION": "10",
  "PI_OPT_COMPANYDATA": {},
  "PI_OPT_COMPANYDATAX": {},
  "PI_OPT_PERSONALDATA": {},
  "PI_OPT_PERSONALDATAX": {},
  "PI_PERSONALDATA": {
    "FIRSTNAME": "James",
    "LASTNAME": "Owen",
    "CITY": "chengdu",
    "POSTL_COD1": "614000",
    "COUNTRY": "CN",
    "COUNTRYISO": "CN",
    "LANGU_P": "1",
    "LANGUP_ISO": "ZH",
    "CURRENCY": "CNY",
    "CURRENCY_ISO": "CNY"
  },
  "PI_PERSONALDATAX": {
    "FIRSTNAME": "X",
    "LASTNAME": "X"
  },
  "PI_SALESORG": "1000"
}

Response

The successful response returns a 204 status code.


Get a Customer in the SAP ERP System

To retrieve the detailed information about a customer in SAP ERP, you need:

Request

  • Method: GET
  • Request URL: https://api.beta.yaas.io/hybris/sdcustomerproxy/v2/{tenant}/customers/{customerNumber}
  • Headers

    • Authorization: This includes a valid OAuth2 access token. To access this method, the access token must be issued for the requested tenant and have the scope hybris.sdcustomerproxy_view.
  • URI Parameters

    • {tenant}: The name of the current tenant
    • {customerNumber}: The specified customer number
Get the detailed information about a customer in the SAP ERP system using the BAPI BAPI_CUSTOMER_GETDETAIL1. If the BAPI returns an error, the response status is 400 and the error message appears in the response body. The three query parameters qDistributionChannel, qDivision, and qSalesOrganization are optional for querying customer information. Basic customer data can be retrieved from the service when the customerNumber is correct, whether these query parameters are transferred to the service or not. However, if the optional parameters are transferred to the service, the relevant optional customer data is determined from the customer master data. If the customer is a person, fill in the data for PE_OPT_PERSONALDATA_NEW and PE_OPT_PERSONALDATA. If the customer is a company, fill in the data for PEOPT_COMPANYDATA_NEW and PE_COMPANYDATA.

Response

The successful response returns a 200 status code. An example JSON content looks similar to the following:

{
  "PE_ADDRESSTYPE_NO": {
    "ADDRTYPE": "2",
    "ADRNP_2": "0000028327",
    "PRSNR": "0000028325"
  },
  "PE_COMPANYDATA": {},
  "PE_OPT_COMPANYDATA": {},
  "PE_OPT_PERSONALDATA": {
    "SHIP_COND": "01"
  },
  "PE_OPT_PERSONALDATA_NEW": {
    "SHIP_COND": "01"
  },
  "PE_PERSONALDATA": {},
  "PE_PERSONALDATA_NEW": {
    "CITY": "Chengdu",
    "COUNTRY": "US",
    "COUNTRYISO": "US",
    "CURRENCY": "USD",
    "E_MAIL": "andrew.pang@hybristest.com",
    "FIRSTNAME": "Andrew",
    "LANGUP_ISO": "EN",
    "LANGU_P": "E",
    "LASTNAME": "Pang",
    "POSTL_COD1": "33223",
    "REGION": "AL",
    "STREET": "Tianfu Road",
    "TITLE_KEY": "0002",
    "TITLE_P": "Mr."
  },
  "RETURN": {
    "LOG_MSG_NO": 0,
    "NUMBER": 0
  }
}


Retrieve Sales Areas of a Customer

To retrieve the sales areas of a specified ERP customer for a given tenant in SAP ERP, you need:

Request

  • Method: GET
  • Request URL: https://api.beta.yaas.io/hybris/sdcustomerproxy/v2/{tenant}/customers/{customerNumber}/salesareas
  • Headers

    • Authorization: This includes a valid OAuth2 access token. To access this method, the access token must be issued for the requested tenant and have the scope hybris.sdcustomerproxy_view.
  • URI Parameters

    • {tenant}: The name of the current tenant
    • {customerNumber}: The specified customer number

Response

The successful response returns a 200 status code. An example JSON content looks similar to the following:

 [
   {
 "CUSTOMER": "0003001000",
 "DISTRCHN": "10",
 "DIVISION": "10",
 "SALESORG": "1000"
   }
 ]


Mark the customer for deletion

To mark a customer for deletion in the SAP ERP system, you need:

Request

  • Method: DELETE
  • Request URL: https://api.beta.yaas.io/hybris/sdcustomerproxy/v2/{tenant}/customers/{customerNumber}
  • Headers

    • Authorization: This includes a valid OAuth2 access token. To access this method, the access token must be issued for the requested tenant and have the scope hybris.sdcustomerproxy_manage.
  • URI Parameters

    • {tenant}: The name of the current tenant
    • {customerNumber}: The specified customer number

Response

A successful response returns a 204 status code.


Retrieve Credit Cards of a Customer

To retrieve the credit cards of a given ERP customer for a given tenant in the SAP ERP system, you need:

Request

  • Method: GET
  • Request URL: https://api.beta.yaas.io/hybris/sdcustomerproxy/v2/{tenant}/customers/{customerNumber}/creditCards
  • Headers

    • Authorization: This includes a valid OAuth2 access token. To access this method, the access token must be issued for the requested tenant and have the scope hybris.sdcustomerproxy_view.
  • URI Parameters

    • {tenant}: The name of the current tenant.
    • {customerNumber}: The specified customer number.

Response

A successful response returns a 200 status code. The returned JSON content looks similar to the example shown:

[
  {
    "cardholder": "Paul Roth",
    "cardnumber": "411**********57",
    "cardtype": "MAST",
    "validto": "2018-06-31"
  },
  {
    "cardholder": "Paul Roth",
    "cardnumber": "41111*****11111",
    "cardtype": "VISA",
    "validto": "2018-12-31"
  },
  {
    "cardholder": "Paul Roth",
    "cardnumber": "411**********45",
    "cardtype": "VISA",
    "validto": "2018-03-31"
  }
]


Error Types

For more information about error codes, see the API Reference.


Error Types

For more information about error codes, see the API Reference.


  • Send feedback

    If you find any information that is unclear or incorrect, please let us know so that we can improve the Dev Portal content.

  • Get Help

    Use our private help channel. Receive updates over email and contact our specialists directly.

  • hybris Experts

    If you need more information about this topic, visit hybris Experts to post your own question and interact with our community and experts.