Hi Debdutta,
Please remove the obligatory for Material Group, in the above code, values are filling in Matnr, but we have to specify the fetch and assign the values to MATKL. Please find the below code.
DATA: l_matkl TYPE matkl.
PARAMETERS: s_matnr TYPE matnr OBLIGATORY, " Material Number
s_matkl TYPE matkl. " Material Group
AT SELECTION-SCREEN.
IF s_matnr is NOT INITIAL.
SELECT SINGLE matkl
FROM mara
into l_matkl
WHERE matnr = s_matnr.
IF sy-subrc = 0.
s_matkl = l_matkl.
ENDIF.
ENDIF.
IF s_matkl is INITIAL.
Message 'Material Group is Mandatory' TYPE 'E'.
ENDIF.
Regards
Rajkumar Narasimman