PAYATHON 2026

VF02 中提示“Output is not defined”如何解决?

数据小许

结论

“Output is not defined”通常不是 VF02 本身的问题,而是新建的 output type 没有完整加入当前开票类型使用的输出确定过程(output determination procedure)。

在经典 SD 输出管理中,需要完成以下配置链路:

Application V3
→ Output Type
→ Output Determination Procedure
→ Billing Type
→ Condition Record
→ Billing Document Output

任何一环缺失,都可能导致 VF02 无法手工添加该 output type。完成配置后,可以在 VF02 中生成或维护输出记录,再通过 VF03 的 Billing document -> Issue Output To 处理输出。

产生错误的原因

VF02 不允许随意输入一个已创建但尚未分配的 output type。系统会先根据当前 billing document 的 billing type 找到对应的输出确定过程,再检查该过程是否包含这个 output type。

常见原因有:

  • output type 建在了错误的 application 下;
  • output type 已创建,但没有加入输出确定过程;
  • 输出确定过程没有分配给当前 billing type;
  • output type 的处理程序、form 或 transmission medium 未配置;
  • 自动确定时缺少 condition record;
  • 修改配置后,测试用的 billing document 中还没有生成对应的 NAST 记录;
  • 系统使用 SAP S/4HANA 新版 Output Management,而不是经典 NAST 输出管理。

配置步骤

1. 确认 output type 属于 Application V3

经典 SD Billing Output 通常使用:

V3 - Billing

进入事务码 NACE:

NACE
→ Application V3
→ Output Types

检查新建的 output type 是否创建在 V3 下。如果它建在销售订单、交货等其他 application 下,即使名称相同,也不能直接用于 VF02。

还要检查以下项目:

  • Access sequence;
  • Default values;
  • Transmission medium;
  • Partner function;
  • Processing routines;
  • Print program;
  • Form routine;
  • SAPscript form、Smart Form 或 Adobe Form。

如果只需要在 VF02 中手工添加输出,access sequence 不一定是必需的。如果希望系统根据条件自动确定输出,通常需要配置 access sequence 和 condition record。

2. 将 output type 加入输出确定过程

仍在 NACE 的 V3 application 下,进入:

NACE
→ Application V3
→ Procedures

找到当前 billing type 使用的 output determination procedure,将新建的 output type 添加到该 procedure 的控制数据中。

配置时要注意:

  • Step 和 Counter 不能与现有条目冲突;
  • Requirement routine 不应错误地拦截该输出;
  • “Manual only”等标志应符合实际需求;
  • 如果设置了排他条件或前置步骤,需要确认新 output type 不会被跳过。

如果当前 procedure 中没有这个 output type,在 VF02 中手工输入时,通常会出现”Output is not defined”或含义相近的错误。

3. 确认 billing type 使用了正确的 procedure

通过 VOFA 检查当前 billing document 的 billing type,例如 F2 或自定义 billing type。

配置路径通常是:

SPRO
→ Sales and Distribution
→ Basic Functions
→ Output Control
→ Output Determination
→ Output Determination Using the Condition Technique
→ Maintain Output Determination for Billing Documents

确认 billing type 分配的 output determination procedure,与上一步添加 output type 的 procedure 一致。

如果 output type 加在 procedure A 中,而当前 billing type 实际使用 procedure B,VF02 仍然无法识别这个 output type。

具体字段位置和菜单名称可能因 SAP 版本及 IMG 结构而略有差异,但检查原则不变:当前 billing type 必须能确定到包含该 output type 的 procedure。

4. 配置处理程序和表单

在 NACE -> V3 -> Output Types 中选择 output type,然后维护 Processing Routines。

典型配置如下:

Transmission medium: 1
Program:              Z_BILLING_OUTPUT
Form routine:         ENTRY
Form:                 Z_BILLING_FORM

这些名称只是示例,不能直接照搬。实际配置应使用项目中已经开发并激活的程序、入口例程和表单。

对于经典 ABAP 输出程序,入口例程通常采用类似结构:

FORM entry USING return_code us_screen.

  return_code = 0.

  "读取开票数据并调用实际输出逻辑

ENDFORM.

