Dynamic printing using different trays in Smartforms

This article explains how we can do the dynamic tray interchange for printing of smartforms in other words – Dynamic printing using different trays in Smartforms.

Dynamic printing using different trays in Smartforms

Requirement: There were two pages for delivery note which needs to be printed from two different tray’s of the printer. Reason behind this is, One tray will contain pre-printed stationary and other will have normal paper. This was something which I had never done and I was not able to locate anything from the web so thought of creating page for the benefit of others.

Analysis:  SAP has provided one field in the smartform where we can specify the resources for printing and there we can define the trays. But it is totally static; with the help of ABAP we can make it dynamic to achieve such requirement that I did for my client.

The screenshot shows the resource field available on the Smartform to specify static tray of printer.

 

Realization:  So the realization of this requirement is explained below:

 

  • This requirement was for the Delivery note smartforms.
  • In the requirement the main page of Del Note needs to be printed on the pre-printed stationary and the item texts will be printed on the normal page.
  • The pre printed stationary will be kept in either of the Tray of the printer that total depends upon the configuration i.e., it is totally dynamic we have to change the trays dynamically on the runtime.
  • In my case the configuration will be done on the basis of output type I think it will remain same throughout the SAP for smartform printing.

The screen shots below shows the step by step reliazation of the functionality:

  • Declare constants in the Initialization part of the smartforms.

  • These are the values which we can pass in the field Resource name.
  • As per my clients specification the Printer name will be configured like   ‘ABC_T1’ for Tray 1,’ABC_T2’ for Tray 2 and so on.
  • ·In the Initialization part we need to capture the name of the Printer specified by the user.

 

In the screen shot above  we need to specify the Dynamic trays’s If there is item text available otherwise no need of dynamic conversion.

So If the item text is available we are using Conversion exit to get the actual printer name as specified by the user.

Import nast-ldest and in the variable l_printer you will get the name of the printer.

  • As specified in the above point that the naming convention of printer will contain ‘_T1’ for tray 1 and like that, we are checking the variable for the specified string and accordinglly assigning the tray number to the variable.
  • After assigment of the variable we have to pass these variables to the resource name field. As shown below.

  • By this dynamic tray interchange for printing of smartforms can be achieved.

– submitted by Aashish

About the Author

aditya bajaj
Music and Blogging get my love.

Be the first to comment on "Dynamic printing using different trays in Smartforms"

Leave a comment

Your email address will not be published.


*