‎2006 Oct 04 3:12 PM
Hi,
I am working in SRM4.0
We have created 3 new fields on a standard screen, by appending these fields to structures as per SAP Notes 458591 and 672960 (Thats the way to add "Z" fields to std screen in SRM).
Now the requirement is when the user clicks on F4 help on one of the fields, the data is fetched from R/3 and displayed. For this we have created a search help and assigned it to a data element of the "Z" field and the values are being retrieved from R/3 with a function module that we have included in the search help. This much is working fine.
Now the problem is that when we click on F4 help of any one field and select the value, the corressponding values should get populated in the other 2 fields. How do we achieve this?
Thanks and Regards,
Jayesh
‎2006 Oct 04 3:22 PM
HI,
check this code..
hope it helps...
tables: mara, makt.
data: begin of itab occurs 0,
matnr like mara-matnr,
end of itab.
data : begin of btab occurs 0,
maktx like makt-maktx,
end of btab.
data mak like makt-maktx.
DATA : return like ddshretval occurs 0 with header line.
data: begin of dynpfields occurs 3.
include structure dynpread.
data: end of dynpfields.
parameters: p_matnr like mara-matnr,
p_maktx like makt-maktx.
Initialization.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_matnr.
REFRESH ITAB.
SELECT matnr FROM mara INTO TABLE ITAB.
call function 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
retfield = 'MATNR '
dynprofield = 'P_MATNR '
dynpprog = sy-REPID
dynpnr = sy-dynnr
value_org = 'S'
TABLES
value_tab = ITAB
return_tab = return.
select single maktx from makt into mak where matnr = return-fieldval.
p_matnr = return-fieldval.
refresh return.
clear return.
move 'P_MAKTX' to dynpfields-fieldname.
move mak to dynpfields-fieldvalue.
append dynpfields.
CALL FUNCTION 'DYNP_VALUES_UPDATE'
EXPORTING
dyname = 'SY-REPID'
dynumb = '1000'
tables
dynpfields = dynpfields
EXCEPTIONS
INVALID_ABAPWORKAREA = 1
INVALID_DYNPROFIELD = 2
INVALID_DYNPRONAME = 3
INVALID_DYNPRONUMMER = 4
INVALID_REQUEST = 5
NO_FIELDDESCRIPTION = 6
UNDEFIND_ERROR = 7
OTHERS = 8
.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
refresh return.
clear return.
‎2006 Oct 04 3:22 PM
HI,
check this code..
hope it helps...
tables: mara, makt.
data: begin of itab occurs 0,
matnr like mara-matnr,
end of itab.
data : begin of btab occurs 0,
maktx like makt-maktx,
end of btab.
data mak like makt-maktx.
DATA : return like ddshretval occurs 0 with header line.
data: begin of dynpfields occurs 3.
include structure dynpread.
data: end of dynpfields.
parameters: p_matnr like mara-matnr,
p_maktx like makt-maktx.
Initialization.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_matnr.
REFRESH ITAB.
SELECT matnr FROM mara INTO TABLE ITAB.
call function 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
retfield = 'MATNR '
dynprofield = 'P_MATNR '
dynpprog = sy-REPID
dynpnr = sy-dynnr
value_org = 'S'
TABLES
value_tab = ITAB
return_tab = return.
select single maktx from makt into mak where matnr = return-fieldval.
p_matnr = return-fieldval.
refresh return.
clear return.
move 'P_MAKTX' to dynpfields-fieldname.
move mak to dynpfields-fieldvalue.
append dynpfields.
CALL FUNCTION 'DYNP_VALUES_UPDATE'
EXPORTING
dyname = 'SY-REPID'
dynumb = '1000'
tables
dynpfields = dynpfields
EXCEPTIONS
INVALID_ABAPWORKAREA = 1
INVALID_DYNPROFIELD = 2
INVALID_DYNPRONAME = 3
INVALID_DYNPRONUMMER = 4
INVALID_REQUEST = 5
NO_FIELDDESCRIPTION = 6
UNDEFIND_ERROR = 7
OTHERS = 8
.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
refresh return.
clear return.
‎2006 Oct 04 3:32 PM
hi,
u can use FM => 'DYNP_VALUES_UPDATE'
DATA: BEGIN OF dynprofelder OCCURS 0.
INCLUDE STRUCTURE dynpread.
DATA: END OF dynprofelder.
REFRESH dynprofelder.
dynprofelder-fieldname = 'SCREEN_FIELD_NAME'.
dynprofelder-fieldvalue = screen_fld_value.
APPEND dynprofelder.
CALL FUNCTION 'DYNP_VALUES_UPDATE'
EXPORTING
dyname = sy-cprog
dynumb = sy-dynnr
TABLES
dynpfields = dynprofelder
EXCEPTIONS
invalid_abapworkarea = 1
invalid_dynprofield = 2
invalid_dynproname = 3
invalid_dynpronummer = 4
invalid_request = 5
no_fielddescription = 6
undefind_error = 7
OTHERS = 8.
rgds
anver
pls mark all hlpful answers
‎2006 Oct 04 3:35 PM
Hi jayesh,
1. Simple
2. While defining the search help
3. Make those extra fields as EXPORT
(hence, their value will AUTOMATICALLY GET
exported on the screen,
to the fields with the same name)
regards,
amit m.