Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

How to pass SELECT-OPTIONS to forms or FM?

Former Member
0 Kudos

Hi,

The issue is:

In my program, there are many SELECT-OPTIONS parameters, all of different types.

Now I want to pass these select-options to a form for some operation.

So I want to know how to acheive this? I have tried by providing the type of the 'parameter' in the FORM as SELOPT(DDIC Structure), but there is type compatibility issue.

Kindly help.

Regards

s.a.k

1 ACCEPTED SOLUTION

Former Member
0 Kudos

If you wish to pass the possible values then you can fetch these values from the master table using the select option.

and then keep them in internal table.

Pass this internal table to form of FM.

Also, there is IN option , but this is used with submit.Please check at you end.

11 REPLIES 11

Former Member
0 Kudos

If you wish to pass the possible values then you can fetch these values from the master table using the select option.

and then keep them in internal table.

Pass this internal table to form of FM.

Also, there is IN option , but this is used with submit.Please check at you end.

0 Kudos

Hi Harsh,

Is there any other way to do this?

Can we make it generic? Like defining the parameter fo the form to TYPE ANY so that it accepts any type of SELECT_OPTION.

Can it be done? Please suggest.

Regards

s.a.k

0 Kudos

hi

I think this is a bug. If you post the message twice, it get added to the list.

Edited by: siemens.a.k on Sep 20, 2009 3:04 PM

Edited by: siemens.a.k on Sep 20, 2009 3:05 PM

0 Kudos

Hi,

Try using Ranges then.

For Eg, In the report if the select-option was like


select-options: s_matnr for mara-matnr.

Now in the TOP include of the function module declare a types like,


types: z_matnr type range of mara-matnr.

In the function module use like


FUNCTION ztest.
*"----------------------------------------------------------------------
*"*"Local Interface:
*"  IMPORTING
*"     VALUE(I_MATNR) TYPE  Z_MATNR OPTIONAL

Now this will act as a select-options

Regards,

Vikranth

0 Kudos

why not make the select options as global so tht u can directly use them inside ur form.

Anyways I think i did pass select options as parameters in one of my old program . I can check tht on tuesday only so by then if your problem is not solved, i'll search that and let u know the solution. just drop me a mail once.

Edited by: Kartik Tarla on Sep 20, 2009 9:44 PM

Clemenss
Active Contributor
0 Kudos

Hi siemens a.k.

select-options are internal tables internally. If you want to pass them as parameters, they are always table parameters. And because select-options are internal tables with header line, you must pass only the body, i.e. the select-options s_matnr for mara-matnr will be passed as s_matnr[].

If you want it generic, you can define the parameter as TYPE TABLE (or TYPE ANY TABLE or TYPE STANDARD TASBLE, makes no difference).

If you want to use the correct applicable non-generic type, you may look for an existing table type with the components SIGN, OPTION, LOW and HIGH where LOW and HIGH are defined with the type used for the values, i.e.TYPE MARA-MATNR.

You can define your own table types either in dictionary or in program. In the program it would be of TYPE RANGE OF mara-matnr.

It is not easy to find in the documentation, the path is not just intuitively obvious.

SAP NetWeaver 7.0 EHP1 -> SAP NetWeaver by Key Capability -> Application Platform by Key Capability -> ABAP Technology -> UI Technology -> SAP GUI Technology -> Screen Programming ->Selection Screens -> Defining Selection Screens -> Defining Complex Selections will finally lead to the sub-category

[Selection Tables|http://help.sap.com/saphelp_nw70ehp1/helpdata/en/9f/dba78735c111d1829f0000e829fbfe/frameset.htm]

I must admit this is not just easy, but SAP hast made huge improvements o the search functionality. Once you are in the SAP NetWeaver Library, the search may help you to gather the information you need - although you still get lost sometimes

Regards,

Clemens

Former Member
0 Kudos

Hi,

You don't understand the problem : the routine is to be called with different select-options.

I faced the same problem and I used the below dirty abap :

FORM fill_range_read_cube TABLES sel_opt
                           USING value(l_charname).
  DATA l_selopt TYPE rsdsselopt.

  DATA : len TYPE i,
         offset TYPE i.

  DESCRIBE FIELD sel_opt LENGTH len IN CHARACTER MODE.

  len = ( len - 3 ) / 2.

  LOOP AT sel_opt INTO l_selopt.
    CLEAR g_s_range.
    g_s_range-chanm  = l_charname.
    g_s_range-sign   = l_selopt-sign.
    g_s_range-compop = l_selopt-option.
    offset =  3. " sign + option
    g_s_range-low    = l_selopt+3(len).
    offset = 3 + len.
    g_s_range-high   = l_selopt+offset(len).
    APPEND g_s_range TO g_t_range.
  ENDLOOP.

ENDFORM.                    " fill_range_read_cube

Regards,

Laurent

Former Member
0 Kudos

Hi Siemens,

Better prepare the ranges for that reference field. directly move the values of select-options to that ranges and pass that to subroutine.

Thanks,

Naresh.

0 Kudos

Better prepare the ranges for that reference field. directly move the values of select-options to that ranges and pass that to subroutine.

Really ? for any type of select-option ?

Any piece of code to suggest ?

Thks,

Laurent

Former Member
0 Kudos

Hi,

First, try to find a standard range type (table DD40L, enter Data Type in field RANGE_CTYP).

Use it in the FM interface.

The only way to pass a select-option is to use only table data, which it holds (move header line data to table, but usually it is not necessary ).

Example of usage:

Data element MATNR, standard range type RANGE_T_MATNR.

In the code:

CALL FUNCTION test

    EXPORTING it_matnr_range = so_matnr[].

Remember about characters: [] !

Regards,

Radek

Former Member
0 Kudos

Hi, there are many standard structures like RANGE_S_MATNR and so on,

and type of tables RANGE_T_MATNR

you can find it in se11

if you can not find appropriate - you can create in se11

with fieds

SIGN

OPTION

LOW

HIGH