Check this sample.
report zrich_0002 . parameters: p_bukrs(4) type c, p_butxt(50) type c. 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 dynfields-fieldname = 'P_BUTXT'. select single butxt into dynfields-fieldvalue from t001 where bukrs = return-fieldval. 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
Hello Tom,
I do not quite get why you want to refresh the screen after F4. When you hit the F4 button the event AT SELECTION-SCREEN on VALUE REQUEST will get triggerred. And inside that event you can write the code necessary to fetch the appropriate value for the screen field.
Are you already doing this ? If yes, is there something that's going wrong ?
Regards,
Anand Mandalika.
Add comment