Hi Anitha,
SO_MAT is an internal with header line so instead of using read table S_MAT, use matnr in S_MAT in select statement where condition. and no need to write the select statement inside the loop.
write the statement like below.
SELECT MBLNR MJAHR ZEILE BWART MATNR WERKS MENGE FROM MSEG INTO CORRESPONDING FIELDS OF TABLE IT_MSQTY
WHERE MATNR inSO_MAT AND
WERKS in so_plant AND
BWART IN (551,552,521,553,522).
Thanks,
Sree