Está en la página 1de 7

Creating custom page format for sapscript/smartform

You can print any size of output from SAP, it all depends on what page format is defined and configured in your SAP system. Most of the standard page format are already defined in SAP but often you come across the situation where the required output doesnt even come close to any of these predefined page format. Printing cheques and receipts are some common example. Defining and configuring Page format is multi-step process and often is printer specific. In short its very easy to get your setting wrong and situation is worse when printer is physically away from you. Its very important to understand how this page format works in SAP. The process starts with defining the Page Format, but you need few more setting to actually print this page size on printer. Page format just define the size of page for sapscript (this size info defined in page format is not passed to printer), next step is to define Format type which defines 'Type of format' and what orientation are allowed with this page format. It is important to note that Page Format and Format type should have same name. Well, you can argue why do we need to define Format Type. To find out that, which you may find bit confusing refer sap note 2374. Still you can not print with this page size on printer. To allow printer to use this new page format you need to add this page format to device type of printer. This step will enable you to print the output but correct page size information will not be passed to printer. You need to actually put printer specific code to set desire page size on printer. Before we start it worth checking where do we specify page format in sapscript.

Now let us go through each step with screen shot. You need to have access to transaction SPAD and changes to the repository and cross-client customizing should be permitted in the client where you will create/change page format. Execute transaction SPAD. By default transaction will not show all the tabs, you need to click on 'Full administration' to get the desire tab.

Go to 'Device Types' tabs and hit 'Display' button next to Page Formats.

On next screen hit 'change' button then you will button to create new Page format, now press New button.

Fill in the required input, below is an example.

Congrats you just created a new page format. At this stage you can use this page format in sapscript, however you can not print that sapscript. This information of page dimension is just for sapscript. You will get warning message while adding page format to sapscript 'There is no form for page format XYZ' and error message while printing 'Device type ABC does not support page format XYZ'. Next step is to create Format Type. Remember Format Type should have same name as your Page Format name. Start from transaction SPAD, on 'Device Type tab press display button next to 'Format Type'. Click on change then new button and create Format Type as shown in screen-shot below.

To allow printer to use this new Format Type you need to add this format to device type of printer. You can find the device type of printer from table TSP03D, it is stored in field PATYPE.

On 'Device Types' table enter Device name and press Display button next to it.

Go in change mode and press 'Formats'

On next screen press New button and enter 'Format Type'.

Once the format type added to device type, double click on the line (on first column). On next screen as shown below double click on 'Printer initialization'

Input following code, this code will actually set the page length on printer. Page length is defined under the code '# set page length 72 lines'. Its defined in hex and is defined in lines. You might have to do some math to convert your page length from CM/MM to line considering lines per inch value set. For example in this particular case the page length define Page format is 102 mm which is 4 inches. Using setting 6 lines per inch 4 inches comes out to be 24 lines. (ok, the comment is wrong, it should be '# set page length 24 lines'). And in hex 24 is represented as 18.

You might need to add this format and put this code for each device type of each printer on which you are planning to print the output. With all these setting in place you can, hopefully, print the output on printer with correct page format.

También podría gustarte