循环AtTO其中找不到线路
我在循环使用一个表中的属性与另一个表中的属性相同的条件时遇到问题。为了更好地解释,我将过去的代码。这不是一件困难的事情,但我不明白我在哪里犯了错误。
LOOP AT gt_spfli INTO wa_spfli.
AT NEW carrid.
WRITE:/ wa_spfli-carrid.
ENDAT.
LOOP AT gt_sflight INTO wa_sflight WHERE carrid EQ wa_sflight-carrid.
WRITE:/ wa_sflight-carrid,
wa_sflight-connid,
wa_sflight-price.
ENDLOOP.
ULINE.
ENDLOOP.
对于 spfli 中的每个 carrid,我想显示 sflight 包含该 carrid 的内容。但它只写入 wa_spfli-carrid。它永远不会进行第二次写入。当我进行调试时,我发现 wa_sflight 始终为空。 (或者永远不会到达它) gt_sflight 和 gt_spfli 已填充,那么问题来自哪里?如果我删除“where carrid EQ wa_sflight-carrid”有效...但不是我想要在屏幕上显示的内容。
其他信息(不知道是否有用):gt_spfli和gt_sflight是通过我自己制作的功能模块填充的。
I have a problem with Loop through a using the condition that an attribute from one table is the same with the other. For better explaining i'll past the code. Is not something difficult but i don't understand where i make the mistake.
LOOP AT gt_spfli INTO wa_spfli.
AT NEW carrid.
WRITE:/ wa_spfli-carrid.
ENDAT.
LOOP AT gt_sflight INTO wa_sflight WHERE carrid EQ wa_sflight-carrid.
WRITE:/ wa_sflight-carrid,
wa_sflight-connid,
wa_sflight-price.
ENDLOOP.
ULINE.
ENDLOOP.
For every carrid in spfli i want to show what sflight contains for that carrid. But it only writes the wa_spfli-carrid. It never gets to second write. When i do debugging i get that wa_sflight is always empty. ( or never gets to it ) gt_sflight and gt_spfli is populated so where does the problem comes from? If i remove the "where carrid EQ wa_sflight-carrid" works... but is not what i want to be shown on screen.
Additional info ( don't know if it's useful ): the gt_spfli and gt_sflight is populated through a function module i made myself.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在内部循环中,您想要将 carrid 与 wa_spfli-carrid (来自外部循环)进行比较,而不是与 wa_sflight-carrid 进行比较。
On the inner loop, you want to compare carrid with wa_spfli-carrid (which comes from the outer loop) and not with wa_sflight-carrid.