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 convert an internal table to otf and than to a PDF document ?

trabelsioussa
Explorer
0 Kudos

Hello Experts,

My requirement is that I need to convert internal table to PDF format and then send it to mail .

regards

13 REPLIES 13

raymond_giuseppi
Active Contributor

I will suppose Adobe Forms is not available on your system.

You could build a generic report or a Sap Script/Smart Form to create a classic spool or OTF data, and then use the CONVERT_OTF_2_PDF or CONVERT_ABAPSPOOLJOB_2_PDF

Any reason you don't generate the attachment as xml or xlsx?

0 Kudos

raymond.giuseppi thanks for your reply.

- i want to generate PDF attachment .

- now i have internal table with data how can i convert it to otf . have you example code please ?

regards

Don't you love it when you ask questions and the OP just repeats their question again?

trabelsioussa

"I want to generate a PDF attachment" is not an answer to the question "Any reason you don't generate the attachment as XML or XLSX".

What we want to know is why must the attachment be PDF? Who has said so? What will happen to attachment?

'We hear only our own voices, still echoes returning to our emptiness.' (Stojanovic)

0 Kudos

sorry raymond.giuseppi .

this customer request . he wants pdf attachment.

You could just build a small dynamic program (getting fields decription, playing with field symbols) to generate a classic spool or use a class such as CL_SALV_TABLE for generating such a spool. Then convert this spool to pdf with the classic FM already mentionned.

0 Kudos

trabelsioussa If the idea is data exchange into another system, then they're definitely wanting the wrong thing. I ask again - what are they doing with the attachment once they receive it? Just reading it?

matthew.billingham just for reading .

Ulrich_Schmidt
Product and Topic Expert
Product and Topic Expert
0 Kudos

Alternative solution using Java and SAP BC:

  1. Follow this blog that explains how to convert an internal table to Excel format:
    Using Java Functionality from your ABAP Programs
  2. Then replace the open source library "Apache POI" used for creating the Excel format, with another one that creates PDF format, for example this one: Free Java PDF Library – Create Read Modify Print Convert PDF Documents in Java (e-iceblue.com)
    (A Google search might turn up a few alternatives, if you don't like this "semi-commercial" library.)
  3. Finally, you can easily use the SAP BC Service "pub.client:smtp" to send the binary PDF data off in an email attachment.

0 Kudos

thanks Ulrich Schmidt ,i will try it .

Tomas_Buryanek
Active Contributor
0 Kudos

Are you aware of "printing a Forms" in SAP? There are old ways like Sapscript (SE71) and Smartforms (t-code SMARTFORMS), or Adobe forms (SFP). This way you can design a print form (table in your case) and call it from your program. Result then can be retrieved as PDF binary file.

This is most common way to create a PDF in SAP. It requires learning and practice from a developer.

Or you are looking for different kind of solution?

-- Tomas --

trabelsioussa
Explorer
0 Kudos

thanks tomas.buryanek for reply.

i have idea about Smartforms (t-code SMARTFORMS). i will try it . have you example code maybe can help me ?

Tomas_Buryanek
Active Contributor
0 Kudos

trabelsioussa Did you tried to search "smartform to pdf"? If yes, then which help do you need?

-- Tomas --