# ECC_OUTBOUNDDELIVERYCWRRC

**SOAP v1.0.0 — ACTIVE**

## Title / 标题
**Outbound Delivery with Reference to a Sales Order – Create (A2X) / 参照销售订单创建外向交货**

## Operation / 操作
`OutboundDeliveryCreateWithRef`

---

## Description / 描述
Create an outbound delivery with reference to a customer order with this synchronous inbound service.

使用此同步入站服务参照客户订单创建外向交货单。

---

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

## Message Structure / 消息结构

### Request / 请求
| Element | Type | Description (EN) | Description (CN) |
|---------|------|------------------|------------------|
| `SalesOrder` | `CHAR(10)` | Reference sales order number | 参考销售订单号 |
| `DeliveryType` | `CHAR(4)` | Delivery type | 交货类型 |
| `?ShipToParty` | `CHAR(10)` | Ship-to party | 收货方 |
| `?Plant` | `CHAR(4)` | Plant | 工厂 |
| `?StorageLocation` | `CHAR(4)` | Storage location | 存储地点 |
| `PlannedGIDate` | `DATE` | Planned goods issue date | 计划发货日期 |
| `Items` | Table | Delivery item details | 交货行项目明细 |
| `?Material` | `CHAR(18)` | Material number | 物料号 |
| `?Quantity` | `QUAN` | Delivery quantity | 交货数量 |
| `?Unit` | `UNIT` | Unit of measure | 计量单位 |

### 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 | 消息文本 |
| `DeliveryOrder` | `CHAR(10)` | Created delivery document number | 已创建的交货单号 |

---

## Example Payload / 示例负载

### Request
```xml
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <OutboundDeliveryCreateWithRef>
      <SalesOrder>4500001234</SalesOrder>
      <DeliveryType>NL</DeliveryType>
      <ShipToParty>Customer001</ShipToParty>
      <Plant>1000</Plant>
      <PlannedGIDate>2026-07-24</PlannedGIDate>
      <Items>
        <item>
          <Material>MAT-10001</Material>
          <Quantity>100.000</Quantity>
          <Unit>EA</Unit>
        </item>
        <item>
          <Material>MAT-10002</Material>
          <Quantity>50.000</Quantity>
          <Unit>EA</Unit>
        </item>
      </Items>
    </OutboundDeliveryCreateWithRef>
  </soap:Body>
</soap:Envelope>
```

### Response
```xml
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <OutboundDeliveryCreateWithRefResponse>
      <Return>
        <Type>S</Type>
        <Message>Delivery created successfully / 交货单已成功创建</Message>
      </Return>
      <DeliveryOrder>0080002001</DeliveryOrder>
    </OutboundDeliveryCreateWithRefResponse>
  </soap:Body>
</soap:Envelope>
```

---

## Error Codes / 错误代码
| Code | Description (EN) | Description (CN) |
|------|------------------|------------------|
| `DEL_101` | Sales order not found | 未找到销售订单 |
| `DEL_102` | Sales order not approved | 销售订单未审批 |
| `DEL_103` | Insufficient stock | 库存不足 |
| `DEL_104` | Delivery type not configured | 未配置交货类型 |
| `DEL_105` | Item quantity exceeds open order quantity | 项目数量超过未交货数量 |

---

## Notes / 备注
- The sales order must exist and be in approved status / 销售订单必须存在且已审批
- Delivery quantity cannot exceed the open quantity of the sales order / 交货数量不能超过销售订单的未交货数量
- All items must belong to the same plant / 所有项目必须属于同一工厂
