Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Print document attachment

0 Likes
5,249

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

12 REPLIES 12
Read only

ipravir
Active Contributor
0 Likes
3,264

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.

Read only

0 Likes
3,264

Thanks for the help  Pravver

but how i can save the attachment of document. I don't know where it's saved in server.

Read only

ipravir
Active Contributor
0 Likes
3,264

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.

Read only

0 Likes
3,264

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 

Read only

Juwin
Active Contributor
0 Likes
3,264

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

Read only

Former Member
0 Likes
3,264

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

Read only

0 Likes
3,264

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

Read only

ipravir
Active Contributor
0 Likes
3,264

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.

Read only

Juwin
Active Contributor
0 Likes
3,264

You can store a document in either place:

Thanks,

Juwin

Read only

0 Likes
3,264

i didn;t knew it . Thanks!

I create the  attachment in SAP DB.

Read only

Juwin
Active Contributor
0 Likes
3,264

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

Read only

Juwin
Active Contributor
0 Likes
3,264

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