cancel
Showing results for 
Search instead for 
Did you mean: 

Smartforms: Printing a template multiple times in single page according to internal table

Former Member
0 Kudos
808

My requirement in to print a ticket. The ticket has its own layout. User gives the range of tickets to be printed. eg: user selection range 1 to 30. Then tickets with no. 1 to 30 will be printed. Tickets layout consists of barcode and is created in a template. So a template is my ticket. I need to repeat this template 3 times in a page, and remaing in next pages, each page with 3. The data can be send to the smartform through internal table. How can achieve this,? Please help..

Accepted Solutions (0)

Answers (2)

Answers (2)

basarozgur_kahraman
Contributor
0 Kudos

Hi Abdul,

Here is an example code. if you want to print only one or two of them, you have to set smartform conditions that depends on the row count of the internal table.

FORM print_label  TABLES   p_it_label TYPE typ_it_label.

   DATA: _it_label TYPE typ_it_label WITH HEADER LINE.

   DATA: _fm_name    TYPE rs38l_fnam,

         _formname   TYPE tdsfname,

         _count      TYPE i.

   DATA: _control TYPE ssfctrlop,

         _output  TYPE ssfcompop.

 

   CHECK p_it_label[] IS NOT INITIAL.

       _formname = 'ZPP_MYSMARTFORM'.

   CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'

     EXPORTING

       formname           = _formname

     IMPORTING

       fm_name            = _fm_name

     EXCEPTIONS

       no_form            = 1

       no_function_module = 2

       OTHERS             = 3.

*  _control-no_dialog = 'X'.

*  _control-preview   = 'X'.

     _control-no_open   = 'X'.

     _control-no_close  = 'X'.

     CALL FUNCTION 'SSF_CLOSE'

       EXCEPTIONS

         formatting_error = 1

         internal_error   = 2

         send_error       = 3

         OTHERS           = 4.

     CALL FUNCTION 'SSF_OPEN'

       EXPORTING

*     ARCHIVE_PARAMETERS       =

*     USER_SETTINGS            = 'X'

*     MAIL_SENDER              =

*     MAIL_RECIPIENT           =

*     MAIL_APPL_OBJ            =

*     OUTPUT_OPTIONS           =

         control_parameters       = _control

*   IMPORTING

*     JOB_OUTPUT_OPTIONS       =

       EXCEPTIONS

         formatting_error         = 1

         internal_error           = 2

         send_error               = 3

         user_canceled            = 4

         OTHERS                   = 5.

     LOOP AT it_label INTO _it_label.

       APPEND _it_label.

       _count = _count + 1.

           CHECK _count = 3.

       CALL FUNCTION _fm_name

         EXPORTING

           control_parameters = _control

         TABLES

           it_data            = _it_label

         EXCEPTIONS

           formatting_error   = 1

           internal_error     = 2

           send_error         = 3

           user_canceled      = 4

           OTHERS             = 5.

       REFRESH _it_label.

       CLEAR _count.

     ENDLOOP.

     IF _count > 0.

       CALL FUNCTION _fm_name

       EXPORTING

         control_parameters   = _control

*      output_options       = output_options

*      user_settings        = space

*    IMPORTING

*      document_output_info = document_output_info

*      ob_output_info       = job_output_info

*      job_output_options   = job_output_options

         TABLES

           it_data                = _it_label.

     ENDIF.

     CALL FUNCTION 'SSF_CLOSE'

       EXCEPTIONS

         formatting_error = 1

         internal_error   = 2

         send_error       = 3

         OTHERS           = 4.

ENDFORM.                    " PRINT_LABEL

Former Member
0 Kudos

1 Ticket = 1 Page.

Define the Ticket page format ( Width ,Landscape or Portrait,Height )in SPAD.

Then you can easy to proceed to develope smartforms with barcode in a template.

Thank You.

Sivachan

Former Member
0 Kudos

thanks for the reply;...but as per mu req. 3 tickets in a page