简体   繁体   English

为信息集添加 SELECT-OPTIONS

[英]Add SELECT-OPTIONS for infoset

I'm not able to add properly a Select-Option for a Parameter into an infoset.我无法将参数的 Select-Option 正确添加到信息集中。 I got this parameters in the selection screen:我在选择屏幕中得到了这个参数:

    REPORT  RSAQDVP_TEMPLATE .
*
*---------------------------------------------------------------------*
*   declarations
*   (insert your declarations in this section)
*---------------------------------------------------------------------*
data:
  BAPI_PLDORDCOMP_E1 type BAPI_PLDORDCOMP_E1,
  it_data type standard table of BAPI_PLDORDCOMP_E1.


field-symbols: <struc> type BAPI_PLDORDCOMP_E1.

*-------------------------------------------------------------------*
*   selection screen statements
*-------------------------------------------------------------------*
*   (define your selection-screen here)
parameters: plant_in like MARC-WERKS default 'IX09',
        pln_orde type PLAF-PLNUM.


* !! the following comment MUST NOT BE CHANGED !!
*<QUERY_HEAD>


*-------------------------------------------------------------------*
*   read data into IT_DATA
*-------------------------------------------------------------------*
*  (select your data here into internal table IT_DATA)
call function 'BAPI_PLANNEDORDER_GET_DETAIL'
  EXPORTING
    PLANNEDORDER = pln_orde
  TABLES
    componentsdata = it_data.

So basically 2 Parameters (see screenshot in SQ01):所以基本上有 2 个参数(见 SQ01 中的截图): 在此处输入图片说明

I don't understand how insert a range selectable parameter using "SELECT-OPTION" satement.我不明白如何使用“SELECT-OPTION”语句插入范围可选参数。

Thanks in advance for any kind of help/suggestion.在此先感谢您的任何帮助/建议。 S. S。

Let's go.我们走吧。

1. Info: 1.信息:

Did You inspect this function module BAPI_PLANNEDORDER_GET_DETAIL ?你检查过这个功能模块 BAPI_PLANNEDORDER_GET_DETAIL 吗? It does not accept any ranges-tables / select-options as arguments to its parameters.它不接受任何范围表/选择选项作为其参数的参数。

2. Assumption: 2. 假设:

The only thing, which might be Your aim, based on the type of variable declaration at the beginning,唯一的可能是您的目标,基于开头的变量声明类型,

it_data type standard table of BAPI_PLDORDCOMP_E1.

makes me assume, that You might want to provide a list of components and therefore You think, You need a ranges table so that ONLY CERTAIN COMPONENTS are selected.让我假设,您可能想要提供组件列表,因此您认为,您需要一个范围表,以便仅选择某些组件。

3. How-To: 3. 操作方法:

If this is Your case, then You have to create select-options in Your selection screen, simple as this: (This might be a way, nevertheless, You should find the proper table, where all components of a plannedorder are stored, and use its "name"-matnr in the "FOR". ).如果这是您的情况,那么您必须在您的选择屏幕中创建选择选项,就像这样:(这可能是一种方法,但是,您应该找到合适的表,其中存储了计划订单的所有组件,并使用它的“名称”-matnr 在“FOR”中。)。 This here simply shows, how it is done.这在这里简单地展示了它是如何完成的。

SELECT-OPTIONS: so_matnr FOR marc-matnr.

IF the program mourns, add the statement at the beginning, or in the top-include:如果程序哀悼,请在开头或顶部添加语句:

TABLES: "TheTableNameYouWantForFor".

If You add the SO_xxx to Your param's section, this will create implicitely a variable in the code, which serves as range-table.如果您将 SO_xxx 添加到您的参数部分,这将在代码中隐式创建一个变量,用作范围表。 In the debugger You can see something like this:在调试器中,您可以看到如下内容:

在此处输入图片说明

You now have to你现在必须

  • a) ANALYZE THIS RANGE-TABLE, in order to parse it properly This is not easy, (there might be a function-module/method for that, but I do not know). a) 分析这个范围表,以便正确解析它这并不容易,(可能有一个功能模块/方法,但我不知道)。 What You will basically have to do is, to extract those material-numbers, WHICH are desired.您基本上要做的是,提取那些需要的材料编号。 This is not that obvious as it sounds, because a user also COULD have entered SEVERAL RANGES / SEVERAL EXCLUSIONS / SEVERL SINGLE VALUES / SEVERAL INCLUSIONS.这听起来并不那么明显,因为用户也可以输入几个范围/几个排除/几个单一值/几个包含。 The fields SIGN and OPTION are responsible for the combination mentioned above. SIGN 和 OPTION 字段负责上述组合。 And SAP offers a lot. SAP 提供了很多。

This pic will show You, what this might mean.这张照片会告诉你,这可能意味着什么。

在此处输入图片说明

  • b) Once You parsed all stuff properly and really identified, WHICH MATERIALS SHOULD BE ALSO SELECTED (perhaps a second mediator table), You can loop at the so_xxx-implicit-table or mediator-table into a struct, fetch the value, pass it to the structure of the argument-table of the bapi call and HOPE, that the materialnumber is enough for the BAPI-structure to deliver the materials (you should test this with se37 first). b)一旦您正确解析了所有内容并真正确定了哪些材料也应该被选择(可能是第二个中介表),您可以将 so_xxx-implicit-table 或 mediator-table 循环到一个结构中,获取值,传递它到 bapi 调用和 HOPE 的参数表的结构,材料编号足以让 BAPI 结构交付材料(您应该先用 se37 测试这个)。 How to retrieve the materials from the implicit select-options-table?如何从隐式选择选项表中检索材料?

在此处输入图片说明

But, from what I can see, and this would be the proper way, is to self-define a F4-callback, because You are already entering the key of the planned order.但是,据我所知,这将是正确的方法,是自定义一个 F4 回调,因为您已经输入了计划订单的键。 This would mean, You would have a subset of all materials in the system, reduced to those being components of the planned order.这意味着,您将拥有系统中所有物料的子集,减少为计划订单的组件。

This would involve custom F4-Helps, custom F4-HelpExits, custom F4-Callbacks.这将涉及自定义 F4-Help、自定义 F4-HelpExits、自定义 F4-Callbacks。

A little bit more effort.再努力一点。

In fact to much for a simple query like this.事实上,对于像这样的简单查询来说太多了。

4. Conclusion: 4。结论:

Check, what the BAPI does, reimplement it partially (check the selected tables, se37, and st05 prior to se37 will tell you), write the proper code Yourself ( or copy paste from the bapi), and You can use the matnr-range as it is posted above.检查,BAPI 做了什么,部分重新实现它(检查选定的表,se37 和 se37 之前的 st05 会告诉你),自己编写正确的代码(或从 bapi 复制粘贴),并且您可以使用 matnr-range正如上面发布的那样。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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