简体   繁体   English

如何将内部表的列的值放入变体中?

[英]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.你的问题对我来说有点不清楚。

  • Do you speak about two programs or one program?你说的是两个程序还是一个程序?
  • What's the parameter you want to fill in the variant?您要填写变体的参数是什么?

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 条记录填充到一个变体中并保存,以便使用此变体和其中保存的值我可以运行特定程序

  • You have a program and you want to save a selection in a variant.您有一个程序,并且希望将选择保存在变体中。 So you need some parameters for the selection screen.所以你需要一些选择屏幕的参数。
  • You want a table, so you need a SELECT-OPTION .你想要一张桌子,所以你需要一个SELECT-OPTION
  • To define a 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:现在你得到:

在此处输入图片说明

  • When you push (1) you can enter values.当您按下 (1) 时,您可以输入值。
  • With (2) you can load from an external file,使用 (2) 您可以从外部文件加载,
  • with (3) you can load values from clipboard.使用 (3) 您可以从剪贴板加载值。

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_COPYRS_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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM