‎2008 Dec 05 3:35 PM
Hello,
I need to use a select options in a Function module and then i have to send the values to a Report program.
How can I do it?
Thanks.
‎2008 Dec 05 3:51 PM
This is how I have done in past...
In a type-group define types like this
TYPES : zmb52_tr_matnr TYPE RANGE OF mara-matnr ,
zmb52_tr_werks TYPE RANGE OF marc-werks ,
zmb52_tr_lgort TYPE RANGE OF mard-lgort ,
zmb52_tr_charg TYPE RANGE OF mchb-charg ,
zmb52_tr_mtart TYPE RANGE OF mara-mtart ,
zmb52_tr_matkl TYPE RANGE OF mara-matkl ,
zmb52_tr_ekgrp TYPE RANGE OF marc-ekgrp ,
zmb52_tr_sobkz TYPE RANGE OF mkol-sobkz ,and use it in FM like this
FUNCTION zgetstock.
*"----------------------------------------------------------------------
*"*"Local Interface:
*" IMPORTING
*" REFERENCE(I_SPMON) TYPE SPMON
*" VALUE(I_MATNR) TYPE ZMB52_TR_MATNR OPTIONAL
*" VALUE(I_WERKS) TYPE ZMB52_TR_WERKS OPTIONAL
*" VALUE(I_LGORT) TYPE ZMB52_TR_LGORT OPTIONAL
*" VALUE(I_CHARG) TYPE ZMB52_TR_CHARG OPTIONAL
*" VALUE(I_MTART) TYPE ZMB52_TR_MTART OPTIONAL
*" VALUE(I_MATKL) TYPE ZMB52_TR_MATKL OPTIONAL
*" VALUE(I_EKGRP) TYPE ZMB52_TR_CHARG OPTIONAL
‎2008 Dec 05 3:38 PM
‎2008 Dec 05 3:40 PM
Hello,
But, I need to use the select options as import parameter in the function module.
Thanks
‎2008 Dec 05 3:44 PM
Hi,
Refer to this function :
RS_REFRESH_FROM_SELECTOPTIONS , the tables parameter SELECTION_TABLE refers to structure RSPARAMS, you can define it in the same way.
Later you can fill the ranges in your program from this table.
Hope this helps.
regards,
Advait
‎2008 Dec 05 3:45 PM
Ok, so then you need to use a table type. What is the actual field type that you want to pass as a range, is it a date? If not, is is a character field? what is the length? You may be able to use an existing table table. Otherwise, you will need to create your own "Z" table type, which will use a custom structure as well. The structure should include the four fields.
SIGN
OPTION
LOW
HIGH
SIGN should be a char 1 field, and the OPTION field should be character 2, the LOW and HIGH fields depends on what you are trying to pass. Create this "Z" structure, then create the table type using this "Z" structure. Then use this table type as an IMPORTING parameter of your function module(you could also use the TABLES parameter, and simply use the structure instead, but it is better to use a table type and the IMPORTING parameter).
Regards,
Rich Heilman
‎2008 Dec 05 3:40 PM
So for example, here you fill the range, just like it would be for a select-option, and then you may pass this range to the select-option of the submited program, here S_DATUM is a select-option in the ZREPORT report program.
ranges: r_datum for sy-datum.
r_datum-sign = 'I'.
r_datum-option = 'EQ'.
r_datum-low = sy-datum.
r_datum-high = sy-datum + 7.
append r_datum.
submit zreport
with s_datum in r_datum
and return.Regards,
Rich Heilman
‎2008 Dec 05 3:51 PM
This is how I have done in past...
In a type-group define types like this
TYPES : zmb52_tr_matnr TYPE RANGE OF mara-matnr ,
zmb52_tr_werks TYPE RANGE OF marc-werks ,
zmb52_tr_lgort TYPE RANGE OF mard-lgort ,
zmb52_tr_charg TYPE RANGE OF mchb-charg ,
zmb52_tr_mtart TYPE RANGE OF mara-mtart ,
zmb52_tr_matkl TYPE RANGE OF mara-matkl ,
zmb52_tr_ekgrp TYPE RANGE OF marc-ekgrp ,
zmb52_tr_sobkz TYPE RANGE OF mkol-sobkz ,and use it in FM like this
FUNCTION zgetstock.
*"----------------------------------------------------------------------
*"*"Local Interface:
*" IMPORTING
*" REFERENCE(I_SPMON) TYPE SPMON
*" VALUE(I_MATNR) TYPE ZMB52_TR_MATNR OPTIONAL
*" VALUE(I_WERKS) TYPE ZMB52_TR_WERKS OPTIONAL
*" VALUE(I_LGORT) TYPE ZMB52_TR_LGORT OPTIONAL
*" VALUE(I_CHARG) TYPE ZMB52_TR_CHARG OPTIONAL
*" VALUE(I_MTART) TYPE ZMB52_TR_MTART OPTIONAL
*" VALUE(I_MATKL) TYPE ZMB52_TR_MATKL OPTIONAL
*" VALUE(I_EKGRP) TYPE ZMB52_TR_CHARG OPTIONAL