简体   繁体   中英

Add SELECT-OPTIONS for infoset

I'm not able to add properly a Select-Option for a Parameter into an infoset. 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): 在此处输入图片说明

I don't understand how insert a range selectable parameter using "SELECT-OPTION" satement.

Thanks in advance for any kind of help/suggestion. S.

Let's go.

1. Info:

Did You inspect this function module BAPI_PLANNEDORDER_GET_DETAIL ? It does not accept any ranges-tables / select-options as arguments to its parameters.

2. Assumption:

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:

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". ). 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. 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). 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. And SAP offers a lot.

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

A little bit more effort.

In fact to much for a simple query like this.

4. Conclusion:

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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