从 DB 表中获取单个字段到 itab 中
我想从透明表 z_accounts
中获取 excep_point
字段,以获取 company_code
和 account_number
的组合。我怎样才能在ABAP SQL 中做到这一点?
假设表结构为
|company_code | account_number | excep_point |
I want to fetch the a field say excep_point
from a transparent table z_accounts
for the combination of company_code
and account_number
. How can I do this in ABAP SQL?
Assume that table structure is
|company_code | account_number | excep_point |
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
假设你有完整的主键...
如果你没有完整的 PK 并且 exceptp_point 可能有多个值
至少还有另一种变体,但这是我最常使用的 2 个。
Assuming you have the full primary key...
if you don't have the full PK and there could be multiple values for excep_point
There is at least another variation, but those are 2 I use most often.
仅供参考。当您将数据选择到表中时,您可以编写复杂的表达式来组合不同的字段。例如,您有一个包含两个字段“A”和“B”的内部表 (itab)。您将从具有 6 列的数据库表 (dbtab) 中选择数据 - “z”、“x”、“y”、“u”、“v”、“w”。例如,每个字段都是 char2 类型,您的目标是在内部表的“A”字段中合并“z”、“x”、“y”、“u”,在“B”字段中合并“v”、“w”。您可以编写简单的代码:
这个简单的代码使您的工作完成得非常简单
For information only. When you selects data into table you can write complex expressions to combine different fields. For example, you have internal table (itab) with two fields "A" and "B". And you are going to select data from DB table (dbtab) wich have 6 columns - "z","x","y","u","v","w". And for example each field is type char2 You aim to cimbine "z","x","y","u" in "A" field of internal table and "v","w" in "B" field. You can write simple code:
This simple code makes you job done very simple
除了Bryans的回答之外,这里是官方在线有关 Open SQL 的文档。
In addition to Bryans answer, here is the official online documentation about Open SQL.