Final answer:
Transaction code MB51 is used in SAP to view stock information by material number, which is crucial for inventory management.
Step-by-step explanation:
The transaction code that allows a user to view stock by material number in SAP is B) MB51. This transaction code is used to generate reports for material documents which include information about stock transactions and movements. Codes such as MM01 are used for creating materials, VA01 is for creating sales orders, and PP03 is related to human resources planning in SAP. Therefore, the correct choice for viewing stock by material number is MB51, which is essential for tasks such as inventory management and auditing.