cancel
Showing results for 
Search instead for 
Did you mean: 

Page break in smart forms

Former Member
0 Kudos

Hi All,

I need to generate payslips for multiple employees. Payslips are generated as smart forms. Since i use a GET PERNR event in my selection I am prompted each time for an employee to fill in the Output device by print dialog box.

Kindly guide me in how to generate payslips at one go for all pernrs.

P.S I've called the FM of smart form before END-OF-SELECTION.

Pls reply me asap.

Thanks in advance.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Sakkthiss,

Fill the import parameter OUTPUT_OPTIONS of structure SSFCOMPOP with relevant values and use this parameter as actual parameter to the function module then it wont prompt you for the values as values are already avialable in the actual parameters.

Set TDNOPREV value to 'X' for not to get print preview.

Thanks,

Vinay

Former Member
0 Kudos

Hi Vinay,

Thanks for your prompt reply. But my requirement is that i should get print previews for each PERNRs. But it shud not prompt me to give in the o/p device every time for each PERNR(Asking Once for the 1st PERNR is OK) . Is there any solution to go about this? Am trying with the solution you suggested.

TIA

Answers (8)

Answers (8)

Former Member
0 Kudos

Thank u Experts

Former Member
0 Kudos

Hi All,

Thanks for your help. I have 2 copies of my code that are working fine. Yet a minor problem persists.

@ Arul.

I added those loops as you've said. But i need to press F3 to get my second PERNR's payslip. Also i've called the function module b4 end of selection.

Any suggestions to get rid of this?

TIA.

Former Member
0 Kudos

Hi

Refer this sample code

TABLES:
  spfli.

DATA:
  t_spfli type
    STANDARD TABLE OF spfli.

DATA:
  fs_spfli TYPE spfli.

DATA:
  w_form TYPE  tdsfname,
  w_flag TYPE i,
  f_nam TYPE rs38l_fnam,
  w_input   TYPE ssfcompin,
  w_control TYPE ssfctrlop.

SELECTION-SCREEN BEGIN OF BLOCK blk  WITH FRAME.
SELECT-OPTIONS s_carrid FOR spfli-carrid.
SELECTION-SCREEN END OF BLOCK blk .

SELECTION-SCREEN BEGIN OF BLOCK block1 WITH FRAME.
PARAMETERS:
p_single RADIOBUTTON GROUP rad1,
p_ind    RADIOBUTTON GROUP rad1.
SELECTION-SCREEN END OF BLOCK block1.


START-OF-SELECTION.
  PERFORM display_data.
  PERFORM ssf_function_module_name.
  PERFORM spool_request.
*&---------------------------------------------------------------------*
*&      Form  display_data
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM display_data .
  SELECT *
  FROM spfli
  INTO TABLE t_spfli
  WHERE carrid IN s_carrid.
ENDFORM.                    " display_data
*&---------------------------------------------------------------------*
*&      Form  ssf_function_module_name
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM ssf_function_module_name .
  CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
    EXPORTING
      formname           = '  '
    IMPORTING
      fm_name            = f_nam
    EXCEPTIONS
      no_form            = 1
      no_function_module = 2.
*  IF sy-subrc NE 0.
*    MESSAGE 'Form cannot be displayed' TYPE 'E' .
*  ENDIF.                               " IF sy-subrc eq 0
ENDFORM.                               " ssf_function_module_name
*&---------------------------------------------------------------------*
*&      Form  spool_request
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM spool_request .

w_input-dialog = 'X'.

  CALL FUNCTION 'SSFCOMP_OPEN'
    EXPORTING
      input = w_input
    EXCEPTIONS
      error = 1.
*" LOOP AT t_spfli .....................................................

  LOOP AT t_spfli INTO fs_spfli.
    w_control-no_open   = ' '.
    w_control-no_close  = ' '.
*"Single spool request..................................................
    IF p_single EQ 'X'.
      w_control-no_open   = 'X'.
      w_control-no_close  = 'X'.
    ELSE.
*"Individual spool request.............................................
      IF w_flag NE '1'.
        w_control-no_open  = 'X'.
        w_control-no_close = ' '.
        w_flag = 1.
        CALL FUNCTION ' '
          EXPORTING
           control_parameters          = w_control
            fs_spfli                   = fs_spfli
         EXCEPTIONS
           formatting_error           = 1
           internal_error             = 2
           send_error                 = 3
           user_canceled              = 4.
       endif.                          " IF w_flag ne '1'
      ENDIF.                           " IF p_single eq 'X'.
      CALL FUNCTION '  '
        EXPORTING
          control_parameters = w_control
          fs_spfli           = fs_spfli
        EXCEPTIONS
          formatting_error   = 1
          internal_error     = 2
          send_error         = 3
          user_canceled      = 4.
    ENDLOOP.                             " LOOP at t_spfli into ...

*&--------------------------------------------------------------------*
*&This function module close the spool request                        *
*&--------------------------------------------------------------------*
    CALL FUNCTION 'SSFCOMP_CLOSE'
      EXCEPTIONS
        error = 1.
  ENDFORM.                               " spool_request

Regards,

Sravanthi

Former Member
0 Kudos

Hi Sravanthi,

My code works fine now. But am getting the first page of smart form blank. How to eliminate it from being blank?

Kindly guide me asap.

TIA.

Former Member
0 Kudos

Hi sravanthi,

I now understood that The single spool request was a mere comment. But how to declare and assign value for p_single???

Former Member
0 Kudos

Also kindly lemme know what has to be placed in the place of Single Spool request..Bear with me as am completely new to ABAP.

TIA.

Former Member
0 Kudos

Hi Sravanthi,

Kindly clarify me regarding the loop you have used in this code i.e within which u r assigning the w_control fields.

Does this loop signify the loop at my internal table that i pass to smart form or this loop mus b mentioned in the smart form??

Former Member
0 Kudos

Hi

data:
  w_input   TYPE ssfcompin,
  w_control TYPE ssfctrlop.

w_input-dialog = 'X'.

  CALL FUNCTION 'SSFCOMP_OPEN'
    EXPORTING
      input = w_input
    EXCEPTIONS
      error = 1.
LOOP AT t_spfli INTO fs_spfli.
    w_control-no_open   = ' '.
    w_control-no_close  = ' '.

*"Single spool request..................................................
    IF p_single EQ 'X'.
      w_control-no_open   = 'X'.
      w_control-no_close  = 'X'.


CALL FUNCTION ' '---> smartform function  module
          EXPORTING
           control_parameters          = w_control
            fs_spfli                   = fs_spfli
         EXCEPTIONS
           formatting_error           = 1
           internal_error             = 2
           send_error                 = 3
           user_canceled              = 4.
       endif.                          

CALL FUNCTION 'SSFCOMP_CLOSE'
      EXCEPTIONS
        error = 1.
  ENDFORM.                               " spool_request

Regards,

Sravanthi