Application Development 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: 

I need to print multiple document in smartforms in PDF

Former Member
0 Kudos

Hi experts,

I need to print multiple document in smartforms in PDF. User said that preview become in PDF form. Suppose document range are 230000001 to 230000005 then all preview are display in PDF same time and if wish to print then print also.

Please Help.

1 ACCEPTED SOLUTION

basarozgur_kahraman
Contributor
0 Kudos

Hi Raghubansh,

you can use below code to print multiple documents in same spool request. With this method also preview will work.


To convert spool request to PDF you can check this links:

http://wiki.sdn.sap.com/wiki/display/Snippets/Convert+Spool+request+to+PDF+and+send+as+e-mail

http://scn.sap.com/thread/801116


Best Regards


Basar Ozgur


FORM print_label  TABLES   p_it_label TYPE typ_it_label.


  DATA: _it_label TYPE typ_it_label WITH HEADER LINE.

  DATA: _fm_name    TYPE rs38l_fnam,

             _count      TYPE i.

  DATA: _control TYPE ssfctrlop.

  CHECK p_it_label[] IS NOT INITIAL.


  CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'

    EXPORTING

      formname           = 'ZLABEL'

    IMPORTING

      fm_name            = _fm_name

    EXCEPTIONS

      no_form            = 1

      no_function_module = 2

      OTHERS             = 3.


*  _control-no_dialog = 'X'.

*  _control-preview   = 'X'.

  _control-no_open   = 'X'.

  _control-no_close  = 'X'.

  CALL FUNCTION 'SSF_OPEN'

    EXPORTING

*     ARCHIVE_PARAMETERS       =

*     USER_SETTINGS            = 'X'

*     MAIL_SENDER              =

*     MAIL_RECIPIENT           =

*     MAIL_APPL_OBJ            =

*     OUTPUT_OPTIONS           =

      control_parameters       = _control

*   IMPORTING

*     JOB_OUTPUT_OPTIONS       =

    EXCEPTIONS

      formatting_error         = 1

      internal_error           = 2

      send_error               = 3

      user_canceled            = 4

      OTHERS                   = 5.


  LOOP AT p_it_label INTO _it_label.

    APPEND _it_label.

    CALL FUNCTION _fm_name

      EXPORTING

        control_parameters = _control

      TABLES

        it_data            = _it_label

      EXCEPTIONS

        formatting_error   = 1

        internal_error     = 2

        send_error         = 3

        user_canceled      = 4

        OTHERS             = 5.

    REFRESH _it_label.

  ENDLOOP.

  CALL FUNCTION 'SSF_CLOSE'

    EXCEPTIONS

      formatting_error = 1

      internal_error   = 2

      send_error       = 3

      OTHERS           = 4.


ENDFORM.                    " PRINT_LABEL

4 REPLIES 4

sachin_yadav3
Active Participant
0 Kudos

Hi,

You can do this by clearing the parameter SSFCOMPOP-TDNEWID.

Check the structure SSFCOMPOP, you will find something,

Regards

Sachin

Former Member
0 Kudos

please give me the solution...

basarozgur_kahraman
Contributor
0 Kudos

Hi Raghubansh,

you can use below code to print multiple documents in same spool request. With this method also preview will work.


To convert spool request to PDF you can check this links:

http://wiki.sdn.sap.com/wiki/display/Snippets/Convert+Spool+request+to+PDF+and+send+as+e-mail

http://scn.sap.com/thread/801116


Best Regards


Basar Ozgur


FORM print_label  TABLES   p_it_label TYPE typ_it_label.


  DATA: _it_label TYPE typ_it_label WITH HEADER LINE.

  DATA: _fm_name    TYPE rs38l_fnam,

             _count      TYPE i.

  DATA: _control TYPE ssfctrlop.

  CHECK p_it_label[] IS NOT INITIAL.


  CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'

    EXPORTING

      formname           = 'ZLABEL'

    IMPORTING

      fm_name            = _fm_name

    EXCEPTIONS

      no_form            = 1

      no_function_module = 2

      OTHERS             = 3.


*  _control-no_dialog = 'X'.

*  _control-preview   = 'X'.

  _control-no_open   = 'X'.

  _control-no_close  = 'X'.

  CALL FUNCTION 'SSF_OPEN'

    EXPORTING

*     ARCHIVE_PARAMETERS       =

*     USER_SETTINGS            = 'X'

*     MAIL_SENDER              =

*     MAIL_RECIPIENT           =

*     MAIL_APPL_OBJ            =

*     OUTPUT_OPTIONS           =

      control_parameters       = _control

*   IMPORTING

*     JOB_OUTPUT_OPTIONS       =

    EXCEPTIONS

      formatting_error         = 1

      internal_error           = 2

      send_error               = 3

      user_canceled            = 4

      OTHERS                   = 5.


  LOOP AT p_it_label INTO _it_label.

    APPEND _it_label.

    CALL FUNCTION _fm_name

      EXPORTING

        control_parameters = _control

      TABLES

        it_data            = _it_label

      EXCEPTIONS

        formatting_error   = 1

        internal_error     = 2

        send_error         = 3

        user_canceled      = 4

        OTHERS             = 5.

    REFRESH _it_label.

  ENDLOOP.

  CALL FUNCTION 'SSF_CLOSE'

    EXCEPTIONS

      formatting_error = 1

      internal_error   = 2

      send_error       = 3

      OTHERS           = 4.


ENDFORM.                    " PRINT_LABEL

Former Member
0 Kudos

Thank you very much Sir.......