# CO_SDMD_ESR_SALES_ORGANIZATION

**SOAP v1.0.0 —ACTIVE**

## Title / 标题
**Sales Organization - Replicate / 销售组织 - 复制**

## Operation / 操作
`SalesOrganizationReplicate`

---

## Description / 描述
Replicate sales organizations from SAP S/4HANA Cloud to external systems using this asynchronous outbound service.

通过此异步出站服务将销售组织从 SAP S/4HANA Cloud 复制到外部系统。

---

## Endpoint / 端点
| Environment | URL |
|-------------|-----|
| Production | `https://sap.example.com/sap/bc/srt/rfc/sap/CO_SDMD_ESR_SALES_ORGANIZATION` |
| Test | `https://sap-test.example.com/sap/bc/srt/rfc/sap/CO_SDMD_ESR_SALES_ORGANIZATION` |

## Message Structure / 消息结构

### Request / 请求
| Element | Type | Description (EN) | Description (CN) |
|---------|------|------------------|------------------|
| `SalesOrganizations` | Table | List of sales organizations | 销售组织列表 |
| `?SalesOrganization` | `CHAR(4)` | Sales organization ID | 销售组织编码 |
| `?SalesOrgName` | `CHAR(20)` | Sales organization name | 销售组织名称 |
| `?Currency` | `CUKY(5)` | Currency key | 货币码 |
| `?Country` | `CHAR(3)` | Country code | 国家代码 |
| `?DistributionChannels` | Table | Assigned distribution channels | 分配的分销渠道 |
| `?DistributionChannel` | `CHAR(2)` | Distribution channel | 分销渠道 |
| `?Divisions` | Table | Assigned divisions | 分配的部门 |
| `?Division` | `CHAR(2)` | Division | 部门 |
| `?SalesOffices` | Table | Assigned sales offices | 分配的销售办公室 |
| `?SalesOffice` | `CHAR(4)` | Sales office | 销售办公室 |
| `?SalesGroups` | Table | Assigned sales groups | 分配的销售组 |
| `?SalesGroup` | `CHAR(3)` | Sales group | 销售组 |

### Response / 响应
| Element | Type | Description (EN) | Description (CN) |
|---------|------|------------------|------------------|
| `Return` | `BAPIRETURN` | Application log message | 应用程序日志消息 |
| `?Type` | `CHAR(1)` | Message type (S/E/W/I) | 消息类型（成功/错误/警告/信息） |
| `?Message` | `CHAR(220)` | Message text | 消息文本 |
| `?LogNo` | `CHAR(20)` | Log number | 日志编号 |
| `?LogMsgNo` | `NUM(6)` | Log message number | 日志消息编号 |

---

## Example Payload / 示例负载

### Request
```xml
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <SalesOrganizationReplicate>
      <SalesOrganizations>
        <item>
          <SalesOrganization>1000</SalesOrganization>
          <SalesOrgName>Sales Org China</SalesOrgName>
          <Currency>CNY</Currency>
          <Country>CN</Country>
        </item>
        <item>
          <SalesOrganization>2000</SalesOrganization>
          <SalesOrgName>Sales Org US</SalesOrgName>
          <Currency>USD</Currency>
          <Country>US</Country>
        </item>
      </SalesOrganizations>
    </SalesOrganizationReplicate>
  </soap:Body>
</soap:Envelope>
```

### Response
```xml
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <SalesOrganizationReplicateResponse>
      <Return>
        <Type>S</Type>
        <Message>Sales organizations replicated successfully / 销售组织已成功复制</Message>
      </Return>
    </SalesOrganizationReplicateResponse>
  </soap:Body>
</soap:Envelope>
```

---

## Error Codes / 错误代码
| Code | Description (EN) | Description (CN) |
|------|------------------|------------------|
| `SDMD_001` | Invalid sales organization ID | 无效的销售组织编码 |
| `SDMD_002` | Sales organization already exists | 销售组织已存在 |
| `SDMD_003` | Missing mandatory fields | 缺少必填字段 |
| `SDMD_004` | Communication error with external system | 与外部系统通信错误 |

---

## Notes / 备注
- This is an asynchronous outbound service / 此为异步出站服务
- Sales organizations are replicated with their full hierarchy including channels, divisions, offices, and groups / 销售组织及其完整层级结构（包括渠道、部门、办公室和组）一并复制
- Maximum 100 sales organizations per request / 每次请求最多 100 个销售组织