Label Printing in SmartForms
NAVIGATION FOR LABEL PRINTING IN SMART FORMS
STEP 01: Open the smartForms application with Transaction Code ‘SmartFroms’.
STEP 02: Go to the Form Interface and click on the Table Tab and enter the internal table name from the Driver Program (Suppose: ITAB).
STEP 03: Go to the Global Definition and provide the global data. (You need to construct a Structure Type (suppose: ZJOYJIT_LABEL) and a table type (Suppose: ZJOYJIT_STR_MARA) with its line type as the structure type with the fields to be printed in the label.
STEP 04: Go to the initialization tab page in the Global Definition. Enter Input and Output Parameters.
Input Parameters Output Parameters
Enter the piece of Code in the Initialization part.
* PUSH EVERY SIXTH ROW OF IT_FINAL INTO IT_MAIN .
I = 6.
READ TABLE ITAB INTO WA INDEX I.
IF SY-SUBRC = 0.
APPEND WA TO IT_MAIN.
I = I + 6.
* DELETE THE ROW FROM IT_FINAL WHICH ARE PRESENT IN IT_MAIN .
LOOP AT IT_MAIN INTO WA.
DELETE TABLE ITAB FROM WA.
STEP 05: Now create 5 New Windows except the Main Window and set the positions of the in the page and resize them in Form Painter.
STEP 06: Set the windows in the Form painter of the page and resize them.
STEP 07: Now, Create a Program line in First Window (Suppose, WINDOW_01).
STEP 08: Write the piece of Code in the Program Lines General Attributes Tab.
STEP 09: Create five texts in the respective five Windows one by one.
STEP 10: In General Attribute tabs of each texts, mention the heading and the fieldnames (Suppose: WA1-MATNR,……., wa1-MTART And for the other windows WA2-MATNR,……., WA5-MTART).
STEP 11: Go to the Condition Tab Page of the five texts and set the conditions as follows.
STEP 12: Now, in the main Window Create a table.
STEP 13: In the table, go to the Data tab page and set the internal table (Suppose, IT_MAIN INTO WA_MAIN).
STEP 14: Go to the Main Area of the Table and create a Table Line with Line Type: %LTYPE1.
STEP 15: The Output Option tab of the Table line.
STEP 15: Create a text inside the cell of the table and set the headings as well as fields.
STEP 16: Now, create a Command in the main area of the table.
STEP 17: In the general Attribute Tab page, click on the Checkbox “Go to New Page” and Set the Page name (Suppose: %PAGE1) and in the Condition tab page set the ITAB NOT EQUAL TO INITIAL.
Save, Activate and Test the program in the display mode.
STEP 18: Now, go to the SE38 Transaction and write the Driver program to pass the data to the smart form from Mara Table (Suppose: ZJOYJIT_LABEL_DRIVER).
STEP 19: Write the Code in the report program to pass data to the Smart Form.
tables : mara .
data : itab type zjoyjit_str_mara ,
wa type zjoyjit_label ,
fname type rs38l_fnam .
selection-screen : begin of block b1 with frame title t1 .
select-options : s_matnr for mara-matnr .
selection-screen : end of block b1 .
into table itab
where matnr in s_matnr .
call function ‘SSF_FUNCTION_MODULE_NAME’
formname = ‘ZJOYJIT_LABEL_PRINTING’
* VARIANT = ‘ ‘
* DIRECT_CALL = ‘ ‘
fm_name = fname
* NO_FORM = 1
* NO_FUNCTION_MODULE = 2
* OTHERS = 3
call function fname
* ARCHIVE_INDEX =
* ARCHIVE_INDEX_TAB =
* ARCHIVE_PARAMETERS =
* CONTROL_PARAMETERS =
* MAIL_APPL_OBJ =
* MAIL_RECIPIENT =
* MAIL_SENDER =
* OUTPUT_OPTIONS =
* USER_SETTINGS = ‘X’
* DOCUMENT_OUTPUT_INFO =
* JOB_OUTPUT_INFO =
* JOB_OUTPUT_OPTIONS =
itab = itab
formatting_error = 1
internal_error = 2
send_error = 3
user_canceled = 4
others = 5
STEP 20: Save, Compile, Activate and Run the Program with the printer.
THE SELECTION SCREEN:
THE PRINTER SELECTION SCREEN:
CLICK ON PRINT PREVIEW:
Thanks & Regards,