2012 Aug 07 12:13 PM
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.
2012 Aug 07 12:38 PM
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
2012 Aug 07 12:47 PM
actually my requirement is not PDF generation.. i want to create spool..
2012 Aug 07 12:55 PM
2012 Aug 07 12:56 PM
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.
2012 Aug 07 12:59 PM
yes variable m_fm contain the name of the generated function module
2012 Aug 07 1:02 PM
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.
2012 Aug 07 1:24 PM
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
2012 Aug 07 1:29 PM
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