Exercício 502 - Criar um Business Partner (POST)

Exercício


Realize a criação do Business Partner utilizando o método POST.

URL Base


Utilize a URL abaixo para criação do Business Partner.

{{url}}/sap/opu/odata/sap/API_BUSINESS_PARTNER/A_BusinessPartner

Token de Autorização


Em toda a chamada do tipo POST você deve inserir no Headers o token gerado (ver como gerar token no exercício 501).

x-CSRF-token

Obs.: o token é válido por alguns minutos (entre 3 a 5 minutos), após este período, gere um novo token e continue o exercício.

Body


Na criação (POST) é preciso enviar ao SAP as informações do objeto que será criado, neste caso business patner.

Para isso, acesse a aba Body, selecione a opção raw e o formato JSON.

Em seguida, copie o código do Exemplo 01 e cole no Body da sua Request

Em seguida clique no botão SEND para enviar sua requisição.


Se o sistema retornar o código 201, significa que o Business Partner foi criado com sucesso.

Na resposta da API, o SAP informa o número do novo Business Partner criado.


Exemplo 01


{
    "BusinessPartnerCategory": "2",
    "BusinessPartnerGrouping": "BP02",
    "OrganizationBPName1": "Business Partner API 2"
} 

Exemplo 02


{
    "BusinessPartnerCategory": "2",
    "BusinessPartnerGrouping": "BP02",
    "OrganizationBPName1": "Business Partner API 2",
    "to_BuPaIndustry" : [
    {
      "IndustrySector" : "01",
      "IndustrySystemType": "0001",
      "IsStandardIndustry" : "X"
}

],
“to_BusinessPartnerAddress” : [
{
“Country” : “BR”,
“HouseNumber” : “171”,
“StreetName” : “Avenida Paulista”,
“PostalCode” : “01310-100”,
“CityName” : “São Paulo”,
“Region”: “SP”,
“Language” : “PT”,
“to_AddressUsage” : [
{
“AddressUsage” : “XXDEFAULT”,
“ValidityEndDate” : “/Date(253402300799000+0000)/”
}
]
}
],
“to_BusinessPartnerTax” : [
{
“BPTaxType”: “BR3”,
“BPTaxNumber”: “123456456”
},
{
“BPTaxType”: “BR4”,
“BPTaxNumber”: “654321”
}
]
}

Exemplo 03

{
“BusinessPartnerCategory”: “2”,
“BusinessPartnerGrouping”: “BP02”,
“OrganizationBPName1”: “Business Partner API 2”,
“to_BuPaIndustry” : [
{
“IndustrySector” : “01”,
“IndustrySystemType”: “0001”,
“IsStandardIndustry” : “X”

}

],
“to_BusinessPartnerAddress” : [
{
“Country” : “BR”,
“HouseNumber” : “171”,
“StreetName” : “Avenida Paulista”,
“PostalCode” : “01310-100”,
“CityName” : “São Paulo”,
“Region”: “SP”,
“Language” : “PT”,
“to_AddressUsage” : [
{
“AddressUsage” : “XXDEFAULT”,
“ValidityEndDate” : “/Date(253402300799000+0000)/”
}
]
}
],
“to_BusinessPartnerTax” : [
{
“BPTaxType”: “BR3”,
“BPTaxNumber”: “123456456”
},
{
“BPTaxType”: “BR4”,
“BPTaxNumber”: “654321”
}
],
“to_BusinessPartnerRole” : [
{
“BusinessPartnerRole” : “FLVN00”,
“ValidFrom” : “/Date(1484092800000+0000)/”,
“ValidTo” : “/Date(253402300799000+0000)/”
}
],
“to_Supplier”: {
“PaymentIsBlockedForSupplier”: true,
“PostingIsBlocked”: true
}
}

Exemplo 04

{
“BusinessPartnerCategory”: “2”,
“BusinessPartnerGrouping”: “BP02”,
“OrganizationBPName1”: “Business Partner API 2”,
“to_BuPaIndustry” : [
{
“IndustrySector” : “01”,
“IndustrySystemType”: “0001”,
“IsStandardIndustry” : “X”
}
],
“to_BusinessPartnerAddress” : [
{
“Country” : “BR”,
“HouseNumber” : “171”,
“StreetName” : “Avenida Paulista”,
“PostalCode” : “01310-100”,
“CityName” : “São Paulo”,
“Region”: “SP”,
“Language” : “PT”,
“to_AddressUsage” : [
{
“AddressUsage” : “XXDEFAULT”,
“ValidityEndDate” : “/Date(253402300799000+0000)/”
}
]
}
],
“to_BusinessPartnerTax” : [
{
“BPTaxType”: “BR3”,
“BPTaxNumber”: “123456456”
},
{
“BPTaxType”: “BR4”,
“BPTaxNumber”: “654321”
}
],
“to_BusinessPartnerRole” : [
{
“BusinessPartnerRole” : “FLVN00”,
“ValidFrom” : “/Date(1484092800000+0000)/”,
“ValidTo” : “/Date(253402300799000+0000)/”
}
],
“to_Supplier”: {
“PaymentIsBlockedForSupplier”: true,
“PostingIsBlocked”: true,
“to_SupplierCompany” : [
{
“CompanyCode” : “1410”,
“ReconciliationAccount” : “12110000”
}
]
}
}

Exemplo 05 - Business Partner Pessoa Física (CPF)



