01-09-2015 3:03 PM
Hi All,
I got a requirement like,
input screen:
Material number : [ ]
plant : [ ]
material type : [ ].
Ya, Here I am giving material number and material type, then I will get plant details as F4 help if I use F4IF_INT_VALUE_REQUEST function module. here my requirement is, i wont press F4 button but i need show possible of values when I entered material number and material type.
Note: but I knew without user action on F4 button we cant see those possible set of value. I intimated to my client but he is not accepting my call.
01-09-2015 4:04 PM
Hi Vijay,
There is one more option available instead of using F4 help. Use Auto-complete option, please find the following note.
1861491 - Proposal search for input fields - additional information
Regards
Rajkumar Narasimman
01-09-2015 4:41 PM
Regards,
Philip.
01-10-2015 2:59 PM
hi vijaykumar,
based on your requirement I have tried to fulfill your requirement.
user will select material number by pressing F4
user will select material type by pressing F4 and once selects material type he will get a list of plants automatically without pressing F4.
Can you have a look at this code.May be it will help you.
---------------------------------------------------------------------
REPORT ZR_F4_HELP2.
PARAMETERS: P_MATNR TYPE MARA-MATNR,
P_MTART TYPE C LENGTH 20, "MARA-MTART,
P_WERKS TYPE T001W-WERKS.
TYPES : begin of ty ,
mtart type t134-mtart,
mtbez type t134t-mtbez,
werks type T001W-werks,
name1 type T001W-name1,
end of ty.
TYPES : begin of ty1 ,
werks type T001W-werks,
name1 type T001W-name1,
mtart type t134-mtart,
mtbez type t134t-mtbez,
end of ty1.
data: itab TYPE STANDARD TABLE OF ty,
itab1 TYPE STANDARD TABLE OF ty1,
dynfields type table of dynpread with header line,
lt_fields TYPE STANDARD TABLE OF dfies ,
lt_mapping TYPE STANDARD TABLE OF dselc.
DATA: itab_return TYPE TABLE OF ddshretval,
wa_return TYPE ddshretval.
at selection-screen on value-request for p_mtart.
REFRESH dynfields.
dynfields-fieldname = 'P_MATNR'.
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_MATNR'.
p_matnr = dynfields-fieldvalue.
call function 'CONVERSION_EXIT_ALPHA_INPUT'
exporting
input = p_matnr
importing
output = p_matnr.
select mara~mtart mtbez into CORRESPONDING FIELDS OF TABLE itab
from MARA
INNER JOIN T134T ON mara~mtart = t134t~mtart
where matnr = p_matnr and
t134t~spras = 'EN'.
call function 'F4IF_INT_TABLE_VALUE_REQUEST'
exporting
retfield = 'MTART'
dynprofield = 'P_MTART'
dynpprog = sy-repid
dynpnr = sy-dynnr
value_org = 'S'
tables
value_tab = itab
return_tab = itab_return.
READ TABLE ITAB_RETURN INTO WA_RETURN index 1.
IF sy-subrc = 0.
P_MTART = WA_RETURN-fieldval.
* P_WERKS = WA_RETURN-fieldval.
ENDIF.
select t001w~werks name1 mara~mtart mtbez into CORRESPONDING FIELDS OF TABLE itab1
from MARA
INNER JOIN T134T ON mara~mtart = t134t~mtart
INNER JOIN T134M ON mara~mtart = t134m~mtart
INNER JOIN T001w ON t134m~bwkey = t001w~bwkey
where matnr = p_matnr and
t134t~spras = 'EN'.
call function 'F4IF_INT_TABLE_VALUE_REQUEST'
exporting
retfield = 'WERKS'
dynprofield = 'P_WERKS'
dynpprog = sy-repid
dynpnr = sy-dynnr
value_org = 'S'
tables
value_tab = itab1
return_tab = itab_return.
READ TABLE ITAB_RETURN INTO WA_RETURN index 1.
IF sy-subrc = 0.
P_WERKS = WA_RETURN-fieldval.
ENDIF.
DATA: l_i_dynpfields TYPE STANDARD TABLE OF dynpread INITIAL SIZE 0,
l_wa_dynpfields TYPE dynpread.
l_wa_dynpfields-fieldname = 'P_WERKS'.
l_wa_dynpfields-fieldvalue = P_WERKS.
APPEND l_wa_dynpfields TO l_i_dynpfields.
CALL FUNCTION 'DYNP_VALUES_UPDATE'
EXPORTING
dyname = sy-repid
dynumb = sy-dynnr
TABLES
dynpfields = l_i_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.