08-28-2007 7:52 PM
Hi,
There is one field called company code. for this field if the user select the value from drop down box(F4 help), then it should display the corresponding text. the thing is, the values are getting from fixed value which is defined in domain, and it is not in value table or text table. so how i can get this correponding text value for the selected value? Is there any options?
Please help me it urgent...
Regards,
Amal
08-28-2007 7:54 PM
Use this function module to retrieve the values.
data: idd07v type table of dd07v with header line.
call function 'DD_DOMVALUES_GET'
exporting
domname = 'RFBSK' "<-- Your Domain Here
text = 'X'
langu = sy-langu
tables
dd07v_tab = idd07v
exceptions
wrong_textflag = 1
others = 2.
loop at idd07v.
write:/ idd07v-domvalue_l, idd07v-ddtext.
endloop.
Regards,
RIch Heilman
Message was edited by:
Rich Heilman
08-28-2007 7:54 PM
Use this function module to retrieve the values.
data: idd07v type table of dd07v with header line.
call function 'DD_DOMVALUES_GET'
exporting
domname = 'RFBSK' "<-- Your Domain Here
text = 'X'
langu = sy-langu
tables
dd07v_tab = idd07v
exceptions
wrong_textflag = 1
others = 2.
loop at idd07v.
write:/ idd07v-domvalue_l, idd07v-ddtext.
endloop.
Regards,
RIch Heilman
Message was edited by:
Rich Heilman
08-28-2007 8:16 PM
Thanks heilmen.
I got idea.
Im working with module pool. so the field company code is displayed in screen and next to it text field where the corresponding text value should be displayed.
can i use <b>(FIELD field name MODULE module name ON REQUEST)</b> to do this? will it displayt the text as soon as the value is selected from F4 value?
Regards,
Amal
08-28-2007 8:25 PM
I'm actually a little confused now, company code text is not stored at domain level, it is stored in the BUTXT field of table T001. Am I missing something. Anyway once you get the text, you will need to use the function module 'DYNP_VALUES_UPDATE'
This example, is implemented using a selection-screen, but the coding is similar to implement in a dynpro.
report zrich_0002 .
parameters: p_bukrs type t001-bukrs,
p_butxt type t001-butxt,
p_ort01 type t001-ort01,
p_land1 type t001-land1.
data: dynfields type table of dynpread with header line.
data: return type table of ddshretval with header line.
at selection-screen on value-request for p_bukrs.
call function 'F4IF_FIELD_VALUE_REQUEST'
exporting
tabname = 'T001'
fieldname = 'BUKRS'
dynpprog = sy-cprog
dynpnr = sy-dynnr
dynprofield = 'P_BUKRS'
tables
return_tab = return
exceptions
field_not_found = 1
no_help_for_field = 2
inconsistent_help = 3
no_values_found = 4
others = 5.
read table return with key fieldname = 'P_BUKRS'.
* Add it back to the dynpro.
dynfields-fieldname = return-retfield.
dynfields-fieldvalue = return-fieldval.
append dynfields.
* Get the company code from db and add to dynpro
data: xt001 type t001.
clear xt001.
select single * into xt001
from t001
where bukrs = return-fieldval.
dynfields-fieldname = 'P_BUTXT'.
dynfields-fieldvalue = xt001-butxt.
append dynfields.
dynfields-fieldname = 'P_ORT01'.
dynfields-fieldvalue = xt001-ort01.
append dynfields.
dynfields-fieldname = 'P_LAND1'.
dynfields-fieldvalue = xt001-land1.
append dynfields.
* Update the dynpro values.
call function 'DYNP_VALUES_UPDATE'
exporting
dyname = sy-cprog
dynumb = sy-dynnr
tables
dynpfields = dynfields
exceptions
others = 8.
start-of-selection.
Regards
Rich Heilman
08-28-2007 9:23 PM
08-28-2007 7:57 PM
Here's some code to start you off:
r_bstat-sign = 'I'.
select domvalue_l domvalue_h
from dd07l
into (d1, d2)
where domname = 'BSTAT'
and as4local = 'A'.
if d2 is initial.
r_bstat-option = 'EQ'.
r_bstat-low = d1.
clear r_bstat-high.
else.
r_bstat-option = 'BT'.
r_bstat-low = d1.
r_bstat-high = d2.
endif.
append r_bstat.
endselect.
Rob
08-28-2007 8:04 PM
USe FM DDUT_DOMVALUES_GET Pass Domain name and you will get the list of values...