‎2007 Jan 04 6:07 AM
Dear All,
I have three text fields in one of my screens.
1. Transporter
2. TruckType and
3. Destination
I have provided search help for Transporter field and I display all the above three fields in the search help LOV.
My requirement is that on selection of any entry from the search help, the other two fields on the screen i.e. Truck Type & Destination should also get populated from the relative fields of the selected entry.
Regards,
Alok.
‎2007 Jan 04 6:40 AM
Hi Alok,
Do like this..
Create a PERFORM ,
PROCESS ON VALUE-REQUEST.
FIELD P9003-TRANS MODULE TRANS_F4_REQUEST.
SELECT the data from Main table for Transporter.
After Use this Function Module like this..
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
DDIC_STRUCTURE = ' '
RETFIELD = 'TPROG'
PVALKEY = ' '
DYNPPROG = 'MP900300'
DYNPNR = '2000'
DYNPROFIELD = 'P9003-SHIFT'
DYNPROFIELD = 'TPROG'
STEPL = 0
WINDOW_TITLE =
VALUE = ' '
VALUE_ORG = 'S'
MULTIPLE_CHOICE = ' '
DISPLAY = ' '
CALLBACK_PROGRAM = ' '
CALLBACK_FORM = ' '
TABLES
VALUE_TAB = T_T550A
FIELD_TAB =
RETURN_TAB = T_RETURN
DYNPFLD_MAPPING =
EXCEPTIONS
PARAMETER_ERROR = 1
NO_VALUES_FOUND = 2
OTHERS = 3
.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
IF SY-SUBRC = 0.
P9003-TRANS = T_RETURN-FIELDVAL.
T_T550A-TPROG = P9003-SHIFT.
SELECT the data based on Transporter main table.
IF SY-SUBRC = 0.
READ TABLE T_MAINTAB INDEX 1.
POPULATE U R FIELDS here.
ENDIF.
ENDIF.
Reward me points if it helpful.
Thanks,
N.L.Narayana
‎2007 Jan 16 8:48 AM
Hi, pls try something like this. I think you can copy the code to check in your system. In this example you pull search help for field DISPO and after you choose the row in the popup both fields in the selection screen are updated.
Rgds
REPORT yjptest .
TABLES: marc.
DATA:
x_matnr LIKE marc-matnr,
x_dispo LIKE marc-dispo.
PARAMETERS: p_matnr LIKE x_matnr.
PARAMETERS: p_dispo LIKE x_dispo.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_dispo.
PERFORM f4_for_dispo CHANGING p_dispo.
START-OF-SELECTION.
&----
*& Form F4_FOR_DISPO
&----
text
----
<--P_S_DISPO_LOW text
----
FORM f4_for_dispo CHANGING p_dispo.
DATA: BEGIN OF it_dispo OCCURS 0,
matnr LIKE marc-matnr,
dispo LIKE marc-dispo,
END OF it_dispo.
DATA: v_progname LIKE sy-repid.
DATA: it_ret LIKE ddshretval OCCURS 0 WITH HEADER LINE,
it_field LIKE dfies OCCURS 0 WITH HEADER LINE,
it_dyn LIKE dselc OCCURS 0 WITH HEADER LINE.
DATA: ltab_fields LIKE dynpread OCCURS 0 WITH HEADER LINE.
DATA: lc_dyname LIKE sy-repid.
DATA: lc_dynumb LIKE sy-dynnr.
DATA: l_dispo LIKE marc-dispo.
SELECT matnr dispo FROM marc INTO TABLE it_dispo
WHERE dispo <> ''.
REFRESH it_dyn.
it_dyn-fldname = 'F0001'.
it_dyn-fldinh = ''. "don't use!
it_dyn-dyfldname = 'P_MATNR'.
APPEND it_dyn.
it_dyn-fldname = 'F0002'.
it_dyn-fldinh = ''. "don't use!
it_dyn-dyfldname = 'P_DISPO'.
APPEND it_dyn.
v_progname = sy-repid.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
retfield = 'DISPO'
dynpprog = v_progname
dynpnr = '1000'
dynprofield = 'S_DISPO-LOW'
value_org = 'S'
TABLES
value_tab = it_dispo
return_tab = it_ret
dynpfld_mapping = it_dyn
EXCEPTIONS
OTHERS = 0.
break petejede.
IF sy-subrc = 0.
ENDIF.
ENDFORM. " F4_FOR_DISPO
‎2007 Jan 16 8:55 AM
Hi ALok,
check this code and modify according to u r requirement in dialog program
report zabc.
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.
break-point.
refresh dynfields.
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.