abapsap-selection-screenssap-query

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): enter image description here

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

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


Solution

  • 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:

    enter image description here

    You now have to

    This pic will show You, what this might mean.

    enter image description here

    enter image description here

    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.