从 FM 调用方法时,参数与形式参数类型不兼容
静态公共类方法 zcl_abc=>dosomething 有一个导入参数
it_lines 类型 TLINE_T 可选
并且有一个名为 zfm_dosame 的 FM。它有一个参数
表格 IT_LINES 类型 TLINE_T 可选
zfm_dosame 调用 zcl_abc=>dosomething 并尝试将 it_lines 传递给 it_lines。但是,语法错误:
IT_LINES 与形参 IT_LINES 类型不兼容。
这个错误让我发疯。我不知道怎么会这样......请帮忙!
A static public class method, zcl_abc=>dosomething, has an importing parameter
it_lines type TLINE_T optional
And there is a FM called zfm_dosame. It has a parameter
TABLES IT_LINES TYPE TLINE_T OPTIONAL
zfm_dosame calls zcl_abc=>dosomething and tries to pass it_lines to it_lines. However, syntax error:
IT_LINES is not type-compatible with formal parameter IT_LINES.
This error drives me crazy. I have no idea how come... Please help!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
函数接口的 TABLES 部分在运行时创建带有标题行的内部表。
因此,为了传递整个表(而不是仅一个工作区),您应该将
IT_LINES[]
而不是IT_LINES
传递给您正在调用的方法。The TABLES part of a function interface creates internal tables with header line at runtime.
So in order to pass the entire table, instead of just one work area, you should pass
IT_LINES[]
instead ofIT_LINES
to the method you're calling.如果没有更多信息(例如功能模块、功能组和类的完整源代码),很难判断,但我会猜测:很可能您的类型 TLINE_T 不是全局类型,而是本地定义的(并且不同)在功能模块的功能组和类中。
尝试在两个位置双击 TLINE_T 类型,看看会出现什么情况。如果它在两个地方都将您带到全局类型(您也应该能够在 SE11 中看到),那么我错了,并且还有其他情况发生。
It is difficult to tell without more information like the full source code of your function module, function group, and class, but I'll take a guess: Most likely your type TLINE_T is not a global type, but is instead defined locally (and differently) in both the function group of the function module and in the class.
Try double-clicking on the type TLINE_T in both places and see where that brings you. If it brings you to a global type (which you should also be able to see in SE11) in both places, then I'm wrong and there is something else going on.