Design the screen as shown in below.
Execute SE71 transaction.
Provide the form name eg: ZF_SCRIPT1
Click on create. Click on ok.
Provide the form name eg: ZF_SCRIPT1
Click on create. Click on ok.
Provide short description.
Click on pages in the application tool bar then it shows the following screen.
In the menu bar click on edit. click on create element.
Provide the page name, short description and click on enter.
Repeat the same steps for all pages.
Click on windows button in the application tool bar.
Click on edit. Create element. By default system will provide the main window.
Provide window name, short description and click on enter.
Repeat the same steps for all the other windows then the screen as follows.
Click on page windows in the application tool bar.
Click on Edit in the menu bar. Click on create element and it will display the all the available windows.
Double click on address window and provide the co-ordinates. click on save.
Similarly provide the co-ordinates for all the windows and the screen as follows.
Click on paragraph formats in the application tool bar. Provide paragraph name eg: P1 and click on save and provide short description.
Click on header (CAP SYMBOL) in the application tool bar and click on Basic Settings button.
Provide first page and default paragraph and click on save.
In the menu bar click on settings. Click on Form painter
Select the checkbox Graphical Form Painter and click on Enter.
Click on Layout in the application tool bar.
Arrange the layouts by using drag & drop and screen as follows.
Minimize the layout and once again click on settings in the menu bar. Click on form painter and deselect the checkbox graphical form painter. Click on Enter.
Save the layout.
Now click on Form in the menu bar. Go to check and click on definition.
again click on Form in the menu bar. Click on Activate.
Layout design is completed. Now we need to get the data from driver program to SAP SCRIPT layout and we can print the data on the page windows through symbols. Eg:&wa_ekko-ebeln&
For this example I am printing only address window using 'WRITE_FORM' function module.
If you want to print other windows also, you need to call 'WRITE_FORM' function module for each
window and pass the window name as input.
DRIVER PROGRAM:
*&---------------------------------------------------------------------*
*& Report ZD_SCRIPTS1
*&
*&---------------------------------------------------------------------*
REPORT ZD_SCRIPTS1.
PARAMETER P_LIFNR TYPE LFA1-LIFNR.
TYPES: BEGIN OF TY_LFA1,
LIFNR TYPE LFA1-LIFNR,
NAME1 TYPE LFA1-NAME1,
ORT01 TYPE LFA1-ORT01,
END OF TY_LFA1.
DATA WA_LFA1 TYPE TY_LFA1.
SELECT SINGLE LIFNR NAME1 ORT01 FROM LFA1 INTO WA_LFA1 WHERE LIFNR =
P_LIFNR.
* Access the layout from driver program
CALL FUNCTION 'OPEN_FORM'
EXPORTING
FORM = 'ZF_SCRIPT1'.
* Transfer the data to address window.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
WINDOW = 'ADDRESS'.
*& Report ZD_SCRIPTS1
*&
*&---------------------------------------------------------------------*
REPORT ZD_SCRIPTS1.
PARAMETER P_LIFNR TYPE LFA1-LIFNR.
TYPES: BEGIN OF TY_LFA1,
LIFNR TYPE LFA1-LIFNR,
NAME1 TYPE LFA1-NAME1,
ORT01 TYPE LFA1-ORT01,
END OF TY_LFA1.
DATA WA_LFA1 TYPE TY_LFA1.
SELECT SINGLE LIFNR NAME1 ORT01 FROM LFA1 INTO WA_LFA1 WHERE LIFNR =
P_LIFNR.
* Access the layout from driver program
CALL FUNCTION 'OPEN_FORM'
EXPORTING
FORM = 'ZF_SCRIPT1'.
* Transfer the data to address window.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
WINDOW = 'ADDRESS'.
* Transfer the data to main window.
* CALL FUNCTION 'WRITE_FORM'
* EXPORTING
* WINDOW = 'MAIN'.
*Close the form
CALL FUNCTION 'CLOSE_FORM'.
* EXPORTING
* WINDOW = 'MAIN'.
*Close the form
CALL FUNCTION 'CLOSE_FORM'.
After clicking on text elements provide data which you want to print as following.
Come out of text elements.
Save, Check and Activate the form.
Now execute the driver program.
Provide the input. Execute.
Now provide the output device as 'LP01' and click on print preview.
OUTPUT: