2015 Jul 17 11:22 AM
Hi experts
Can i print the attachment of document with program of printing the document.
I have an invoice with an attachment file. I have the program to print the invoice and i want to print and the attachment too.
Also i have the program to send the invoice as pdf with email and i want to sent and the attachment in the same email.
I searched the forum, but I couldn't find any thread related to this.
Thanks and Regards
Dio
2015 Jul 17 11:44 AM
Hi Dio,
If you are able to open Attached file, then i would suggest, provide a path to save the document and
through below functionality you can open the same with print option.
Means, the document will open direct for print.
you can refer below coe, which for print the file,
cl_gui_frontend_services=>execute
exporting
document = strname
default_directory = str_repath
synchronous = 'X'
operation = 'PRINT'
method to open document with print.
Regards,
Praveer.
2015 Jul 17 1:32 PM
Thanks for the help Pravver
but how i can save the attachment of document. I don't know where it's saved in server.
2015 Jul 17 1:42 PM
Hi Dio,
Why Server?
"I have an invoice with an attachment file. I have the program to print the invoice and i want to print and the attachment too."
As you said, you have invoice with attached file,
Provide an option to save the same in local system, and after complete print work (as pr above logic) delete the document from the same path.
Or something i am missing, make me clear so i can provide some other solution.
Regards,
Praveer.
2015 Jul 17 2:04 PM
Hi Pravver
Sorry for the awful presentation of my problem.
I can't find where the attachment stored and i don't know how to download it.
I was trying to do it with the method cl_gos_document_service=> export_attachment but i don't want to pop up the window with the path.
I want to download the attachment to my local system , print it as you say above , and delete it after printing.
I can't find another way!
thanks again
Dio
2015 Jul 17 2:07 PM
Is this an attachment (stored in SAP DB) or a business document (stored in content server)?
The function modules to retrieve both these are different.
Thanks,
Juwin
2015 Jul 17 2:10 PM
If it is stored in GOS. You can use the following link to retrieve it ( Ignore the part which you don't need like downloading it to Local PC )
Then you can print using the following link. Instead of storing the file in Local PC. Store it is application server so that it can run in background.
Hope it helps.
R
2015 Jul 17 2:18 PM
Hi Juwin
thanks for the answer .
I don't know where it stored. When i create an attachment in FB02 or FB03 where it stored?
Dio
2015 Jul 17 2:20 PM
Hi Dio,
Search in scn with "BDS_GOS_CONNECTIONS_GET" Function Module.
Already lots of links are available in scn.
For the reference, you can follow the below links, where the same has been explained by Durairaj Athavan Raja & Former Member
Regards,
Praveer.
2015 Jul 17 2:24 PM
2015 Jul 17 2:44 PM
i didn;t knew it . Thanks!
I create the attachment in SAP DB.
2015 Jul 17 2:46 PM
Then, you should be able to use the function modules mentioned in the other links in this thread, to get their content.
To attach them to an outgoing email is easy.
But, to print them, I still feel that you will have to use OS commands - if printed in background.
Thanks,
Juwin
2015 Jul 17 1:48 PM
I am assuming the printouts are sent from a background job. I can't imagine a person sitting in front of a computer, just to trigger printouts. In background, you cannot use frontend printing explained by Praveer.
You will have to download the attachment, onto the application server and use operating system commands to print that file. What is the Operation system of the application server? The commands differ from OS to OS.
We had also used an external application to do this for us.
Thanks,
Juwin