# CUSTOMERRETURNBULKREQUEST_IN

**SOAP v1.0.0 — ACTIVE**

## Title / 标题
**Customer Return (A2A) / 客户退货（应用程序到应用程序）**

## Operation / 操作
`CustomerReturnBulkRequest`

---

## Description / 描述
This asynchronous inbound service creates, updates, and deletes returns orders for customer returns in SAP S/4HANA, supporting bulk processing of return requests from external systems.

此异步入站服务在SAP S/4HANA中创建、更新和删除客户退货的退货订单，支持来自外部系统的退货请求批量处理。

---

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

## Message Structure / 消息结构

### Request / 请求
| Element | Type | Description (EN) | Description (CN) |
|---------|------|------------------|------------------|
| `CustomerReturns` | Table | Customer return orders | 客户退货订单 |
| `?ReturnOrderId` | `CHAR(10)` | Return order ID (for update/delete) | 退货订单ID（用于更新/删除） |
| `?SalesOrganization` | `CHAR(4)` | Sales organization | 销售组织 |
| `?DistributionChannel` | `CHAR(2)` | Distribution channel | 分销渠道 |
| `?Division` | `CHAR(2)` | Division | 产品组 |
| `?CustomerNumber` | `CHAR(10)` | Customer account number | 客户账户编号 |
| `?DocumentDate` | `DATE` | Document date | 凭证日期 |
| `?PostingDate` | `DATE` | Posting date | 过账日期 |
| `?Action` | `CHAR(1)` | Action (C=create, U=update, D=delete) | 操作（C=创建，U=更新，D=删除） |
| `ReturnItems` | Table | Return order items | 退货订单项目 |
| `?ItemNumber` | `NUMC(6)` | Item number | 项目编号 |
| `?Material` | `CHAR(40)` | Material number | 物料编号 |
| `?ReturnQuantity` | `QUAN` | Return quantity | 退货数量 |
| `?Unit` | `UNIT(3)` | Unit of measure | 计量单位 |
| `?ReasonCode` | `CHAR(4)` | Return reason code | 退货原因代码 |

### 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 | 消息文本 |
| `ProcessedReturns` | Table | Processing results per return | 每个退货的处理结果 |
| `?ReturnOrderId` | `CHAR(10)` | Processed return order ID | 已处理的退货订单ID |
| `?Success` | `CHAR(1)` | Success indicator | 成功标识 |
| `?MessageText` | `CHAR(220)` | Result message | 结果消息 |

---

## Example Payload / 示例负载

### Request
```xml
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <CustomerReturnBulkRequest>
      <CustomerReturns>
        <item>
          <SalesOrganization>1000</SalesOrganization>
          <DistributionChannel>10</DistributionChannel>
          <Division>00</Division>
          <CustomerNumber>CUST-001</CustomerNumber>
          <DocumentDate>2026-07-23</DocumentDate>
          <PostingDate>2026-07-23</PostingDate>
          <Action>C</Action>
        </item>
      </CustomerReturns>
      <ReturnItems>
        <item>
          <ItemNumber>10</ItemNumber>
          <Material>MAT-001</Material>
          <ReturnQuantity>10</ReturnQuantity>
          <Unit>PC</Unit>
          <ReasonCode>DEFECT</ReasonCode>
        </item>
        <item>
          <ItemNumber>20</ItemNumber>
          <Material>MAT-002</Material>
          <ReturnQuantity>5</ReturnQuantity>
          <Unit>PC</Unit>
          <ReasonCode>DAMAGE</ReasonCode>
        </item>
      </ReturnItems>
    </CustomerReturnBulkRequest>
  </soap:Body>
</soap:Envelope>
```

### Response
```xml
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <CustomerReturnBulkRequestResponse>
      <Return>
        <Type>S</Type>
        <Message>Returns processed successfully / 退货处理成功</Message>
      </Return>
      <ProcessedReturns>
        <item>
          <ReturnOrderId>RET-10000001</ReturnOrderId>
          <Success>X</Success>
          <MessageText>Return created / 退货已创建</MessageText>
        </item>
      </ProcessedReturns>
    </CustomerReturnBulkRequestResponse>
  </soap:Body>
</soap:Envelope>
```

---

## Error Codes / 错误代码
| Code | Description (EN) | Description (CN) |
|------|------------------|------------------|
| `RET_001` | Customer not found | 未找到客户 |
| `RET_002` | Material not found | 未找到物料 |
| `RET_003` | Invalid return reason code | 无效的退货原因代码 |
| `RET_004` | Return order not found for update/delete | 未找到要更新/删除的退货订单 |
| `RET_005` | Quantity exceeds delivered quantity | 数量超过已交货数量 |

---

## Notes / 备注
- This service is asynchronous; bulk requests are processed in background / 该服务为异步方式，批量请求在后台处理
- Use Action=C for create, U for update, D for delete / 操作符：C=创建，U=更新，D=删除
- Return reason codes must be configured in the system / 退货原因代码必须在系统中配置
- Maximum 100 return orders per request / 每次请求最多100个退货订单