Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Multiple smartform

DurgeshPandey
Explorer
0 Likes
4,546

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.

1 ACCEPTED SOLUTION
Read only

Hvshal4u
Active Participant
0 Likes
2,426

Hi below link may be useful to you.

Regards,

Vishal

7 REPLIES 7
Read only

Hvshal4u
Active Participant
0 Likes
2,427

Hi below link may be useful to you.

Regards,

Vishal

Read only

0 Likes
2,426

Hi Vishal,

I have developed same as explain in this link but its not working for single lblni.

Regards,

Aditya

Read only

Former Member
0 Likes
2,426

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

Read only

Former Member
0 Likes
2,426

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.

Read only

0 Likes
2,426

Thanks Syed Hussain.

Read only

Former Member
0 Likes
2,426

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.

Read only

suraj9051
Explorer
0 Likes
2,426

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.