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

Converting Smartform into PDF preview layout

Former Member
0 Likes
5,833

Hi ABAP experts,

We have converted an existing invoice layout smart form into PDF layout in print preview mode. However, we have an issue with PDF layout alignment. Earlier, it used to print the documents correctly (layout is aligned properly at the middle of the page). But when use this 'PDF' preview layout (triggered from smart form) the layout is left aligned/ larger right margin (but not at the middle).

We have gone through the existing forum links on this PDF layout generating from smart form. But no luck on this left alignment issue. Do we need to modify the OTF data that is being populated in the layout. Can it be modifed with the position of the layout dynamically. Please advise.

Technical team has used "CONVERT_OTF_2_PDF" to populate the OTF data.

In SAP note # 323736 (issued in 2006), the below limitation was mentioned. But do we have any way to resolve this page alignment issue.

Page size for SAPscript/SmartForms: PDF conversion uses the page format from the form definition as page size for the PDF document. If this has been defined larger than the page size that is actually used (for example for INCH12, INCH11 and so on), a reduced document or a larger right margin are the

result when you view/print in Acrobat Reader.

Thanks in advance.

Regards,

Satya

1 ACCEPTED SOLUTION
Read only

Private_Member_7726
Active Contributor
0 Likes
3,937

Hi,

The only thing that I understood for sure is that you are using obsolete FM CONVERT_OTF_2_PDF to try to do something with PDFs. The correct FM for converting (newly created) OTF to other Formats (including PDF) is CONVERT_OTF.

cheers

Janis

14 REPLIES 14
Read only

Private_Member_7726
Active Contributor
0 Likes
3,938

Hi,

The only thing that I understood for sure is that you are using obsolete FM CONVERT_OTF_2_PDF to try to do something with PDFs. The correct FM for converting (newly created) OTF to other Formats (including PDF) is CONVERT_OTF.

cheers

Janis

Read only

0 Likes
3,937

Hi Janis,

The function module  CONVERT_OTF_2_PDF is calling the CONVERT_OTF inside. And we are not sure, what difference is going to make if we use this CONVERT_OTF directly.

Please correct me If I'm wrong.

Regards,

Satya

Read only

0 Likes
3,937

One can never be sure without testing, but I'd expect it to work correctly then. In english the obsolete FM has no description in my Basis release 702 ERP system, but in german it says so explicitly - "Please do not use, but CONVERT_OTF!! This FM is deprecated":

There is not a single use of CONVERT_OTF_2_PDF to be found in our system; there are many uses (in SAP standard and in our custom logic) of CONVERT_OTF.

If the standard PDF preview for some reason is not working correctly on Basis release 700 or later, I'd check if some notes are missing perhaps, and if not - report it to OSS.

cheers

Janis

Read only

Former Member
0 Likes
3,937

Hi,

if you want to see it in preview mode PDF, just when you display the smarform (preview) then in the command write PDF!

it wil convert automatically to PDF without code anything. Try it.

Regards

Miguel

Read only

0 Likes
3,937

Hi Miguel,

We tried that option of "PDF!" but it didn't work for this smart form. Do we need to include/activate any option for this in the smart form.

Regards,

Satya

Read only

0 Likes
3,936

Nop, it is standard, no need to activive anything, check this

just need to view the smartform first, preview mode and the write the PDF! on the command line of SAP.

Regards

Miguel

Read only

0 Likes
3,936

Hi Satya,

     Can you please try with SSFCOMP_OTF_OUTPUT once. I hope it may solve your alignment issue. Also please check the page size to be sure.

Regards,

Anubhab

Read only

0 Likes
3,936

Hi Satya,

'We tried that option of "PDF!" but it didn't work for this smart form. Do we need to include/activate any option for this in the smart form.'..What do you mean by it didn't work for this smartform.?


Execute your smartform and when you are in the print preview mode of the form means you get the output, then type PDF! in the command and hit ENTER.  A popup will get displayed if you are using windows 7


or Allow and decline type of radiobutton option will be displayed if you are using Windows XP. So just click Allow and your smartform output will be displayed in pdf. Now you can save the pdf output file while clicking the save option in PDF. Your smartform output will be aligned properly in the PDF.

You don't need any activation or any FM for converting the output in pdf for this.

Basically, we do this to attach the smartform output in test plan.

NOTE: This is for only to get the output in PDF while you are in Print preview of the form.


Regards

Syed


Read only

Former Member
0 Likes
3,936

Hi All,

We tried to do that by using CONVERT_OTF but still the pdf file is not aligned (left aligned) properly and getting more space on the right side. Do we need to convert that into BINARY format before we download it into '.pdf' file with proper alignment. Is there any way to adjust the alignment.

Thank you.

Best Regards,

Satya

Read only

0 Likes
3,936

Hi again,

I must be too fixated on how we do pdfs in our solution to grasp the problem... What I don't get is (and maybe your technical team can answer): if your solution prints to output devices of type PDF1 (or customer adjusted copies thereof), where and why does the custom logic to convert otf to pdf come into play? And vice versa: if your solution does custom convert from otf to pdf - where and why does the output device of type PDF1 come into play..?

And where and why does the mismatch between the page size in form(s) and converted data actually occurs - because of the page size(s) assigned to output device of type PDF1?

cheers

Janis

Read only

0 Likes
3,936

Hi Friends,

How to set middle alignment in table of SAP Smartform as i mention in image , Please tell me how to do that

Read only

0 Likes
3,936

Hi,

AFAIK, there is only a cumbersome an unreliable workaround, if you are certain all table rows will be of the same height - as is often the case in table header. Then you can use "Space before" attribute of Paragraph format assigned to the second cell to "push" the content down, say, half a line. Set the attribute to about 0.5 LN (it's impossible to give precise value, you'll have to play around with it).

I always feel a bit guilty and "dirty" when I have to talk the owner of requirement out of wanting to have vertical centering in smartform table cell...

cheers

Jānis

Read only

0 Likes
3,936

Hi,

Not fixed height of the cell , some time output in 2 line some time in single line

Read only

0 Likes
3,936

Hi,

That IMO borders on being impossible to implement in a transparent and maintainable (future-proof) way. One could try to create two row types - for single and double line (with different Paragraph formats) and try to determine in advance (via ABAP node or something), which row type should be used for output. But what if there comes time, when there is a row of 3 line height..? One has to add another row type then... What if the client suddenly wants more than one column vertically centered? The row type number doubles... There is no way that I know of to set the "Space before" dynamically, so I'd definetely also try to talk the client out of trying to have the vertical centering.


EDIT in: actually, if you can devise a reliable algorithm to determine the resulting row height and the height of cell to be centered before they are output, assigning a paragraph format dynamically could be achieved via dynamic text node. Meaning - you predefine the paragraph formats with the necessary "Space before", calculate which paragraph format would be needed, and output the cell contents via dynamic text node (instead of the "normal" one), where you can assign the necessary paragraph format. It's significantly more maintainable than having to multiply rows, but I'd still try to talk the client out of it...

cheers

Janis

Message was edited by: Jānis B