‎2006 Jul 07 4:29 PM
Hi folks,
I would like to have 2 fields. Both are "F4 enabled" ( they are of type of key fields in one DBtable, and those DBtable fields have domains, which have value check with their table). And I want these 2 parameters to be connected - when I choose value in 1, value in the 2nd should be placed, and vice versa.
(What I miss is some event like on value-request...)
Thanks in advance,
Piotr
‎2006 Jul 07 4:31 PM
YOu have to use the function module dynp_values_update to have the second parameter field set.
This code has to be in at selection-screen on value request event.
Regards,
Ravi
‎2006 Jul 07 4:31 PM
Please see the example program below. This is how you can update the screen with the other fields.
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
‎2006 Jul 07 10:37 PM
I have tried the example. It works, but when I change the names of table and fields, there is no F4 action.
If the DBtable has to be "tuned", what should be set?
Thanks,
Piotr
‎2006 Jul 07 10:44 PM
‎2006 Jul 08 4:04 AM
Rich,
here goes your code with commented my lines:
*PARAMETERS: idzb TYPE z46_zestawy_skla-idz,
nazwab TYPE z46_zestawy_skla-nazwa.
PARAMETERS: idzb TYPE t001-bukrs,
nazwab TYPE t001-butxt.
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 idzb.
CALL FUNCTION 'F4IF_FIELD_VALUE_REQUEST'
EXPORTING
tabname = 'z46_zestawy_skla'
tabname = 't001'
fieldname = 'idz'
fieldname = 'bukrs'
dynpprog = sy-cprog
dynpnr = sy-dynnr
dynprofield = 'IDZB'
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 = 'IDZB'.
dynfields-fieldname = return-retfield.
dynfields-fieldvalue = return-fieldval.
APPEND dynfields.
Regards,
Piotr
‎2006 Jul 07 4:31 PM
You need to use the DYNP_VALUES_UPDATE function. Search the forum with the term DYNP_VALUES_UPDATE. There have been similar queries off late.
-Kiran
‎2006 Jul 07 4:35 PM
Hi,
Use,
AT SELECTION-SCREEN OUTPUT.
loop at screen.
if screen-name eq 'FIELD1'.
P_FIELD2 = 'VALUE_123'.
ELSEIF SCREEN-NAME EQ 'FIELD2'.
p_FIELD1 = 'VALUE_567'.
endif.
modify screen.
endloop.
Best regards,
Prashant
‎2006 Jul 07 4:40 PM
hi Plusa.
in the on value request event for the second parameter para2, you can place a check.
Suppose, first parameter para1 gets data from table t1 and based on this value paramter 2 should list should get data from table t2. so in the on value request of second parameter para2 write a select from table t2 with a where condition that states value selected in para1. And finally call the function module DYNP_VALUES_UPDATE. which will help you getting the new selection screen values.
Hope this example will help you in understand the concept.
Regards,
Richa
‎2006 Jul 07 4:43 PM
Hi,
Check the sample code..
REPORT ZTEST_F4HELP .
*---Report with selection screen and to display the list of
* possible entries for field 'B' as per the value in field 'A'.
parameters: p_vbeln type vbak-vbeln,
p_posnr type vbap-posnr.
at selection-screen on value-request for p_posnr.
data: begin of help_item occurs 0,
posnr type vbap-posnr,
matnr type vbap-matnr,
arktx type vbap-arktx,
end of help_item.
data: dynfields type table of dynpread with header line.
dynfields-fieldname = 'P_VBELN'.
append dynfields.
call function 'DYNP_VALUES_READ'
exporting
dyname = sy-cprog
dynumb = sy-dynnr
translate_to_upper = 'X'
tables
dynpfields = dynfields
exceptions
invalid_abapworkarea = 1
invalid_dynprofield = 2
invalid_dynproname = 3
invalid_dynpronummer = 4
invalid_request = 5
no_fielddescription = 6
invalid_parameter = 7
undefind_error = 8
double_conversion = 9
stepl_not_found = 10
others = 11.
read table dynfields with key fieldname = 'P_VBELN'.
p_vbeln = dynfields-fieldvalue.
call function 'CONVERSION_EXIT_ALPHA_INPUT'
exporting
input = p_vbeln
importing
output = p_vbeln.
select posnr matnr arktx into table help_item
from vbap
where vbeln = p_vbeln.
call function 'F4IF_INT_TABLE_VALUE_REQUEST'
exporting
retfield = 'POSNR'
dynprofield = 'P_POSNR'
dynpprog = sy-cprog
dynpnr = sy-dynnr
value_org = 'S'
tables
value_tab = help_item.Regards
vijay
‎2006 Jul 08 1:07 PM
Try this.
PARAMETERS: idzb TYPE z46_zestawy_skla-idz,
nazwab TYPE z46_zestawy_skla-nazwa.
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 idzb.
data: iz46_zestawy_skla type table of z46_zestawy_skla with header line.
clear iz46_zestawy_skla. refresh iz46_zestawy_skla.
select * into table iz46_zestawy_skla from z46_zestawy_skla.
sort iz46_zestawy_skla ascending
clear dynfields. refresh dynfields.
call function 'F4IF_FIELD_VALUE_REQUEST'
exporting
* tabname = 'Z46_ZESTAWY_SKLA'
* fieldname = 'IDZB'
dynpprog = sy-cprog
dynpnr = sy-dynnr
dynprofield = 'IDZ'
tables
return_tab = return
value_tab = iz46_zestawy_skla
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 = 'IDZB'.
* Add it back to the dynpro.
dynfields-fieldname = return-retfield.
dynfields-fieldvalue = return-fieldval.
append dynfields.
read table iz46_zestawy_skla with key idz = return-fieldval.
dynfields-fieldname = 'NASWAB'.
dynfields-fieldvalue = iz46_zestawy_skla-nazwa.
append dynfields.
* Update the dynpro values.
call function 'DYNP_VALUES_UPDATE'
exporting
dyname = sy-cprog
dynumb = sy-dynnr
tables
dynpfields = dynfields
exceptions
others = 8.
Regards,
Rich Heilman
‎2006 Aug 07 1:28 PM
Thank you for the answers; what I have wanted I did by a search help; sorry by vacation leave delay
Regards,
Piotr