Skip to Content
avatar image
Former Member

print smart form multiple time with change title

Hello Experts,

i am printing a note that can be printed upto 4 times according to the user input in check buttons on the selection screen.

user need to check the print preview. so I cant omit the dialogue box.

selection screen have 4 check buttons:

1. original

2. transporter

3. seller

4. extra

user can select any combination or all of them. Smart form will be same except the title "Transporter copy"

what i have done is i call FM multiple times from print program according to the condition with a input parameter G_top_text in which i pass the title text required.

But the problem is user need to back from one copy and again face the dialogue this repeats again n again.

can i create the multiple pages in the smart form and can call them according to the user input...... or some thing else...

please suggest..

Thanks in advance

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

4 Answers

  • Best Answer
    avatar image
    Former Member
    Nov 18, 2009 at 09:05 AM

    Hi

    Yes it can......

    U need to consider the system open the dialog as soon as it needs to create a new spool, if you want to print several times the same form in just one SPOOL, u need to open the SPOOL at the first time the sf is called and close it at the last calling.

    Something like this:

    TABLES: SSFCTRLOP.
    
    DATA: Y_SSFCOMPOP TYPE SSFCOMPOP,
          Y_SSFCRESOP TYPE SSFCRESOP.
    
    PARAMETERS: P1 AS CHECKBOX,
                P2 AS CHECKBOX,
                P3 AS CHECKBOX,
                P4 AS CHECKBOX,
                P5 AS CHECKBOX.
    
    
    DATA: COPY(30) TYPE C.
    DATA: VN_COPY  TYPE I.
    DATA: BEGIN OF T_COPY OCCURS 0,
            COPY(2),
          END    OF T_COPY.
    
    START-OF-SELECTION.
    
      PERFORM COUNT_COPY USING: 'P1', 'P2', 'P3', 'P4', 'P5'.
    
      DO VN_COPY TIMES.
    * Open print spool
        IF VN_COPY > 1.
          IF SY-INDEX = 1.
    * The first time: open spool only
            SSFCTRLOP-NO_CLOSE = 'X'.
          ELSE.
    * No dialog
            SSFCTRLOP-NO_DIALOG = 'X'.
            SSFCTRLOP-NO_OPEN   = 'X'.
    * The last time: close spool only
            IF SY-INDEX = VN_COPY.
              CLEAR SSFCTRLOP-NO_CLOSE.
            ENDIF.
          ENDIF.
        ENDIF.
    *
    
        READ TABLE T_COPY INDEX SY-INDEX.
        CASE T_COPY-COPY.
          WHEN 'P1'. COPY = 'COPY 1'.
          WHEN 'P2'. COPY = 'COPY 2'.
          WHEN 'P3'. COPY = 'COPY 3'.
          WHEN 'P4'. COPY = 'COPY 4'.
          WHEN 'P5'. COPY = 'COPY 5'.
        ENDCASE.
    
        CALL FUNCTION '/1BCDWB/SF00000049'
          EXPORTING
            CONTROL_PARAMETERS = SSFCTRLOP
            OUTPUT_OPTIONS     = Y_SSFCOMPOP
            USER_SETTINGS      = 'X'
            COPY               = COPY
          IMPORTING
            JOB_OUTPUT_OPTIONS = Y_SSFCRESOP
          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.
        ELSE.
          MOVE-CORRESPONDING Y_SSFCRESOP TO Y_SSFCOMPOP.
          IF Y_SSFCOMPOP-TDNEWID = 'X'.
            CLEAR Y_SSFCOMPOP-TDNEWID.
          ENDIF.
        ENDIF.
      ENDDO.
    
    FORM COUNT_COPY  USING    P_CHECK.
      FIELD-SYMBOLS: <FS_CHECK> TYPE ANY.
    
      ASSIGN (P_CHECK) TO <FS_CHECK>.
      IF <FS_CHECK> = 'X'.
        VN_COPY = VN_COPY + 1.
        T_COPY-COPY = P_CHECK.
        APPEND T_COPY.
      ENDIF.
    ENDFORM.                    " COUNT_COPY

    Max

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Can you please say me how is that you are passing five parameters to the subroutine and using only one in the subroutine in the above program..

  • Nov 18, 2009 at 08:18 AM

    Hi,

    No need to call smartform multiple times,

    Just create one COPY WINDOW, Inside the copy window create Program lines with the following ex code.

    select the radio button Original and copies "according to your requirement.

    Clear:  text.
    if SFSY-COPYCOUNT = 1.
    Text = 'ORIGINAL FOR BUYER'.
    elseif SFSY-COPYCOUNT = 2.
    Text =  'DUPLICATE FOR TRANSPORTER'.
    elseif SFSY-COPYCOUNT = 3.
    Text = 'TRIPLICATE FOR ASSESSEE'.
    elseif SFSY-COPYCOUNT = 4.
    Text = 'EXTRA'.
    endif.

    And print the text

    Rgds

    Aeda

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Thanks Aeda,

      Aeda yes your idea is good but in my scenario user can select multiple options as well. So i need to print the same page multiple time which is not a prifix no.

  • avatar image
    Former Member
    Nov 18, 2009 at 08:54 AM

    hi

    Check this Link

    http://saptechnical . com/Tutorials/Smartforms/Copies/Window.htm

    Since u have already said u have a Check box then why can't u pass these Checkbox information to the Smartform and print accordingly ur required TITLE and so on..

    Try and let us know if u need any further information

    surya

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Nov 18, 2009 at 08:59 AM

    Hi,

    In the driver program declare a string variable.

    Depending on the selected check box, assign the corresponding value.

    Eg :

    If p_original EQ 'X'.

    w_str = 'Original'.

    endif.

    Then, pass this w_str to the smartform.

    In the smartform text node, display &W_STR& copy.

    Then,it will display the corresponding text.

    Add comment
    10|10000 characters needed characters exceeded