This document is for people who are new to SAP ABAP esp. SMARTFORMS. Here I have explained with screenshot about Copies Window which is one of the four windows type available in SMARTFORMS. I am showing end to end in detail so that even a novice can understand.
Windows are similar to containers where you can put your data. There are four type of WINDOWS:
- Main Window
- Secondary Window
- Copies Window
- Final Window
1. Main window.
You can identify only one window of a form as main window. You use the main window to spread output over several print pages, which is a prerequisite for printing tables.
2. Secondary window.
For output with a fixed length.
3. Copies window.
You use the copies window to define an output area for the print output, whose content you want to appear either only on the copy or only on the original. This allows you to flag copies as copies when the form is printed. In this document we will see more about copies window.
4. Final window.
This is also a special type of window for the details that has to be processed only at the end of the form processing . eg. Total amount of a PO
Step By Step Tutorial for Copies window
Scenario: You have been asked to create a Smart Form where the form will be printed with multiple copies. First Copy should have header “Flight Copy” Second copy should have header “Office Copy” and other copies should have header “Extra Copies”.
1. Open Smart Forms txn SMARTFORMS. Type the form name and click on create.
2. You will be Navigated to this screen.
3. Create Import Parameter for the Form. Goto Form Interface->Import
4. Create Global Data for the Form. Goto Global Definition->Global Data.
Note: Create a Global variable where you can save the page name. Here in this example I have created GV_PAGE
5. Write Code to select data from table.
6. Create a new window and select Copies Window in the window type.
7. Create a Program Line in the Copies Window.
8. Insert the code to differentiate different sheets.
Note: Find the code below.
IF SFSY-COPYCOUNT = 001.
GV_PAGE = ‘Flight Copy’.
ELSEIF SFSY-COPYCOUNT = 002.
gv_page = ‘Office Copy’.
gv_page = ‘Extra Copies’.
System field SFSY-COPYCOUNT is used to identify query whether the current output is the original or, respectively, which number
the copy has. This helps us to label the sheet.
9. Create a Text in the copies window.
10. Insert the variable which is holding the Page name in between ampersand (&).
Note: To open this editor click on the Txt Editor icon present near the Text area and then navigate to Goto-> Change Editor. To navigate back press F3 or Click on ‘Back’ icon
11. Now your smartform is ready. To test the smartform you can directly click on the Test icon or F8 which will generate the Function Module and further running the Function Module will display you the form. But as I want to show and end to end of how Smartforms work, we will create a Z Program in SE38.
Note: Download attached “ZWINDOWSDEMO_DRIVER.TXT” file for the driver program.
12. Activate and press F8 to execute the driver program. You will be navigated to the below screen. Where you can enter the parameter value and execute.
13. This is the print parameters screen where you can enter the Printing options and copies you want. I have selected 3 here. Click on print preview to preview the output or print to print the output.
Hope I was able to explain copies window in detail. If any queries please leave it on the comments. I will respond as early as possible.