Label printing using Smart forms

By Sushil Choudhary, Tata Consultancy Services

It is believed that SAP has not provided any functionary to create labels in Smart form and this is considered as one of its disadvantage. In this document we will learn how to create labels using Smart form. 

To understand this document you should have fair idea about how Smart form works. Also this document will not explain the programming part required to fetch the data which is used to create labels.  

Below is the kind of output we expect form this label printing form.  

Step1:-

Suppose we have all the data used to create labels available in our Smart form in table IT_FINAL which is exported thorough driver program to Smart form.

Now our requirement is to print the labels in the manner shown below.

Label1   Label2  

Label3   Label4  

Label5   Label6    

i.e. odd labels on left side and even on right. Your requirement might vary from this one and you need to do the changes in layout and logic accordingly.  

To implement this requirement cerate 5 secondary window and a main window all of the size of label box, in 1st page of Smart form as shown below.  

Last window which print the last label on the page should be the main window, so that the next page will be triggered if more labels needs to be printed.  

Step2:-

In the Global Dataà Initialization section of the smart form  

Every row in the table IT_FINAL represents 1 label.

As per the current requirement every 6th row will cerate last label on the page and any further row if exist will trigger the next page.  

Move every 6th row from IT_FINAL to IT_MAIN and delete the same from IT_FINAL.

Now we have IT_FINAL which contain data to be printed in 5 secondary windows and IT_MAIN which contain data for main window.  

Step3:-

Create 5 work areas wa_1, wa_2, wa_3, wa_4, wa_5 of the type of line of IT_FINAL in the global declaration area.  

Write code to move 1st 5 rows from IT_FINAL to the above declared work areas and then delete those 5 rows form internal; table as shown in the below screen-shot.  

 

Step 4:-

Now create a text node in every window and pass the label data from wa_1 to text node of 1st secondary window and so on.  

Every Node has a condition that it will execute only if the corresponding work area value is not initial.  

 And instead of window for every node tick the checkbox to draw frame lines, so that frame is printed only if the text node has data to print.  

Click here to continue...

Please send us your feedback/suggestions at webmaster@SAPTechnical.COM 

HomeContribute About Us Privacy Terms Of Use • Disclaimer • SafeCompanies: Advertise on SAPTechnical.COM | Post JobContact Us  

Graphic Design by Round the Bend Wizards

footer image footer image