04-04-2016 6:31 AM
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.
04-04-2016 6:34 AM
04-04-2016 6:34 AM
04-04-2016 6:43 AM
Hi Vishal,
I have developed same as explain in this link but its not working for single lblni.
Regards,
Aditya
04-04-2016 7:14 AM
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
04-04-2016 7:15 AM
Hi,
Did you debug and check if it is at least calling the smartform.
If not you might see the reason in debugger and if yes you can check the Loop logic in the smartforms again on it_result and/or t_esll.
Hope this helps.
04-04-2016 7:30 AM
04-04-2016 7:41 AM
Hi Aditya,
Use Control_parameters parameter in FM
and before passing it to FM. Fill this entries.
LOOP GT_TABLE.
CONTROL_PARAMETERS-NO_CLOSE = SPACE
CONTROL_PARAMETERS-NO_OPEN = 'X'
At the last record
CONTROL_PARAMETERS-NO_CLOSE = 'X'
CONTROL_PARAMETERS-NO_OPEN = 'SPACE
ENDLOOP.
Hope this may help full.
Regards,
E. Ananthachari.
03-24-2023 6:58 AM
for single
LV_RECORD = LINES( IT_RESULT ).
IF LV_RECORD = 1.
w_cnt2 = sy-tabix .
case w_cnt2.
when 1.
control_parameters-no_open = '' .
control_parameters-no_close = '' .
when w_cnt .
control_parameters-no_open = '' .
control_parameters-no_close = '' .
when others.
control_parameters-no_open = 'X' .
control_parameters-no_close = '' .
endcase.
for multi
else.
1.
w_cnt2 = sy-tabix .
case w_cnt2.
when 1.
control_parameters-no_open = '' .
control_parameters-no_close = 'X' .
when w_cnt .
control_parameters-no_open = 'X' .
control_parameters-no_close = '' .
when others.
control_parameters-no_open = 'X' .
control_parameters-no_close = 'X' .
endcase.