Hi,
Use the Function modules mentioned above( there are many other ways to get the domain values)
sample code:
data: lt_dom_values type standard table of dd07v,
ls_dom_values type dd07v,
lt_valueset type table of wdr_context_attr_value,
ls_valueset type wdr_context_attr_value.
CALL FUNCTION 'GET_DOMAIN_VALUES'
EXPORTING
DOMNAME = 'DOMN' " Your domain name
TEXT = 'X'
TABLES
VALUES_TAB = lt_dom_values.
IF SY-SUBRC <> 0.
* Implement suitable error handling here
ENDIF.
loop at lt_dom_values into ls_dom_values.
*here you can write the condition and donot append the second record.
ls_valueset-value = ls_dom_values-domvalue_l.
ls_valueset-text = ls_dom_values-ddtext.
append ls_valueset to lt_valueset.
clear ls_valueset.
endloop.
Now you can bind the value set.
Hope this helps u,
Regards,
Kiran