07-31-2007 10:06 AM
Hi!
How can I fill a select-options dynamically out of an internal table.
The content of internal table have to be shown in the select-options
so that only these values can be choocen
regards
ilhan
07-31-2007 10:34 AM
Hi,
As you know every select option variable is a range table. If you want the select option to be filled in the initial screen itself use the INITIALIZATION event to append the select-options table as you populate a range table.
If you want the select option to be filled at the time of selection screen population use the at selection screen event.
Reward points if helpful.
- Irudayaraj Peter
07-31-2007 10:17 AM
07-31-2007 10:18 AM
hi can you give an example how do you mean that with for all entries
regards
ilhan
07-31-2007 10:20 AM
Hi,
for that u need to handle the code in AT SELECTION SCREEN event
and use the function module F4_INT_VALUE_REQUEST.
Regards,
Srinivas
07-31-2007 10:34 AM
Hi,
As you know every select option variable is a range table. If you want the select option to be filled in the initial screen itself use the INITIALIZATION event to append the select-options table as you populate a range table.
If you want the select option to be filled at the time of selection screen population use the at selection screen event.
Reward points if helpful.
- Irudayaraj Peter
07-31-2007 11:33 AM
try this it may help you
TABLES : MARA.
TYPE-POOLS : VRM.
DATA : BEGIN OF ITAB OCCURS 0,
MATNR LIKE MARA-MATNR,
END OF ITAB.
DATA : IPARAMVA TYPE VRM_VALUES,
WPARAMVA TYPE VRM_VALUE,
IPARAMID TYPE VRM_ID. .
PARAMETERS : P_MATNR LIKE MARA-MATNR AS LISTBOX VISIBLE LENGTH 20.
INITIALIZATION.
SELECT MATNR INTO TABLE ITAB FROM MARA UP TO 10 ROWS.
IPARAMID = 'P_MATNR'.
LOOP AT ITAB.
WPARAMVA-KEY = ITAB-MATNR.
WPARAMVA-TEXT = ITAB-MATNR.
APPEND WPARAMVA TO IPARAMVA.
ENDLOOP.
CALL FUNCTION 'VRM_SET_VALUES'
EXPORTING
ID = IPARAMID
VALUES = IPARAMVA
EXCEPTIONS
ID_ILLEGAL_NAME = 1
OTHERS = 2.
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
regards
shiba dutta
07-31-2007 11:39 AM
" Please see the below code is the best example of passing the table values
" as F4 help values in the selection screen through the even of the report .....
REPORT Ztest_HELP .
TABLES : MARA.
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
PARAMETERS : P_MATNR(10) TYPE C.
SELECTION-SCREEN END OF BLOCK B1.
DATA : BEGIN OF ITAB OCCURS 0,
MATNR TYPE MATNR,
END OF ITAB.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_MATNR.
SELECT MATNR
FROM MARA
INTO TABLE ITAB
UP TO 10 ROWS.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
RETFIELD = 'MATERIAL NUMBER'
DYNPPROG = SY-REPID
DYNPNR = SY-DYNNR
DYNPROFIELD = 'P_MATNR'
VALUE_ORG = 'S'
TABLES
VALUE_TAB = ITAB
EXCEPTIONS
PARAMETER_ERROR = 1
NO_VALUES_FOUND = 2
OTHERS = 3.
There are number of function modules that can be used for the purpose, but these
can fullfill the task easily or combination of them.
" DYNP_VALUE_READ
" F4IF_FIELD_VALUE_REQUEST
" F4IF_INT_TABLE_VALUE_REQUEST
" POPUP_WITH_TABLE_DISPLAY
" DYNP_VALUE_READ
' This function module is used to read values in the screen fields. Use of this
' FM causes forced transfer of data from screen fields to ABAP fields.
There are 3 exporting parameters
DYNAME = program name = SY-CPROG
DYNUMB = Screen number = SY-DYNNR
TRANSLATE_TO_UPPER = 'X'
and one importing TABLE parameter
DYNPFIELDS = Table of TYPE DYNPREAD
The DYNPFIELDS parameter is used to pass internal table of type DYNPREAD
to this FM and the values read from the screen will be stored in this table.This
table consists of two fields:
FIELDNAME : Used to pass the name of screen field for which the value is to
be read.
FIELDVALUE : Used to read the value of the field in the screen.
reward points if it is usefull ...
Girish
07-31-2007 1:20 PM
hi,
Data: data type c.
select-options: s_value for data.
<b>plz reward if useful</b>
Swati
07-31-2007 3:06 PM
If you want to use the values only to fetch data from the database then u can populate a range..
ranges: r_int for mara-matnr.
u can append material values from your internal table into range r_int & then use it in SELECT statement..
SELECT * FROM MARA
WHERE matnr IN r_int.
OR if the range is already there on selection screen as a select-option, populate as:
s_int-sign = 'I'
s_int-option = 'EQ'
s_int-low = inttab-matnr
append s_int.
Regards,
Cmehr
08-01-2007 12:33 AM
if you want to display as list box use
fm vrm_set_values or other wise just use below code in initialize event
with your values it will work
use it based on your requirement
initialize.
s_int-sign = 'I'
s_int-option = 'EQ'
s_int-low = '001'
append s_int.
s_int-sign = 'I'
s_int-option = 'EQ'
s_int-low = '002'
append s_int.