# `Sp_afterSave_sPpa` (procedure) > 采购申请保存后反写数量 - **Type:** PROCEDURE - **Deterministic:** NO - **SQL data access:** CONTAINS SQL ## Parameters | # | Mode | Name | Type | |---|---|---|---| | 1 | IN | `sGuid` | `varchar(2000)` | | 2 | IN | `sBrId` | `varchar(100)` | | 3 | IN | `sSuId` | `varchar(100)` | | 4 | OUT | `sCode` | `int` | | 5 | OUT | `sReturn` | `varchar(4000)` | ## Body _Body is not pre-cached. To inspect: `mysql --defaults-file=~/.my.cnf -e 'SHOW CREATE PROCEDURE `Sp_afterSave_sPpa`'`._ ## Narrative **Business context:** 采购申请单据 → 采购明细 → 采购管理 — header says 采购申请保存后反写数量. Thin save-phase 反写 wrapper in the `Sp_afterSave_s` family that delegates the actual qty back-write to `Sp_saveReturn_sPpa`. **What it does:** Wraps `sGuid` in double-quotes if not already quoted and, when `sGuid` is non-empty, calls `Sp_saveReturn_sPpa(sGuid, sBrId, sSuId, 2, @sCode, @sReturn)` (iFlag=2 = "after save" phase). Does not propagate the inner `@sCode`/`@sReturn` back to its own OUT params. **Invocation:** Reached on two paths. (1) `Sp_Check_sPpa` calls this proc near the tail of a successful save — note `gdsmodule.sSaveProName` slot on 采购申请单据 is currently empty, so `Sp_Check_sPpa` itself is not the live save-commit dispatcher; the form may rely on the dispatch path below. (2) `Sp_Invalid_backwriting` dispatches to this proc on 作废/取消作废 of form `192116810113315217105813660` (采购申请单据), itself triggered from Java `CheckmodelServiceImpl` via `Sp_Invalidation`.