Through many Blog posts and SAP help sites I found it as a challenge to print the PDF in SAP.
Part of below code can be used in many ways:
1. To save the PDF file from any URL link on some shared drive.
2. To print the PDF file from your shared drive at default printer configured at your machine.
3. To print the PDF file at the printer of your choice.
To save the PDF file from any URL link at shared drive you can use FM HTTP_FILE_GET.
Please look into the attached file here for more information on how to use this FM in this scenario.
Things to note before you use this FM:
URL link should not be blocked from your network.
Check your network connection settings on HTTP sites in Tcode: SICF.
While passing name of your shared drive make sure that it would contain path + <filename.pdf> and not only path.
<filename> can be any name you want to give to your file.
Once your file get saved on shared drive you can pick it up to get printed.
FYI we are using here ADS i.e Adobe document services to print file through Sap ABAP Coding
To get this functionality you should use method Execute of Cl_Gui_Frontend_services.
Deatils on how to use the method can be found in attached file here.
Just to tell you what we are doing here:
We are using Adobe document services command through this method to print the file.
We need to pass the command parameters in parameter field of method.
Also we need to pass application name as Adobe.Exe or Acrord32.Exe depending on what is installed at our system in application parameter of method.
For details Kindly refer the full coding attached here for your reference.