10-05-2007 2:32 PM
10-05-2007 2:34 PM
Hi
see this and do accordingly
See the following ex:
TYPES: BEGIN OF TY_MBLNR,
MBLNR LIKE MKPF-MBLNR,
END OF TY_MBLNR.
DATA: IT_MBLNR TYPE STANDARD TABLE OF TY_MBLNR WITH HEADER LINE.
data: it_ret like ddshretval occurs 0 with header line.
At selection-screen on value-request for s_mat-low.
Select MBLNR from mkpf into table it_mblnr.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
DDIC_STRUCTURE = ' '
RETFIELD = 'MBLNR'
PVALKEY = ' '
DYNPPROG = ' '
DYNPNR = ' '
DYNPROFIELD = ' '
STEPL = 0
WINDOW_TITLE =
VALUE = ' '
VALUE_ORG = 'S'
MULTIPLE_CHOICE = ' '
DISPLAY = ' '
CALLBACK_PROGRAM = ' '
CALLBACK_FORM = ' '
MARK_TAB =
IMPORTING
USER_RESET =
TABLES
VALUE_TAB = IT_MBLNR
FIELD_TAB =
RETURN_TAB = IT_RET
DYNPFLD_MAPPING =
EXCEPTIONS
PARAMETER_ERROR = 1
NO_VALUES_FOUND = 2
OTHERS = 3
.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
IF SY-SUBRC = 0.
read table it_ret index 1.
move it_ret-fieldval to S_mat-low.
ENDIF.
Go through the test program.
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.
If you want a List Box like thing do as below
Input : p_char = 'J'.
Press: enter
List Box of Month = January, June , July.
REPORT ZLIST_VALUES.
TYPE-POOLS vrm.
tables:
spfli.
parameters: p_char type c.
parameters:
p_month(12) as listbox visible length 20,
p_year as listbox visible length 20 .
DATA:
t_table TYPE STANDARD TABLE OF vrm_value,
t_table1 TYPE STANDARD TABLE OF vrm_value,
vrm_values1 LIKE LINE OF t_table.
DATA:
t_year TYPE STANDARD TABLE OF vrm_value.
data: w_year(4) type n value '2000'.
*****************
at selection-screen output.
vrm_values1-key = 'a'.
vrm_values1-text = 'January'.
APPEND vrm_values1 TO t_table.
vrm_values1-key = 'p'.
vrm_values1-text = 'February'.
APPEND vrm_values1 TO t_table.
vrm_values1-key = 'q'.
vrm_values1-text = 'March'.
APPEND vrm_values1 TO t_table.
vrm_values1-key = 'r'.
vrm_values1-text = 'April'.
APPEND vrm_values1 TO t_table.
vrm_values1-key = 's'.
vrm_values1-text = 'May'.
APPEND vrm_values1 TO t_table.
vrm_values1-key = 't'.
vrm_values1-text = 'June'.
APPEND vrm_values1 TO t_table.
vrm_values1-key = 'u'.
vrm_values1-text = 'July'.
APPEND vrm_values1 TO t_table.
vrm_values1-key = 'v'.
vrm_values1-text = 'August'.
APPEND vrm_values1 TO t_table.
vrm_values1-key = 'w'.
vrm_values1-text = 'September'.
APPEND vrm_values1 TO t_table.
vrm_values1-key = 'x'.
vrm_values1-text = 'October'.
APPEND vrm_values1 TO t_table.
vrm_values1-key = 'y'.
vrm_values1-text = 'November'.
APPEND vrm_values1 TO t_table.
vrm_values1-key = 'z'.
vrm_values1-text = 'December'.
APPEND vrm_values1 TO t_table.
t_table1[] = t_table.
delete t_table1 where text+0(1) <> p_char.
CALL FUNCTION 'VRM_SET_VALUES'
EXPORTING
id = 'p_month'
values = t_table1
EXCEPTIONS
ID_ILLEGAL_NAME = 1
OTHERS = 2.
do 10 times.
add 1 to w_year.
vrm_values1-key = sy-index.
vrm_values1-text = w_year.
APPEND vrm_values1 TO t_year.
enddo.
CALL FUNCTION 'VRM_SET_VALUES'
EXPORTING
id = 'p_year'
values = t_year
EXCEPTIONS
ID_ILLEGAL_NAME = 1
OTHERS = 2.
start-of-selection.
write: p_month.
Regards
Anji
Message was edited by:
Anji Reddy Vangala
10-05-2007 2:35 PM
Hi Avi,
Check this:
PARAMETERS p_carrid TYPE spfli-carrid
AS LISTBOX VISIBLE LENGTH 20
USER-COMMAND onli
DEFAULT 'LH'.
Vivek
10-05-2007 2:35 PM
Hi,
You can do that using the following option for parameters key word :
PARAMETERS ... AS LISTBOX VISIBLE LENGTH vlen [USER-COMMAND fcode]
Effect:
This addition generates a dropdown list box for an input field on the selection screen. If the parameter is created with a data type from the ABAP Dictionary, and the data type is linked to the input help in the Dictionary, the first column of the input help is displayed in the list box. Otherwise, a single-line list box is displayed containing the current value of the parameter.
The addition VISIBLE LENGTH must be used to specify the visible length of the input field. The explicit specification of the length is necessary as the length of the entries in the list box is usually different to the actual length of the parameter.
The addition USER-COMMAND can be used to assign a function code fcode to the dropdown list box. The function code fcode must be specified directly and can have a maximum length of 20 characters. To evaluate the function code, an interface work area of the structure SSCRFIELDS from the ABAP Dictionary must be declared using the statement TABLES. When the user selects a line of the list box on the selection screen, the runtime environment triggers the event AT SELECTION-SCREEN and transfers the function code fcode to the component ucomm of the interface work area sscrfields. If a function code used in the GUI status of the selection screen is specified for fcode, the selection screen processing is affected accordingly.
Note:
Without the addition USER-COMMAND, selecting a line in the dropdown list box does not lead to the event AT SELECTION-SCREEN.
Example:
The parameter p_carrid is displayed with length 20 and with the name "Lufthansa" already entered. The user can select a different airline carrier, in which case a three-character abbreviation is assigned to the parameter. When assigning the function code onli which is assigned to the function Execute in the GUI status of the default selection screen, the events AT SELECTION-SCREEN and START-OF-SELECTION are triggered.
PARAMETERS p_carrid TYPE spfli-carrid
AS LISTBOX VISIBLE LENGTH 20
USER-COMMAND onli
DEFAULT 'LH'.
AT SELECTION-SCREEN.
...
START-OF-SELECTION.
...
Please reward if this helps.
Regards,
NicolaS.
10-05-2007 2:38 PM
Go thro this code: Hope it helps u. Reward if useful
DATA:
gt_vrm_values type vrm_values,
gx_vrm_values like line of gt_vrm_values,
selection-screen begin of block _block02 with frame title text-b02.
parameter p_critem type t71adm09-citem as listbox
visible length 15 obligatory.
selection-screen end of block _block02.
select a~crevi
b~ltext
b~langu
from t71adm09 as a
join t71adm08t as b
on acrevi = bcrevi
into table gt_listbox
where cplan = 'BONR'."gc_1000.
if sy-subrc eq 0.
loop at gt_listbox into gx_listbox where langu = gc_E.
gx_vrm_values-key = gx_listbox-crevi.
gx_vrm_values-text = gx_listbox-ltext.
append gx_vrm_values to gt_vrm_values.
clear gx_vrm_values.
endloop.
call function 'VRM_SET_VALUES'
exporting
id = gv_vrmid
values = gt_vrm_values
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.
endif.