Hi Jacob,
Try the following code block for your requirement.
Just copy+paste and execute.
(I hope materials with material type FERT and RAW exist in your MARA table, If not then change the MTART value in following SELECT query according to your convinience.)
************************************************************************************************
report z_test_sss_f4.
tables mara.
data :begin of gt_matnr occurs 0,
matnr like mara-matnr,
end of gt_matnr.
parameters : p_matnr type mara-matnr,
p_rad1 radiobutton group g1 default 'X' user-command flag,
p_rad2 radiobutton group g1 .
at selection-screen output.
if p_rad1 = 'X'.
select matnr
from mara
into table gt_matnr
where mtart = 'FERT'.
else.
select matnr
from mara
into table gt_matnr
where mtart = 'RAW'.
endif.
at selection-screen on value-request for p_matnr.
call function 'F4IF_INT_TABLE_VALUE_REQUEST'
exporting
retfield = 'MATNR'
dynpprog = sy-cprog
dynpnr = sy-dynnr
dynprofield = 'P_MATNR'
value_org = 'S'
tables
value_tab = gt_matnr[]
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.
************************************************************************************************
Hope this helps.
Regards,
Siddhesh Satghare.
Message was edited by: Siddhesh Satghare
Message was edited by: Siddhesh Satghare