# CO_TAX_FORCE_UPDATE

**SOAP v1.0.0 —ACTIVE**

## Title / 标题
**External Tax - Force Update Tax Documents / 外部税务 - 强制更新税务凭证**

## Operation / 操作
`TaxForceUpdate`

---

## Description / 描述
Update data in the external tax system using this synchronous outbound service. Forces the update of tax document data from SAP S/4HANA Cloud to an external tax engine, ensuring tax calculations are refreshed and synchronized.

通过此同步出站服务更新外部税务系统中的数据。强制将 SAP S/4HANA Cloud 的税务凭证数据更新到外部税务引擎，确保税务计算刷新并同步。

---

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

## Message Structure / 消息结构

### Request / 请求
| Element | Type | Description (EN) | Description (CN) |
|---------|------|------------------|------------------|
| `TaxDocumentUpdate` | `TAX_UPDATE` | Tax document update header | 税务凭证更新抬头 |
| `?TaxDocumentNumber` | `CHAR(10)` | Tax document number | 税务凭证号 |
| `?TaxDocumentYear` | `CHAR(4)` | Tax document fiscal year | 税务凭证财年 |
| `?CompanyCode` | `CHAR(4)` | Company code | 公司代码 |
| `?DocumentDate` | `DATE` | Document date | 凭证日期 |
| `?PostingDate` | `DATE` | Posting date | 过账日期 |
| `?TaxDocumentType` | `CHAR(2)` | Tax document type | 税务凭证类型 |
| `?ForceUpdateReason` | `CHAR(2)` | Reason for force update | 强制更新原因 |
| `TaxItems` | Table | Tax document items | 税务凭证行项目 |
| `?ItemNumber` | `NUM(6)` | Item number | 行项目号 |
| `?TaxCode` | `CHAR(2)` | Tax code | 税务代码 |
| `?TaxAmount` | `DECIMAL` | Tax amount in document currency | 凭证货币税务金额 |
| `?TaxBaseAmount` | `DECIMAL` | Tax base amount | 计税基础金额 |
| `?TaxJurisdiction` | `CHAR(15)` | Tax jurisdiction code | 税务管辖码 |
| `?TaxRate` | `DECIMAL` | Tax rate percentage | 税率百分比 |
| `?Currency` | `CUKY(5)` | Currency | 货币 |

### 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 | 消息文本 |
| `?UpdateStatus` | `CHAR(1)` | Update status (S=Success, F=Failed) | 更新状态（S=成功、F=失败） |
| `?ExternalReference` | `CHAR(32)` | External system reference number | 外部系统参考号 |

---

## Example Payload / 示例负载

### Request
```xml
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <TaxForceUpdate>
      <TaxDocumentUpdate>
        <TaxDocumentNumber>0090000001</TaxDocumentNumber>
        <TaxDocumentYear>2026</TaxDocumentYear>
        <CompanyCode>1000</CompanyCode>
        <DocumentDate>2026-07-23</DocumentDate>
        <PostingDate>2026-07-23</PostingDate>
        <TaxDocumentType>RV</TaxDocumentType>
        <ForceUpdateReason>01</ForceUpdateReason>
      </TaxDocumentUpdate>
      <TaxItems>
        <item>
          <ItemNumber>1</ItemNumber>
          <TaxCode>I1</TaxCode>
          <TaxAmount>13000.00</TaxAmount>
          <TaxBaseAmount>100000.00</TaxBaseAmount>
          <TaxJurisdiction>CN-1100000000</TaxJurisdiction>
          <TaxRate>13.00</TaxRate>
          <Currency>CNY</Currency>
        </item>
        <item>
          <ItemNumber>2</ItemNumber>
          <TaxCode>I0</TaxCode>
          <TaxAmount>0.00</TaxAmount>
          <TaxBaseAmount>50000.00</TaxBaseAmount>
          <TaxJurisdiction>CN-1100000000</TaxJurisdiction>
          <TaxRate>0.00</TaxRate>
          <Currency>CNY</Currency>
        </item>
      </TaxItems>
    </TaxForceUpdate>
  </soap:Body>
</soap:Envelope>
```

### Response
```xml
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <TaxForceUpdateResponse>
      <Return>
        <Type>S</Type>
        <Message>Tax document force-updated successfully / 税务凭证已强制更新成功</Message>
        <UpdateStatus>S</UpdateStatus>
        <ExternalReference>EXT-TAX-REF-20260723-001</ExternalReference>
      </Return>
    </TaxForceUpdateResponse>
  </soap:Body>
</soap:Envelope>
```

---

## Error Codes / 错误代码
| Code | Description (EN) | Description (CN) |
|------|------------------|------------------|
| `TAX_001` | Invalid tax document number | 无效的税务凭证号 |
| `TAX_002` | Tax document not found | 未找到税务凭证 |
| `TAX_003` | External system unavailable | 外部系统不可用 |
| `TAX_004` | Invalid tax code | 无效的税务代码 |
| `TAX_005` | Force update not permitted for this document | 不允许强制更新此凭证 |

---

## Notes / 备注
- This is a synchronous outbound service / 此为同步出站服务
- Use force update when tax recalculation is required due to changes in tax rates, jurisdiction codes, or document data / 当由于税率、管辖码或凭证数据变更而需要重新计算税务时使用强制更新
- The external system must be configured and available / 外部系统必须已配置且可用
- Force update reason codes: 01=Rate Change, 02=Jurisdiction Change, 03=Data Correction, 04=Manual Trigger / 强制更新原因码：01=税率变更、02=管辖码变更、03=数据更正、04=手动触发