Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Multiple smartform

Develop smartform for multiple printing using control parameter .It is working fine for more than one entry sheet but it is not showing result for single when i execute it for single entry sheet its showing the print pop but after clicking on print preview it  return on selection screen.

fm_name = 'ZML_SERVICE_ENTRY'.

CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
   EXPORTING
     formname           = fm_name
*   VARIANT            = ' '
*   DIRECT_CALL        = ' '
   IMPORTING
     fm_name            = l_fmname
   EXCEPTIONS
     no_form            = 1
     no_function_module = 2
     OTHERS             = 3.
IF sy-subrc <> 0.
   MESSAGE i398(00) WITH 'Error in displaying form output'(004).
ENDIF.

LOOP AT it_result.
   w_cnt2 = sy-tabix .
   CASE w_cnt2.

     WHEN 1.
       control_parameters-no_open   = space.
*      control_parameters-no_close  =  space.
       control_parameters-no_close  = 'X' .
     WHEN w_cnt .
       control_parameters-no_open   = 'X' .
       control_parameters-no_close  = space .
     WHEN OTHERS.
       control_parameters-no_open   = 'X' .
       control_parameters-no_close  = 'X' .
   ENDCASE.
   CALL FUNCTION l_fmname
     EXPORTING
       control_parameters = control_parameters
       output_options     = output
       lblni_low        = s_lblni-low
       lblni_high         = s_lblni-high
       lbldt_fr           = s_lbldt-low
       lbldt_to           = s_lbldt-high
       sbnam_low          = s_sbnam-low
       sbnam_high         = s_sbnam-high
       sbna_low           = s_sbna-low
       sbna_high          = s_sbna-high
       kzabn_low          = s_kzabn-low
       kzabn_high         = s_kzabn-high
       ebeln_low          = s_ebeln-low
       ebeln_high         = s_ebeln-high
      
     TABLES
       it_result          = it_result
       it_line            = t_esll

     EXCEPTIONS
       formatting_error   = 1
       internal_error     = 2
       send_error         = 3
       user_canceled      = 4
       OTHERS             = 5.
   IF sy-subrc <> 0.
     MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno.
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
   ENDIF.
ENDLOOP.

Former Member
Former Member replied

Hi,

To sort out the single print issue, do the following

First get the no. of record of your IT_RESULT into a variable as,

LV_RECORD = LINES( IT_RESULT ). "-- Here for your scenario,

Now inside your LOOP at IT_RESULT and where you are setting the CONTROL parameters for WHEN 1.

add the extra logic like,

IF LV_RECORD = 1.

     control_parameters-NO_OPEN = 'X'.

ELSE.

     control_parameters-NO_OPEN = ' ' OR space (yours choice).

ENDIF.

Regards,

Syed Hussain

1 View this answer in context
Not what you were looking for? View more on this topic or Ask a question