[英]How to put the values of a column of an internal table into a variant?
Can somebody help me figure out if there is a way for the query below:有人可以帮我弄清楚下面的查询是否有办法:
I have an internal table with one column with 69 records.我有一个内部表,其中一列有 69 条记录。
I want all these 69 records to be populated into a variant and get saved so that with this variant and the values saved in it I can run a particular program我希望将所有这 69 条记录填充到一个变体中并保存,以便使用此变体和其中保存的值我可以运行特定程序
How can I populate these values ?如何填充这些值?
Your question is a bit unclear for me.你的问题对我来说有点不清楚。
I'll just give you some hints - depending on your situation you must pick the correct parts.我只是给你一些提示——根据你的情况,你必须选择正确的部分。
I have an internal table with one column with 69 records.
我有一个内部表,其中一列有 69 条记录。
How is the internal table filled?内表是怎么填的?
I want all these 69 records to be populated into a variant and get saved so that with this variant and the values saved in it I can run a particular program
我希望将所有这 69 条记录填充到一个变体中并保存,以便使用此变体和其中保存的值我可以运行特定程序
SELECT-OPTION
.SELECT-OPTION
。SELECT-OPTION
you need a DDIC-reference (you must say, what kind of field you want.).SELECT-OPTION
你需要一个 DDIC 引用(你必须说,你想要什么样的字段。)。 In the following example I use a material number ( MARA-MATNR
).MARA-MATNR
)。 So you program contains something like:所以你的程序包含如下内容:
TABLES mara.
SELECT-OPTIONS: s_matnr FOR mara-matnr.
With this you would get:有了这个,你会得到:
You can define ranges (from-to) and list of values.您可以定义范围(从到)和值列表。 As you want only single values, you need something like:
由于您只需要单个值,因此您需要以下内容:
SELECT-OPTIONS: s_matnr FOR mara-matnr NO INTERVALS.
Now you get:现在你得到:
So you can fill your values and store the selection in a variant.因此,您可以填充您的值并将选择存储在一个变体中。
When you execute your program, the data is stored in a ranges table:执行程序时,数据存储在范围表中:
Now you can loop on this table and copy the S_MATNR-LOW
value into your internal table for further processing.现在您可以在该表上循环并将
S_MATNR-LOW
值复制到您的内部表中以进行进一步处理。
If I misunderstood you question and you want to create a variant dynamically, then take a look on function module RS_VARIANT_ADD
(or RS_VARIANT_COPY
, RS_VARIANT_CHANGE
...)如果我误解了你的问题并且你想动态创建一个变体,那么看看功能模块
RS_VARIANT_ADD
(或RS_VARIANT_COPY
, RS_VARIANT_CHANGE
...)
You could always put the values in TVARVC, either manually or via code.您始终可以手动或通过代码将值放入 TVARVC。 Then specify the TVARVC variable in the variant definition.
然后在变体定义中指定 TVARVC 变量。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.