09-20-2007 5:42 AM
hi all
i have made a smartform
now i m able to print it and can also c its print preview
now i want to change it into pdf
can somebody help
well i want all three options
1. print directly
2. print preview
3. pdf format
help me points wil b rewarded
thanx
09-20-2007 5:45 AM
Refer the following link for more details:
http://www.sapdevelopment.co.uk/reporting/rep_spooltopdf.htm
09-20-2007 5:44 AM
this is the code of my report
REPORT zmftest2.
tables: mseg, qamb, mkpf.
data : begin of itab occurs 0,
MBLNR LIKE MSEG-MBLNR,
ZEILE LIKE MSEG-ZEILE,
UOM LIKE MSEG-MEINS,
MATNR LIKE MSEG-MATNR,
RECQTY LIKE MSEG-MENGE,
QCINS like mseg-insmk,
ACCQTY LIKE MSEG-MENGE,
REJQTY LIKE MSEG-MENGE,
END OF ITAB.
DATA : BEGIN OF ITAB1 OCCURS 0,
MBLNR LIKE MSEG-MBLNR,
ZEILE LIKE MSEG-ZEILE,
MJAHR LIKE MSEG-MJAHR,
END OF ITAB1.
DATA: V_FORM_NAME TYPE rs38l_fnam.
DATA: V_WERKS LIKE MSEG-WERKS.
SELECTION-SCREEN BEGIN OF BLOCK BG1 WITH FRAME.
PARAMETERS : PLANT LIKE MSEG-WERKS DEFAULT 'MFPL' OBLIGATORY.
PARAMETERS : GRNO LIKE MSEG-MBLNR OBLIGATORY.
PARAMETERS: YEAR LIKE MSEG-MJAHR DEFAULT '2007' OBLIGATORY.
SELECTION-SCREEN END OF BLOCK BG1.
MOVE PLANT TO V_WERKS.
*SELECT MBLNR ZEILE MEINS MATNR MENGE INSMK FROM MSEG
*INTO TABLE ITAB
*WHERE WERKS = PLANT AND MBLNR = GRNO AND BWART = '101' AND MJAHR = YEAR.
SELECT A~MBLNR ZEILE MEINS MATNR MENGE INSMK
FROM MSEG as A INNER JOIN MKPF AS B ON AMBLNR = BMBLNR AND AMJAHR = BMJAHR
INTO TABLE ITAB
WHERE AWERKS = PLANT AND AMBLNR = GRNO AND BWART = '101' AND A~MJAHR = YEAR
AND B~TCODE2 = 'MIGO_GR'.
******************cheking if no recods found**************************
*if sy-subrc <> 0.
message E011(zmsgk).
*endif.
******************************************************************
DATA : V_QCIDOC LIKE QAMB-PRUEFLOS,
V_QCDOC LIKE MSEG-MBLNR,
V_QCDOC1 LIKE MSEG-ZEILE,
V_QTY LIKE MSEG-MENGE,
V_BWART LIKE MSEG-BWART,
V_GRCOMP TYPE C,
QCQTY LIKE MSEG-MENGE,
AA TYPE C.
V_GRCOMP = 'Y'.
LOOP AT ITAB.
IF ITAB-QCINS = 'X'.
v_qcidoc = ''.
SELECT SINGLE PRUEFLOS
FROM QAMB INTO V_QCIDOC
WHERE MBLNR = ITAB-MBLNR AND ZEILE = ITAB-ZEILE.
CLEAR ITAB1.
REFRESH ITAB1.
SELECT MBLNR ZEILE MJAHR
FROM QAMB
INTO TABLE ITAB1
WHERE PRUEFLOS = V_QCIDOC AND MBLNR <> ITAB-MBLNR.
LOOP AT ITAB1.
V_QTY = 0.
SELECT BWART MENGE
INTO (V_BWART, V_QTY)
FROM MSEG WHERE MBLNR = ITAB1-MBLNR AND ZEILE = ITAB-ZEILE AND XAUTO <> 'X'.
FROM MSEG WHERE MBLNR = ITAB1-MBLNR AND ZEILE = ITAB1-ZEILE AND XAUTO <> 'X' AND MJAHR = ITAB1-MJAHR.
ENDSELECT.
IF V_BWART = 321.
ITAB-ACCQTY = V_QTY.
ELSEIF V_BWART = '122'.
ITAB-REJQTY = V_QTY.
ENDIF.
MODIFY ITAB.
ENDLOOP.
ENDIF.
QCQTY = ITAB-ACCQTY + ITAB-REJQTY.
IF ITAB-RECQTY <> QCQTY. "THIS CONDITIONS DOES NOT CALL THE SMARTFORM FOR THOSE RECORDS WHICH HAVE NOT INSPECTED
IF ITAB-RECQTY <> QCQTY AND ITAB-QCINS = 'X'. "THIS CONDITION CALLS THE SMARTFROM FOR THE RECORDS THAT HAVE BEEN INSPECTED
V_GRCOMP = 'N'.
ENDIF.
ENDLOOP.
IF V_GRCOMP = 'N'.
message E011(zmsgk).
ENDIF.
*write: / 'MAT DOC NO ZEILE UOM ITEM ID INSPECTION TOTAL QTY ACCPT QTY REJCT QTY'.
*
*LOOP AT ITAB.
WRITE : / ITAB-MBLNR, ' ' , ITAB-ZEILE, ' ', ITAB-UOM, ' ', ITAB-MATNR, ' ', ITAB-QCINS,' ', ITAB-RECQTY, ' ', ITAB-ACCQTY, ' ', ITAB-REJQTY.
*ENDLOOP.
************************************************CALLING SMARTFORM**************************************************
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
FORMNAME = 'ZDEMO_FORM'
IMPORTING
FM_NAME = V_FORM_NAME
EXCEPTIONS
NO_FORM = 1
NO_FUNCTION_MODULE = 2
OTHERS = 3.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION V_FORM_NAME
EXPORTING
V_WERKS = V_WERKS
TABLES
ITAB = ITAB
EXCEPTIONS
FORMATTING_ERROR = 1
INTERNAL_ERROR = 2
SEND_ERRO = 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.
*********************************************SMARTFORM ENDS HERE*******************************
09-20-2007 5:45 AM
Refer the following link for more details:
http://www.sapdevelopment.co.uk/reporting/rep_spooltopdf.htm
09-20-2007 5:45 AM
Hi Fresher,
Please Refer this,
https://forums.sdn.sap.com/click.jspa?searchID=5369529&messageID=3814804
Thanks,
Reward If Helpful.
09-20-2007 6:23 AM
both links are very helpful
can u tell me how to send smartform to email?
09-20-2007 6:33 AM
U need to set a new MEDIUM for MAIL in PO message.
I believe it should be 5, but you should check in your print routine if the system set MAIIL as device when MEDIUM is 5.
I believe the system'll set MAIL if all configuration of your system is ok, so:
- The user has to have the mail address in SU01;
- The vendor has to have the mail address in master data;
- The SCOT trx has to be active.
If all is ok the system'll place the mail in the SCOT, so you'll need to send really the mail by SCOT.
order to send PO, your Basis team must configure the system first so that external email can be send out from SAP. If it is not configured, no settings you do on MM will work.
1. You must maintain email address in vendor master data.
2. The same applies to your user master data. For the output type for default values, a communication strategy needs
to be maintained in the Customizing that supports the e-mail. You can find the definition of the communication strategy in the
Customizing via the following path:
(SPRO -> IMG -> SAP Web Application Server -> Basic Services -> Message Control -> Define Communication Strategy).
As a default, communication strategy CS01 is delivered. This already contains the necessary entry for the external communication. Bear in mind that without a suitable communication strategy it is not possible to communicate with a partner via Medium 5 (external sending).
3. Use the standard SAP environment (program 'SAPFM06P', FORM routine 'ENTRY_NEU' and form 'MEDRUCK') as the processing routines.
4. In the condition records for the output type (for example, Transaction MN04), use medium '5' (External send).
5. You can use Transaction SCOT to trigger the output manually. The prerequisite for a correct sending is that the node is set correctly. This is not described here, but it must have already been carried out.
6. To be able to display, for example, the e-mail in Outlook, enter PDF as the format in the node.
regards,
Prabhu
reward if it is helpful.
09-20-2007 5:58 AM
incase of Pdf
catch your spool request number and make your own tCode for standard program RSTXPDFT4
u will b able to get spool request number from TSP01 table .
now you want a direct printout then attach this code
this code will directly fire the print .
DATA : X_OUTPUT_OPTIONS TYPE SSFCOMPOP,
X_CONTROL_PARAMETERS type SSFCTRLOP.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
FORMNAME = 'ZABC'
IMPORTING
FM_NAME = FM_NAME
EXCEPTIONS
NO_FORM = 1
NO_FUNCTION_MODULE = 2
OTHERS = 3
.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
X_CONTROL_PARAMETERS-no_dialog = 'X' .
CALL FUNCTION FM_NAME
EXPORTING
ARCHIVE_INDEX =
ARCHIVE_INDEX_TAB =
ARCHIVE_PARAMETERS =
CONTROL_PARAMETERS = X_CONTROL_PARAMETERS
MAIL_APPL_OBJ =
MAIL_RECIPIENT =
MAIL_SENDER =
OUTPUT_OPTIONS = X_OUTPUT_OPTIONS
USER_SETTINGS = 'X'
IMPORTING
DOCUMENT_OUTPUT_INFO =
JOB_OUTPUT_INFO =
JOB_OUTPUT_OPTIONS =
***V_C = w_c
TABLES
IT_YPIMT_PBP_INV = itab
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.
09-20-2007 6:01 AM
Its very simple.
Just execute the smartform and give print.
A spool request will be automatically created.
Go to the transaction <b>SPAD</b> and see the spool request number.
Then Execute the program <b>RSTXPDFT4</b> and give the path where u need to store that PDF File.
Hence ur PDF File will be created.
Please reward points if useful.