How can I hide acumatica Bills of material and Production Orders all screens using code. While publish my customization i ant to hide this two workspace and its Tiles and Screens.
If I understand correctly current issue is hiding the tile item.
Try opening the workspace, then click on the three dots menu and select Edit Menu.
Hover the mouse on the tile and click on the red X button to remove it.
After this change, add sitemap entry in customization (if it's not already there) or use reload from database button. I haven't tested it but this used to work in previous Acumatica versions.
As it was mentioned in comments there is no official programmatic interface to manipulate the tile item.