Skip to Content
Author's profile photo Joyjit Biswas

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).


IMG1.jpg


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.



IMG2.jpg



STEP 04: Go to the initialization tab page in the Global Definition. Enter Input and Output Parameters.

Suppose,

   Input Parameters                                                                      Output Parameters

                

              I                                                                                                IT_MAIN

           ITAB                                                                                               ITAB

            WA

       IT_MAIN

      WA_MAIN

Enter the piece of Code in the Initialization part.

* PUSH EVERY SIXTH ROW OF IT_FINAL INTO IT_MAIN .
I = 6.

DO.
READ TABLE ITAB INTO WA INDEX I.

IF SY-SUBRC = 0.
APPEND WA TO IT_MAIN.
I = I + 6.
ELSE.
EXIT.
ENDIF.
ENDDO.

* DELETE THE ROW FROM IT_FINAL WHICH ARE PRESENT IN IT_MAIN .
LOOP AT IT_MAIN INTO WA.
DELETE TABLE ITAB FROM WA.
ENDLOOP.



IMG3.jpg



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.


IMG4.jpg



STEP 06: Set the windows in the Form painter of the page and resize them.


IMG5.jpg


STEP 07: Now, Create a Program line in First Window (Suppose, WINDOW_01).



IMG6.jpg


STEP 08: Write the piece of Code in the Program Lines General Attributes Tab.


IMG7.jpg


STEP 09: Create five texts in the respective five Windows one by one.


IMG8.jpg


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).


IMG9.jpg

IMG10.jpg

IMG11.jpg

IMG12.jpg

IMG13.jpg

STEP 11: Go to the Condition Tab Page of the five texts and set the conditions as follows.


IMG14.jpg


IMG15.jpg


IMG16.jpg


IMG17.jpg



IMG18.jpg


STEP 12: Now, in the main Window Create a table.


IMG19.jpg



STEP 13: In the table, go to the Data tab page and set the internal table (Suppose, IT_MAIN INTO WA_MAIN).


IMG20.jpg



STEP 14: Go to the Main Area of the Table and create a Table Line with Line Type: %LTYPE1.


IMG21.jpg



STEP 15: The Output Option tab of the Table line.


IMG22.jpg



STEP 15: Create a text inside the cell of the table and set the headings as well as fields.


IMG23.jpg

STEP 16: Now, create a Command in the main area of the table.


IMG24.jpg


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.


IMG25.jpg


IMG26.jpg


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).


IMG27.jpg


STEP 19: Write the Code in the report program to pass data to the Smart Form.

report  zjoyjit_label_driver.

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 .

start-of-selection .

select matnr
ersda
laeda
mtart
matkl
from mara
into table itab
where matnr in s_matnr .

call function ‘SSF_FUNCTION_MODULE_NAME’
exporting
formname                 =
‘ZJOYJIT_LABEL_PRINTING’
*   VARIANT                  = ‘ ‘
*   DIRECT_CALL              = ‘ ‘
importing
fm_name                  = fname
* EXCEPTIONS
*   NO_FORM                  = 1
*   NO_FUNCTION_MODULE       = 2
*   OTHERS                   = 3
.

call function fname
* EXPORTING
*   ARCHIVE_INDEX              =
*   ARCHIVE_INDEX_TAB          =
*   ARCHIVE_PARAMETERS         =
*   CONTROL_PARAMETERS         =
*   MAIL_APPL_OBJ              =
*   MAIL_RECIPIENT             =
*   MAIL_SENDER                =
*   OUTPUT_OPTIONS             =
*   USER_SETTINGS              = ‘X’
* IMPORTING
*   DOCUMENT_OUTPUT_INFO       =
*   JOB_OUTPUT_INFO            =
*   JOB_OUTPUT_OPTIONS         =
tables
itab                       = itab
exceptions
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.


OUTPUT:

  THE SELECTION SCREEN:


IMG28.jpg


THE PRINTER SELECTION SCREEN:


IMG29.jpg


CLICK ON PRINT PREVIEW:


IMG30.jpg



Thanks & Regards,

Joyjit Biswas

Assigned Tags

      Be the first to leave a comment
      You must be Logged on to comment or reply to a post.