Hi kabil,
Like standard Program you can create two inputs
eg: first field matnr1,
Second field matnr2.
Add the Search help for both inputs in Module pool.
use CHAIN Statement.
Abap Editor.
if matnr2 is not initial.
get the related values for that material pass the values to the corresponding screen values
then call the another screen.
else.
call the another screen.
endif.
Regards,
Venkat.