07-03-2007 4:27 PM
Hi,
By default when we use a data dictionary element for dropdown list, all the possible values are listed in the dropdown. However when no data dictionary element is used for the dropdown list, it behaves like a parameter with a single line.
I would like to know if it is possible to not use the data dictionary element and still have multiple lines in the dropdown.
Thanks in advance.
Shamia
07-03-2007 4:30 PM
Hi
See the sample code to get the drop down list for a field
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.
Reward points for useful Answers
Regards
Anji
07-03-2007 4:39 PM
Check the below program :
*report zxyz.
report zxyz.
Table diclaration
tables: tvdir.
Selection screento table View
selection-screen skip 2.
parameter p_tabnm(30) as listbox visible length 30 obligatory.
selection-screen skip 1.
selection-screen begin of block s1 with frame title text-001.
parameter: p_radio1 radiobutton group g1,
p_radio radiobutton group g1.
selection-screen end of block s1.
Add values to list box
at selection-screen output.
type-pools: vrm.
data: name type vrm_id,
list type vrm_values,
value like line of list.
name = 'P_TABNM'.
refresh list.
value-key = 'V_024'.
value-text = text-002. "'V_024-Purchasing Groups'.
append value to list.
value-key = 'V_T024D'.
value-text = text-003. "'V_T024D-MRP Controllers'.
append value to list.
value-key = 'ZT604'.
value-text = text-004. "'T604-Commodity Codes'.
append value to list.
value-key = 'T179'.
value-text = text-005. "'T179-Product Hierarchies'.
append value to list.
value-key = 'TVM1T'.
value-text = text-006. "'TVM1T-Business Manager'.
append value to list.
value-key = 'TVM2T'.
value-text = text-007. "'TVM2T-Division manager'.
append value to list.
value-key = 'TVM3T'.
value-text = text-008. "'TVM3T-Director'.
append value to list.
value-key = 'V_TVV2'.
value-text = text-009. "'V_TVV2-Customer Group 2'.
append value to list.
call function 'VRM_SET_VALUES'
exporting
id = name
values = list.
start-of-selection.
Get flag of corresponding table view
select single tabname flag from tvdir into tvdir
where tabname = p_tabnm.
Set flag of corresponding table view
if p_radio1 eq 'X'.
if tvdir-flag ne 'X'.
update tvdir set: flag = 'X'
where tabname = p_tabnm.
endif.
endif.
if p_radio eq 'X'.
if tvdir-flag eq 'X'.
update tvdir set: flag = ''
where tabname = p_tabnm.
endif.
endif.
Execute View/Table
call function 'VIEW_MAINTENANCE_CALL'
exporting
action = 'U'
view_name = p_tabnm
exceptions
client_reference = 1
foreign_lock = 2
invalid_action = 3
no_clientindependent_auth = 4
no_database_function = 5
no_editor_function = 6
no_show_auth = 7
no_tvdir_entry = 8
no_upd_auth = 9
only_show_allowed = 10
system_failure = 11
unknown_field_in_dba_sellist = 12
view_not_found = 13
others = 14.
if sy-subrc <> 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.
Reset flag of corresponding table view
update tvdir set: flag = tvdir-flag
where tabname = p_tabnm.
Thanks
Seshu