04-09-2008 12:55 PM
Hi experts,
i'd like to ask, what's the easiest way to exclude values from listbox, which is build on domain. Currently my listbox includes 2 values (from domain textes) and i would like to limit the list just to one.
Thank you.
Juzio
04-09-2008 1:02 PM
Juzio,
Domain values are stored in DD07T.
This is a routine I use repeatly to obtain them.
PERFORM get_dd07t_value USING 'ZLMFUCONTTYPE'
p_foltyp
p_text.
*&---------------------------------------------------------------------*
*& Form get_dd07t_value
*&---------------------------------------------------------------------*
* -->P_DOMNAME text
* -->P_KEY text
* -->P_RESULT text
*----------------------------------------------------------------------*
FORM get_dd07t_value USING p_domname
p_key
p_result.
CLEAR p_result.
SELECT SINGLE ddtext INTO p_result
FROM dd07t
WHERE domname = p_domname
AND ddlanguage = sy-langu
AND domvalue_l = p_key.
IF sy-subrc NE 0.
p_result = 'None'.
ENDIF.
ENDFORM. " get_dd07t_value
This could easily be modified to fill a table with just the ones you need. Then, in your dialog program:
In the _TOP ( or global area)
TYPE-POOLS vrm.
* These are examples that I used in my needs
DATA: ltype_field TYPE vrm_id,
ltype_result TYPE STANDARD TABLE OF vrm_value,
ltype_val LIKE LINE OF ltype_result.
DATA: atype_field TYPE vrm_id,
atype_result TYPE STANDARD TABLE OF vrm_value,
atype_val LIKE LINE OF ltype_result.
DATA: lstat_field TYPE vrm_id,
lstat_result TYPE STANDARD TABLE OF vrm_value,
lstat_val LIKE LINE OF lstat_result.
DATA: wk_ltype LIKE zlmlead-ltype,
prev_ltype LIKE zlmlead-ltype,
wk_status LIKE zlmlead-status.
From the PBO logic MODULE to here
*&---------------------------------------------------------------------*
*& Module init_0110 OUTPUT
*&---------------------------------------------------------------------*
MODULE init_0110 OUTPUT.
REFRESH ltype_result. CLEAR ltype_result.
* Drop down values
SELECT ltype ltypex
INTO TABLE ltype_result
FROM zlmltyp
WHERE auth NE '9'. "System Only
* Field name to assign drop down values
ltype_field = 'WK_LTYPE'.
CALL FUNCTION 'VRM_SET_VALUES'
EXPORTING
id = ltype_field
values = ltype_result
EXCEPTIONS
id_illegal_name = 1
OTHERS = 2.
IF sy-subrc <> 0.
ENDIF.
IF prev_ltype NE wk_ltype.
CLEAR: wk_status.
ENDIF.
REFRESH lstat_result. CLEAR lstat_result.
* Drop down values
SELECT status statx
INTO TABLE lstat_result
FROM zlmstyp
WHERE ltype = wk_ltype
AND auth NE '9'. "System Only
* OR status = zlmlead-status ).
SORT lstat_result.
* Field name to assign drop down values
lstat_field = 'WK_STATUS'.
CALL FUNCTION 'VRM_SET_VALUES'
EXPORTING
id = lstat_field
values = lstat_result
EXCEPTIONS
id_illegal_name = 1
OTHERS = 2.
IF sy-subrc <> 0.
ENDIF.
prev_ltype = wk_ltype.
ENDMODULE. " init_0110 OUTPUT
Lastly, on the field attributes in Screen Painter, set the Search help to "A" (From Program)
My example above restricts values of the second listbox based on values in the First one. The first one has a FCode on it so that the 2nd is changed each time the 1st changes.
Hope this helps