Hi Ronaldo,
Though system does not throw any errors if we write select queries in WD component controller/view controller but we should never write a DB queries like select, insert, update, etc because it has an impact on performance of web dynpro application.
Web dynpro applications are heavy and it runs in front end and hence only the ui logic to be placed in WD components and the business logic/db queries to be placed in a model viz, class / function module, etc.Hence WD implementation should strictly follow the MVC architecture
For more details on MVC in WDA, please refer the below links
Web Dynpro Architecture (SAP Library - Web Dynpro for ABAP)
Architecture of Webdynpro for ABAP - Web Dynpro ABAP - SCN Wiki
Hence, you should use either a class / function module to place your business logic and call the methods/ function modules inside the WD component.
In general, for every WD component, a assistance class will be attached and it assists the component with business logic. So, we can call the method of an assistance class in WD component.
Hope this helps you.
Regards,
Rama