# CO_MDG_BP_RELATIONSHIP_OUT

**SOAP v1.0.0 — ACTIVE**

## Title / 标题
**Business Partner Relationship - Replicate from SAP S/4HANA Cloud to Client / 业务伙伴关系 - 从 SAP S/4HANA Cloud 复制到客户端**

## Operation / 操作
`BPRelationshipBulkReplicateRequestOut`

---

## Description / 描述
Replicates Business Partner Relationship data from SAP S/4HANA Cloud to an external client system using this asynchronous outbound service.

使用此异步出站服务，将业务伙伴关系数据从 SAP S/4HANA Cloud 复制到外部客户端系统。

---

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

## Message Structure / 消息结构

### Request / 请求
| Element | Type | Description (EN) | Description (CN) |
|---------|------|------------------|------------------|
| `BPRelationship` | Table | Business partner relationship data | 业务伙伴关系数据 |
| `?RelationshipUUID` | `RAW(16)` | Relationship GUID | 关系全局唯一标识 |
| `?SourceBP` | `CHAR(10)` | Source business partner number | 源业务伙伴编号 |
| `?TargetBP` | `CHAR(10)` | Target business partner number | 目标业务伙伴编号 |
| `?RelationshipCategory` | `CHAR(6)` | Relationship category | 关系类别 |
| `?ValidityStart` | `DATE` | Validity start date | 有效期开始日期 |
| `?ValidityEnd` | `DATE` | Validity end date | 有效期结束日期 |
| `?IsStandardRelationship` | `BOOLEAN` | Standard relationship flag | 标准关系标识 |
| `?RelationshipType` | `CHAR(4)` | Relationship type code | 关系类型代码 |
| `?Description` | `CHAR(40)` | Relationship description | 关系描述 |

### Response / 响应
| Element | Type | Description (EN) | Description (CN) |
|---------|------|------------------|------------------|
| `Return` | `BAPIRETURN` | Replication result status | 复制结果状态 |
| `?Type` | `CHAR(1)` | Message type (S/E/W/I) | 消息类型（成功/错误/警告/信息） |
| `?Message` | `CHAR(220)` | Status message text | 状态消息文本 |
| `?LogMsgNo` | `NUMC(6)` | Message sequence number | 消息序号 |

---

## Example Payload / 示例负载

### Request
```xml
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <BPRelationshipBulkReplicateRequestOut>
      <BPRelationship>
        <item>
          <RelationshipUUID>00A1B2C3D4E5F6A7B8C9D0E1F2A3B4C5</RelationshipUUID>
          <SourceBP>BP1000</SourceBP>
          <TargetBP>BP2000</TargetBP>
          <RelationshipCategory>BUR001</RelationshipCategory>
          <ValidityStart>2026-01-01</ValidityStart>
          <ValidityEnd>9999-12-31</ValidityEnd>
          <IsStandardRelationship>true</IsStandardRelationship>
          <Description>Parent Company / 母公司</Description>
        </item>
        <item>
          <RelationshipUUID>00D6E7F8A9B0C1D2E3F4A5B6C7D8E9F0</RelationshipUUID>
          <SourceBP>BP1001</SourceBP>
          <TargetBP>BP2001</TargetBP>
          <RelationshipCategory>BUR002</RelationshipCategory>
          <ValidityStart>2026-06-15</ValidityStart>
          <ValidityEnd>2027-06-15</ValidityEnd>
          <IsStandardRelationship>false</IsStandardRelationship>
          <Description>Contact Person / 联系人</Description>
        </item>
      </BPRelationship>
    </BPRelationshipBulkReplicateRequestOut>
  </soap:Body>
</soap:Envelope>
```

### Response
```xml
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <BPRelationshipBulkReplicateRequestOutResponse>
      <Return>
        <Type>S</Type>
        <Message>Relationships replicated successfully / 关系复制成功</Message>
        <LogMsgNo>000001</LogMsgNo>
      </Return>
    </BPRelationshipBulkReplicateRequestOutResponse>
  </soap:Body>
</soap:Envelope>
```

---

## Error Codes / 错误代码
| Code | Description (EN) | Description (CN) |
|------|------------------|------------------|
| `BRO_001` | Source or target BP is missing | 源或目标业务伙伴缺失 |
| `BRO_002` | Relationship category is required | 关系类别为必填项 |
| `BRO_003` | Duplicate relationship UUID | 重复的关系UUID |
| `BRO_004` | Validity end date precedes start date | 有效期结束日期早于开始日期 |
| `BRO_005` | Invalid relationship category code | 无效的关系类别代码 |

---

## Notes / 备注
- This is an asynchronous outbound service / 这是一个异步出站服务
- Relationship categories are defined in SAP MDG / 关系类别在 SAP MDG 中定义
- Max 2000 relationships per replication request / 每次复制请求最多 2000 条关系
- Use CO_MDG_BP_RELATIONSHIP_CNF_OUT to confirm replication status / 使用 CO_MDG_BP_RELATIONSHIP_CNF_OUT 确认复制状态