on 08-11-2008 10:38 AM
Is there any function modules in case of smartform with an option of printing from the spool and at the same time it should be able to convert the outputs to pdf format also.
Hi this program will help u
in the call of smartfrom generated function midule we will get spool number generated by the smartform in export parameters of function module jobinfo parameter
&----
*& Report YSMARTFORM_EMAIL
*&
&----
*&
*&
&----
REPORT YSMARTFORM_EMAIL.
TABLES: VBAK.
************************************************************************
Constants *
************************************************************************
CONSTANTS:
C_X TYPE C VALUE 'X', " Value X
C_0 TYPE C VALUE '0', " Value 0
C_1 TYPE C VALUE '1'. " Value 1
************************************************************************
Work Variables declaration *
************************************************************************
DATA:
W_UCOMM LIKE SY-UCOMM, " Function code
W_TABLN TYPE I, " Lines
W_LINE TYPE SO_TEXT255, " Line of text
W_EADDR(60) TYPE C. " FieldLength for Email
DATA: VBAP_TAB LIKE VBAP OCCURS 0 WITH HEADER LINE.
DATA: W_FUNMOD TYPE RS38L_FNAM.
Structure to hold the Attributes of new Document
DATA: FS_DOCDATA TYPE SODOCCHGI1.
Internal table for storing OTF data form Smart-Form
DATA: BEGIN OF FS_OTF_DATA.
INCLUDE STRUCTURE ITCOO.
DATA: END OF FS_OTF_DATA,
T_OTF_DATA LIKE STANDARD TABLE OF FS_OTF_DATA.
Internal table for storing PDF data form Smart-Form
DATA: BEGIN OF FS_PDF_DATA.
INCLUDE STRUCTURE TLINE.
DATA: END OF FS_PDF_DATA,
T_PDF_DATA LIKE STANDARD TABLE OF FS_PDF_DATA.
SELECT SINGLE *
FROM VBAK
WHERE VBELN EQ P_VBELN.
SELECT *
FROM VBAP
INTO TABLE VBAP_TAB
WHERE VBELN EQ P_VBELN.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
FORMNAME = 'YSMARTFORM_EMAIL'
VARIANT = ' '
DIRECT_CALL = ' '
IMPORTING
FM_NAME = W_FUNMOD
EXCEPTIONS
NO_FORM = 1
NO_FUNCTION_MODULE = 2
OTHERS = 3 .
IF SY-SUBRC <> 0.
Do nothing
ENDIF.
DATA: FS_CONT_PARM TYPE SSFCTRLOP,
T_JOB_INFO TYPE SSFCRESCL.
CLEAR FS_CONT_PARM.
FS_CONT_PARM-GETOTF = 'X'.
FS_CONT_PARM-NO_DIALOG = 'X'.
FS_CONT_PARM-PREVIEW = ''.
CALL FUNCTION W_FUNMOD
EXPORTING
ARCHIVE_INDEX =
ARCHIVE_INDEX_TAB =
ARCHIVE_PARAMETERS =
CONTROL_PARAMETERS = FS_CONT_PARM
MAIL_APPL_OBJ =
MAIL_RECIPIENT =
MAIL_SENDER =
OUTPUT_OPTIONS =
USER_SETTINGS = 'X'
VBAK = VBAK
IMPORTING
DOCUMENT_OUTPUT_INFO =
JOB_OUTPUT_INFO = T_JOB_INFO
JOB_OUTPUT_OPTIONS =
TABLES
VBAP = VBAP_TAB
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.
ENDIF.
PERFORM CONVERT_OTF_TO_PDF.
&----
*& Form convert_otf_to_pdf
&----
text
----
--> p1 text
<-- p2 text
----
FORM CONVERT_OTF_TO_PDF .
DATA: LV_BYTES TYPE P.
IF FS_CONT_PARM-GETOTF EQ 'X'.
REFRESH T_OTF_DATA.
CLEAR FS_OTF_DATA.
LOOP AT T_JOB_INFO-OTFDATA INTO FS_OTF_DATA.
APPEND FS_OTF_DATA TO T_OTF_DATA.
CLEAR FS_OTF_DATA.
ENDLOOP. " LOOP AT t_outtab-otfdata
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
FORMAT = 'PDF'
MAX_LINEWIDTH = 255
IMPORTING
BIN_FILESIZE = LV_BYTES
TABLES
OTF = T_OTF_DATA
LINES = T_PDF_DATA
EXCEPTIONS
ERR_MAX_LINEWIDTH = 1
ERR_FORMAT = 2
ERR_CONV_NOT_POSSIBLE = 3
OTHERS = 4.
IF SY-SUBRC EQ 0 AND LV_BYTES IS NOT INITIAL.
PERFORM TABLE_SHIFT.
To send the output by email
PERFORM SET_UP_EMAIL.
PERFORM SEND_MAIL.
ENDIF. " IF sy-subrc EQ space.
ENDIF. " IF gs_control_pars-getotf
ENDFORM. " convert_otf_to_pdf
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
Pass these print parameter when making call to smartform
wa_control_parameters-device = 'PRINTER'.
wa_control_parameters-no_dialog = X.
wa_output_opt-tdimmed = nast-dimme.
wa_output_opt-tddest = nast-ldest.
wa_output_opt-tdnewid = X.
wa_control_parameters-preview = space.
wa_output_opt-tdnoprev = X.
Set print immediately in SU3. Call smartform separately passing print parameters for immediate print and Call smartform separately for getting OTF data and cover to PDF. In nace define the printer setting and give option print immediately. While calling the dynamic FM for smartform, then pass USER_SETTING as space this will take the printer defined in NACE settings otherwise will consider printer defined in SU3.
BRB
Lavanya
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.