{
“BusinessPartnerCategory”: “2”,
“BusinessPartnerGrouping”: “BP02”,
“OrganizationBPName1”: “Business Partner API 2 - CPF”,
“IsNaturalPerson”: “X”,
“to_BuPaIndustry” : [
{
“IndustrySector” : “01”,
“IndustrySystemType”: “0001”,
“IsStandardIndustry” : “X”
}
],
“to_BusinessPartnerAddress” : [
{
“Country” : “BR”,
“HouseNumber” : “171”,
“StreetName” : “Avenida Paulista”,
“PostalCode” : “01310-100”,
“CityName” : “São Paulo”,
“Region”: “SP”,
“Language” : “PT”,
“to_AddressUsage” : [
{
“AddressUsage” : “XXDEFAULT”,
“ValidityEndDate” : “/Date(253402300799000+0000)/”
}
]
}
],
“to_BusinessPartnerTax” : [
{
“BPTaxType”: “BR2”,
“BPTaxNumber”: “41616913002”
}
],
“to_BusinessPartnerRole” : [
{
“BusinessPartnerRole” : “FLVN00”,
“ValidFrom” : “/Date(1484092800000+0000)/”,
“ValidTo” : “/Date(253402300799000+0000)/”
}
],
“to_Supplier”: {
“PaymentIsBlockedForSupplier”: true,
“PostingIsBlocked”: true,
“to_SupplierCompany” : [
{
“CompanyCode” : “1410”,
“ReconciliationAccount” : “12110000”
}
]
}
}


Exemplo 06 - Business Partner com dados de e-mail (somente um email)




{
“BusinessPartnerCategory”: “2”,
“BusinessPartnerGrouping”: “BP02”,
“OrganizationBPName1”: “Business Partner API 2 - CPF”,
“IsNaturalPerson”: “X”,
“to_BuPaIndustry”: [
{
“IndustrySector”: “01”,
“IndustrySystemType”: “0001”,
“IsStandardIndustry”: “X”
}
],
“to_BusinessPartnerAddress”: [
{
“Country”: “BR”,
“HouseNumber”: “171”,
“StreetName”: “Avenida Paulista”,
“PostalCode”: “01310-100”,
“CityName”: “São Paulo”,
“Region”: “SP”,
“Language”: “PT”,
“to_AddressUsage”: [
{
“AddressUsage”: “XXDEFAULT”,
“ValidityEndDate”: “/Date(253402300799000+0000)/”
}
],
“to_EmailAddress”: [
{
“OrdinalNumber”: “1”,
“IsDefaultEmailAddress”: true,
“EmailAddress”: “emailapi01@email.com”,
“SearchEmailAddress”: “emailapi01@email.com
}
]
}
],
“to_BusinessPartnerTax”: [
{
“BPTaxType”: “BR2”,
“BPTaxNumber”: “30491540043”
}
],
“to_BusinessPartnerRole”: [
{
“BusinessPartnerRole”: “FLVN00”,
“ValidFrom”: “/Date(1484092800000+0000)/”,
“ValidTo”: “/Date(253402300799000+0000)/”
}
],
“to_Supplier”: {
“PaymentIsBlockedForSupplier”: true,
“PostingIsBlocked”: true,
“to_SupplierCompany”: [
{
“CompanyCode”: “1410”,
“ReconciliationAccount”: “12110000”
}
]
}
}


Exemplo 07 - Business Partner com dados de e-mail (com dois endereços de e-mail)




{
“BusinessPartnerCategory”: “2”,
“BusinessPartnerGrouping”: “BP02”,
“OrganizationBPName1”: “Business Partner API 2 - CPF”,
“IsNaturalPerson”: “X”,
“to_BuPaIndustry”: [
{
“IndustrySector”: “01”,
“IndustrySystemType”: “0001”,
“IsStandardIndustry”: “X”
}
],
“to_BusinessPartnerAddress”: [
{
“Country”: “BR”,
“HouseNumber”: “171”,
“StreetName”: “Avenida Paulista”,
“PostalCode”: “01310-100”,
“CityName”: “São Paulo”,
“Region”: “SP”,
“Language”: “PT”,
“to_AddressUsage”: [
{
“AddressUsage”: “XXDEFAULT”,
“ValidityEndDate”: “/Date(253402300799000+0000)/”
}
],
“to_EmailAddress”: [
{
“OrdinalNumber”: “1”,
“IsDefaultEmailAddress”: true,
“EmailAddress”: “emailapi10@email.com”,
“SearchEmailAddress”: “emailapi10@email.com
},
{
“OrdinalNumber”: “2”,
“IsDefaultEmailAddress”: false,
“EmailAddress”: “emailapi20@email.com”,
“SearchEmailAddress”: “emailapi20@email.com
}
]
}
],
“to_BusinessPartnerTax”: [
{
“BPTaxType”: “BR2”,
“BPTaxNumber”: “11196136041”
}
],
“to_BusinessPartnerRole”: [
{
“BusinessPartnerRole”: “FLVN00”,
“ValidFrom”: “/Date(1484092800000+0000)/”,
“ValidTo”: “/Date(253402300799000+0000)/”
}
],
“to_Supplier”: {
“PaymentIsBlockedForSupplier”: true,
“PostingIsBlocked”: true,
“to_SupplierCompany”: [
{
“CompanyCode”: “1410”,
“ReconciliationAccount”: “12110000”
}
]
}
}