SAP ABAP SY-REPID 变化「Note」

从6.10版本开始,SY-REPID不再属于结构SY或SYST,而是作为每个程序的预定义常量存在。这带来了性能提升,且在外部过程调用中可以直接传递调用者名称,无需辅助变量。对于仍引用旧结构syst的程序,这可能导致不兼容问题。
摘要由CSDN通过智能技术生成

6.10 前(知悉)

在这里插入图片描述

SY-CPROG

The name of the calling program in an external routine, otherwise the name of the current program.

  • 外部例程中调用程序的名称,否则为当前程序的名称

SY-REPID

Name of the current ABAP program. For externally-called procedures, it is the name of the main program of the procedure. If you pass SY-REPID as an actual parameter to an external procedure, the formal parameter does not contain the name of the caller, but that of the main program of the procedure. To avoid this, assign SY-REPID to an auxiliary variable and use that in the call, or use the system field SY-CPROG.

  • 当前 ABAP 程序的名称。对于外部调用的程序,为程序的主程序名。如果将 SY-REPID 作为实际参数传递给外部过程,则形式参数不包含调用者的名称,而是包含该过程的主程序的名称。为避免这种情况,请将 SY-REPID 分配给辅助变量并在调用中使用它,或者使用系统字段 SY-CPROG

6.10 后(记住)

在这里插入图片描述

Replacement of the system field sy-repid

系统字段 sy-repid 不再是 ABAP 程序中结构 SY 或 ABAP 字典中结构类型 SYST 的组成部分。相反,从 6.10 版开始,每个程序都包含预定义常量 sy-repid 和 syst-repid,它们都包含当前程序的名称

  • 因此,过时的类型引用 LIKE syst-repid 和 TYPE sy-repid 仍然是可能的

除了在外部过程调用方面有相当大的性能改进外,这个新特性还有一个好处,即:

  • sy-repid 现在也可以作为参数传递给外部过程
  • 形式参数设置为调用者的名称而不是主程序的名称,这意味着不再需要辅助变量

如果 ABAP 程序引用以前的结构 syst,这种不兼容的更改可能会导致问题,例如:

DATA my_syst type syst.
... my_syst-repid ... ... my_syst-repid ...

ASSIGN COMPONENT 'REPID' OF STRUCTURE sy TO ...
  • 1
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Wriprin

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值