Application Development 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: 

How to convert an internal table data into a zipped PDF attachment?

Former Member
0 Kudos

Hi Everybody,

I have to convert an internal table data into a zipped PDF attachment and send it via e-mail.I DON'T have to use the FM 'SO_NEW_DOCUMENT_ATT_SEND_API1' for doing this rather I can use any set of methods for the same.

I am not using the FM 'SO_NEW_DOCUMENT_ATT_SEND_API1' for sending the mail as I cannot zip the attachment using this FM (though it might be possible by some means).

Please guide me through the steps.

Regards

Abhishek

7 REPLIES 7

Former Member
0 Kudos

Hi Abhishek,

Try this.

for unix-systems you can say:

OPEN DATASET file FOR OUTPUT FILTER 'compress'.

also use this link.

regards

Vijay

0 Kudos

Hi Vijay,

I have already seen that thread.My requirement was to send the data in the internal table after zipping into any file format which the user species e.g. if he choses the zip file name as ZIPPO.XLS then he will get a zipped XL file,if the file name he choses is ZIPPO.DOC it will a zipped Word doc file and so on.I was able to achieve the two stated above but not sure hoe to do this for a PDF file.

Let me modify the question for better understanding:

The Demo program BCS_EXAMPLE_6 shows how to zip and send the pdf outout from a smartform .Is there any way I can convert the internal table to the same form for processing it further,in the same way as it is done in this example.

Any workarounds will be welcome.

Regards

Abhishek Singh

Edited by: abhishek singh on Sep 23, 2009 2:25 PM

Edited by: abhishek singh on Sep 23, 2009 4:44 PM

Edited by: abhishek singh on Sep 25, 2009 10:18 PM

0 Kudos

Hi Abhishek,

try to use CONVERT_OTF FM to convert the internal table into PDF and then use the logic you are using to ZIP the file.

Thanks,

Gaurav Mittal

0 Kudos

What do you mean by ZIP, I am not sure to understand? (zip means compress a file, but I am not sure it's what you want to say)

BCS_EXAMPLE_6 generates an Adobe form and sends it as an attachment, why do you say it "shows how to zip"?

Could you explain again?

0 Kudos

Hi Sandra,

MY mistake.BCS_EXAMPLE_6 does not shows how to zip a file....it only shows how to convert the output from the FM into PDF.By ZIPping the file ,yes I mean compression only.

My requirement is to convert the internal table data into a PDF and then zip it.I am using the method 'ADD' of the class 'cl_abap_zip' to achieve the zipping functionality,it works for other formats like "DOC" and "XLS" but not for "PDF" as it requires the contents of type 'string'.

Is there any way to achieve this?

Regards

Abhishek

0 Kudos

Are you generating a PDF the same way as BCS_EXAMPLE_6 ?

In that case, when calling Adobe Form generation function module, you get the XSTRING from parameter /1bcdwb/formoutput-PDF.

When you call the ADD method, pass the XSTRING to the CONTENT parameter (XSEQUENCE type) which is fully compatible!

Former Member
0 Kudos

hii abhishek,

to convert into PDF u know,so the prob lies in zipping it.for this you can use these FM's

CL_ABAP_GZIP Class for (De)Compression (GZIP)

CL_ABAP_GZIP_BINARY_STREAM Class for Data Compression (GZIP, Streaming)

CL_ABAP_UNGZIP_TEXT_STREAM Class for Text Decompression (UnGzip Text Streaming)

CL_ABAP_GZIP_TEXT_STREAM Class for Text Compression (GZIP, Streaming)

CL_ABAP_UNGZIP_BINARY_STREAM Class for Data Decompression (UnGzip, Streaming)

CL_ABAP_ZIP Zip Utility

hope it helps

regards,

Shweta