入口例程的参数必须符合对应输出处理框架的要求。如果复制标准 output type,还应逐项检查并调整:

  • Print program;
  • Form routine;
  • Form name;
  • Transmission medium;
  • Partner function。

创建自定义 output type 时,可以复制一个业务行为相近的标准 billing output type,再修改程序、表单和条件配置。

5. 创建 condition record

如果希望系统自动确定新的 output type,需要创建相应的 condition record。经典 Billing Output 通常使用以下事务码:

VV31 - Create Billing Output Condition
VV32 - Change Billing Output Condition
VV33 - Display Billing Output Condition

在 VV31 中输入新的 output type,并按照 access sequence 选择条件组合,例如:

Billing Type
Sales Organization
Customer

然后维护:

  • Transmission medium;
  • Dispatch time;
  • Partner function;
  • Language;
  • Printer 或其他通信参数。

如果 output type 只允许手工添加,可能不需要 condition record,但它仍然必须加入当前输出确定过程。

在 VF02 中测试

完成配置后,打开目标 billing document:

VF02
→ Header
→ Output

不同版本的菜单名称可能略有不同。添加新的 output type 后,检查以下内容:

  • 系统已经接受该 output type;
  • partner 已正确确定;
  • medium 正确;
  • dispatch time 符合测试要求;
  • Processing Log 中没有程序、表单或打印参数错误。

保存 billing document,让系统写入输出记录。

如果需要立即测试,可以根据业务设置选择立即处理。如果采用批量处理方式,则可能需要通过 VF31 处理输出。

在 VF03 中使用 Issue Output To

VF03 中的以下功能:

Billing document
→ Issue Output To

通常用于处理该 billing document 中已经存在的输出记录,不能在这里临时定义一个全新的 output type。

正确顺序是:

  1. 完成 NACE 和 billing type 配置;
  2. 通过输出确定或 VF02 手工生成输出记录;
  3. 保存 billing document;
  4. 在 VF03 中选择 Issue Output To;
  5. 选择打印、预览或其他允许的输出目标。

如果 VF03 中看不到该 output type,应先返回 VF02,确认输出记录是否存在,并检查处理状态、medium 和 dispatch time 是否允许再次输出。

使用 ABAP 检查输出记录

在经典 NAST 架构下,可以查询 NAST 表,检查 billing document 是否已有对应的输出记录。下面的代码只用于诊断,不能代替配置:

SELECT kappl,
       objky,
       kschl,
       nacha,
       vstat
  FROM nast
  WHERE kappl = 'V3'
    AND objky = @lv_vbeln
    AND kschl = @lv_kschl
  INTO TABLE @DATA(lt_nast).

主要字段的含义如下:

KAPPL = Application,Billing 通常为 V3
OBJKY = Object key,通常对应开票凭证号
KSCHL = Output type
NACHA = Transmission medium
VSTAT = Processing status

OBJKY 的格式应与开票凭证的内部格式一致,必要时需要包含前导零。如果查询不到记录,说明输出尚未确定或保存。如果记录存在但处理失败,应查看 VF02 中的 Processing Log,并继续检查输出程序、表单和通信参数。

注意事项

  • “创建 output type”和”将 output type 分配给 VF02”不是两个直接绑定的动作。VF02 是业务事务码,真正的控制关系在 billing type、output procedure 和 output type 之间。
  • 配置变更后,旧 billing document 不一定会自动补充新的输出记录。通常需要在 VF02 中重新执行输出确定或手工添加。
  • 如果 output type 可以添加,但处理失败,问题就不再是”输出未定义”,而是程序、表单、partner、medium 或打印参数的配置问题。
  • 配置属于 Customizing,开发程序和表单属于 Workbench 对象,两类对象可能需要分别传输。
  • 如果系统启用了 SAP S/4HANA Output Management,输出确定可能由 BRFplus、Output Parameter Determination 和 Adobe Forms 控制。此时不能只依赖 NACE、NAST 和 VV31,应先确认该 billing type 使用的是经典 NAST,还是新版 Output Management。
  • 不建议直接修改 SAP 标准 output type。通常应将标准配置复制到 Z* 或 Y* 命名空间,再配置 procedure、condition record 和 processing routine。

备注:内容仅供参考。