Application Development Blog Posts
Learn and share on deeper, cross technology development topics such as integration and connectivity, automation, cloud extensibility, developing at scale, and security.
cancel
Showing results for 
Search instead for 
Did you mean: 
Juwin
Active Contributor
6,697

As developers, many of us would have faced this challenge atleast once - the 'Terms and Conditions' Page. Most customers have T&C pages looking like this - with column view.

This is easily achievable in MS Word, using the option under Page Layout.

How do you achieve this in SAP? Traditional wisdom may tell you to keep 2 text boxes - on left & right and 2 text objects to include in them. But, what if the text content changes or the font changes? When using 2 text boxes, the text from 1st box doesn't overflow to the 2nd box automatically.

Some other posts on SCN tells to scan the entire T&C Page as an image and include that as a graphic on the form. But, wouldn't that require a transport whenever the text content needed to be changed (Agreed that T&C doesn't change very often)? Also, including a high clarity image on the file means, increasing the file size.

Solution - Play with the generated OTF. OTF data is a series of commands and contents. If you know how to play around with the commands, you can insert/delete/modify the structure of the output, different from the way it was originally designed in the Smartform/ SAPScript.


Here, I am taking an example of 2 column view. You may extend concept this to any number of columns.


Goto SO10, create the text, containing T&C details - or as an example upload any dummy text file.


Create a Smartform with 2 pages, both containing MAIN windows, at required column positions. Page1 should have Page2 as the next page and Page2 should have Page1 as the next page.


My Page1:

My Page 2:

Now, include the text object in the MAIN window.

Create a driver program to call the Smartform and get back OTF data.

Without any modifications to the OTF structure, the output looks like this:

Page 1:

Page 2:

Just like the way it was designed in the Smartform.

Now, OTF analysis:

Everytime a new page begins, OTF uses command OP and everytime a page ends, OTF uses command EP (Full list of OTF commands are listed in program RSTXDATAOTF). If you delete OP and EP commands from OTF data, system wouldn't know to split the page/ start a new page. This is the technique I am going to use here. Lets debug:

Here is my OTF data:

I have circled here the first OP command, which tells the system to begin the 1st page. Lets find the next page - that is by finding the next OP command.

Here is the next OP command. Here, you will see that 1st page is closed with EP command and the next page is started with OP command.

Lets delete these entries and see what happens.

Now, SAP wouldn't know to start the next page and will think that the contents of the 2nd page in the Smartform is actually part of the 1st page in the output.

Have a look at this output. You will see that the contents from both pages have merged together to form a single page.

With this method, even if text or font changes in the included text, the contents adjust automatically. Please take note that common portions of page - like heading, logo, address, other texts etc, need to be defined only on Page1. If you need more columns in the output, you will need to have more intermediate pages in the Smartform.


Eg. to build a 3 column view:

Page1 (with logo, address, other constant texts, main window equivalent to the size of 1st column), having Next page as Page2

Page2 (main window equivalent to the size of 2nd column), having Next page as Page3

Page3 (main window equivalent to the size of 3nd column), having Next page as Page1

And, build a looping logic to delete OP commands for Pages 2 & 3 (so that 2nd & 3rd pages doesn't start), and EP commands for Pages 1 & 2 (so that 1st & 2nd pages doesn't close).


Once you have the manipulated OTF, use function modules CONVERT_OTF_2_PDF to convert it to PDF or PRINT_OTF to send it to printer spool.


Please let me know if any portion of this document is not clear, so that I may improve the relevant portions.

Thanks for reading,

Juwin

14 Comments
Labels in this area