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

smartform spool not created

former_member599326
Participant
0 Likes
2,665

Hi

my code is as below.. but spool is not getting generated thru smartforms...

CONSTANTS : C_X TYPE CHAR1 VALUE 'X'.

     DATA : V_PRINT_PARMS TYPE PRI_PARAMS.

     CONSTANTS : LC_PAART LIKE SY-PAART VALUE 'X_65_132',

                 LC_LOCL TYPE SYPDEST VALUE 'LOCL'.

     CALL FUNCTION 'GET_PRINT_PARAMETERS'

       EXPORTING

         AUTHORITY              = SPACE

         IMMEDIATELY            = SPACE

         NEW_LIST_ID            = C_X

         NO_DIALOG              = C_X

         USER                   = SY-UNAME

       IMPORTING

         OUT_PARAMETERS         = V_PRINT_PARMS

       EXCEPTIONS

         ARCHIVE_INFO_NOT_FOUND = 1

         INVALID_PRINT_PARAMS   = 2

         INVALID_ARCHIVE_PARAMS = 3

         OTHERS                 = 4.

     IF V_PRINT_PARMS-PDEST = SPACE.

       V_PRINT_PARMS-PDEST = LC_LOCL.

     ENDIF.

     V_PRINT_PARMS-PAART = LC_PAART.

     NEW-PAGE PRINT ON PARAMETERS V_PRINT_PARMS NO DIALOG.

     CALL FUNCTION M_FM

           EXPORTING

             CONTROL_PARAMETERS = V_PRINT_PARMS

*            OUT_OPTIONS        = OUT_OPTION

*        USER_SETTINGS      = ''

           IMPORTING

             JOB_OUTPUT_INFO    = WA_JOB_OUTPUT_INFO

           EXCEPTIONS

             FORMATTING_ERROR   = 1 " USER_SETTINGS = 'X'

             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.

     NEW-PAGE PRINT OFF.

8 REPLIES 8
Read only

gouravkumar64
Active Contributor
0 Likes
1,611

Hi,

try this

CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'

    EXPORTING

      src_spoolid   = _l_spoolid

      no_dialog     = 'X'

    IMPORTING

      pdf_bytecount = l_size_bytes

    TABLES

      pdf           = lt_lines

    EXCEPTIONS

      OTHERS        = 12.

  CONCATENATE 'c:/' sy-spono '.pdf' INTO l_file_name.

  CALL METHOD cl_gui_frontend_services=>gui_download

    EXPORTING

      bin_filesize = l_size_bytes

      filename     = l_file_name

      filetype     = 'BIN'

    CHANGING

      data_tab     = lt_lines

    EXCEPTIONS

      OTHERS       = 24.

>>

1. Pass CONTROL_PARAMETERS-GETOTF = 'X' to get the OTF data.

2. Get the OTF data in JOB_OUTPUT_INFO-OTFDATA.

3. Convert OTF to PDF using function CONVERT_OTF_2_PDF.

4. Download the PDF.

Gourav

Read only

0 Likes
1,611

actually my requirement is not PDF generation.. i want to create spool..

Read only

Former Member
Read only

dirk_wittenberg
Contributor
0 Likes
1,611

Hi Santosh,

does variable m_fm contain the name of the generated function module for the smartforms form? if yes - ok.

I don't think you need the following line:

NEW-PAGE PRINT ON PARAMETERS V_PRINT_PARMS NO DIALOG.

Comment it and retest.

and when calling function module GET_PRINT_PARAMETERS pass X to IMMEDIATELY.

Read only

0 Likes
1,611

yes variable m_fm contain the name of the generated function module

Read only

0 Likes
1,611

i have changed code as below.. but no spool generated..

CONSTANTS : C_X TYPE CHAR1 VALUE 'X'.

     DATA : V_PRINT_PARMS TYPE PRI_PARAMS.

     CONSTANTS : LC_PAART LIKE SY-PAART VALUE 'X_65_132',

                 LC_LOCL TYPE SYPDEST VALUE 'LOCL'.

     CALL FUNCTION 'GET_PRINT_PARAMETERS'

       EXPORTING

         AUTHORITY              = SPACE

         IMMEDIATELY            = 'X'

         NEW_LIST_ID            = C_X

         NO_DIALOG              = C_X

         USER                   = SY-UNAME

       IMPORTING

         OUT_PARAMETERS         = V_PRINT_PARMS

       EXCEPTIONS

         ARCHIVE_INFO_NOT_FOUND = 1

         INVALID_PRINT_PARAMS   = 2

         INVALID_ARCHIVE_PARAMS = 3

         OTHERS                 = 4.

     IF V_PRINT_PARMS-PDEST = SPACE.

       V_PRINT_PARMS-PDEST = LC_LOCL.

     ENDIF.

     V_PRINT_PARMS-PAART = LC_PAART.

*    NEW-PAGE PRINT ON PARAMETERS V_PRINT_PARMS NO DIALOG.

     CALL FUNCTION M_FM

           EXPORTING

             CONTROL_PARAMETERS = CONTROL_PARAMETER

             OUT_OPTIONS        = OUT_OPTION

*        USER_SETTINGS      = ''

           IMPORTING

             JOB_OUTPUT_INFO    = WA_JOB_OUTPUT_INFO

           EXCEPTIONS

             FORMATTING_ERROR   = 1 " USER_SETTINGS = 'X'

             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.

     NEW-PAGE PRINT OFF.

Read only

Former Member
0 Likes
1,611

Hi Santosh,

Please reffer the below link for the solution.

Post by Benito.

http://www.sapfans.com/forums/viewtopic.php?f=14&t=100960

Regards,

Arun

Read only

Former Member
0 Likes
1,611

Hi,

Can you please refer this link,I thinks it work for you scenario

http://www.sapfans.com/forums/viewtopic.php?f=14&t=100960

Thanks,

Rajesh