GoodleAds

WORKING WITH LABELS IN SAP SCRIPTS

WORKING WITH LABELS IN SAP SCRIPTS:

1.Labels are used to print the same information on each window.
2.In the real time, in wharehouse  module we design the so many labels such as accepted labels,
   rejected labels, on test labels and contol sample labels etc.
3.Depends on the label size, we split the main window into smaller windows.

Steps to design the form:

Execute SE71 Transaction.
Provide the form name.
Click on create.
Provide short description.
Click on pages in the application tool bar.
In the menu bar click on edit. Create element.
Provide page name and short description. Enter.


Now click on windows in the application tool bar.
By default the main window is created.


Now click on page windows in the application tool bar.
In the menu bar click on edit. Click on Main Window.
Provide the details as follows. Click on Enter.


Now click on paragrah formats in the application tool bar.
Provide paragraph name and short description.
Now click on Header (cap symbol ) in the application tool bar.
Click on basic settings. Provide default paragraph and next page details.
Save, Check and Activate the form.

Now write the driver program.

*&---------------------------------------------------------------------*
*& Report  ZD_SCRIPTS_LABELS
*&
*&---------------------------------------------------------------------*
REPORT ZD_SCRIPTS_LABELS.
PARAMETERP_MATNR TYPE MCHA-MATNR,
           P_WERKS 
TYPE MCHA-WERKS,
           P_NOL 
TYPE I.
DATABEGIN OF WA_MCHA,
 MATNR 
TYPE MCHA-MATNR,
 WERKS 
TYPE MCHA-WERKS,
 CHARG 
TYPE MCHA-CHARG,
 HSDAT 
TYPE MCHA-HSDAT,
 VFDAT 
TYPE MCHA-VFDAT,
 
END OF WA_MCHA.
SELECT SINGLE MATNR WERKS CHARG HSDAT VFDAT FROM MCHA INTO WA_MCHAWHERE MATNR P_MATNR AND WERKS P_WERKS.
* Access the layout from driver program
CALL FUNCTION 'OPEN_FORM'
 
EXPORTING
 
FORM 'ZF_SCRIPT_LABELS'.
* Transfer the data to main window
DO P_NOL TIMES.
 
CALL FUNCTION 'WRITE_FORM'
 
EXPORTING
 ELEMENT 
'TM'
 
WINDOW 'MAIN'.
ENDDO.
* Close the form
CALL FUNCTION 'CLOSE_FORM'.


Now go to main window in the form.
Click on text elements and enter data as below.


Save, check and activate the form.

Now execute the program.
Provide the input.



Provide the output device as 'LP01'.
Click on print preview.

In this example we can print the any no. of labels and in my system i don't have data for mfg. dt
and exp. dt.

OUTPUT:




No comments:

Post a Comment