on 07-09-2008 7:14 PM
I have a invoice and if we give specific output type it should convert the form(otf) to pdf and would be able to send to UNix location..
I am using smartform for it.
Where and what should create the code..?
any suggestion would be highly appreciated.
Thanks so much in advance.
just before calling the function module associated to the smart form, set GETOTF parameter as 'X'.
sample code...
DATA : V_SMARTFORM TYPE TDSFNAME.
DATA : V_FMNAME TYPE RS38L_FNAM.
DATA : V_CONTROL TYPE SSFCTRLOP.
DATA : T_OTFDATA TYPE TABLE OF ITCOO,
W_OTFDATA TYPE ITCOO,
W_SFOUTPUT TYPE SSFCRESCL.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
FORMNAME = V_SMARTFORM
IMPORTING
FM_NAME = V_FMNAME
EXCEPTIONS
NO_FORM = 1
NO_FUNCTION_MODULE = 2
OTHERS = 3.
V_CONTROL-NO_DIALOG = 'X'.
V_CONTROL-GETOTF = 'X'.
CLEAR W_SFOUTPUT.
CALL FUNCTION V_FMNAME " '/1BCDWB/SF00000010'
EXPORTING
CONTROL_PARAMETERS = V_CONTROL
CAUFVD = CAUFVD
PPPRCOLORD = PPPRCOLORD
AFPOD = AFPOD
PSFC_HEAD = PSFC_HEAD
TCO09 = TCO09
RE_PRINT = RE_PRINT
TCA09 = TCA09
IMPORTING
JOB_OUTPUT_INFO = W_SFOUTPUT
TABLES
.......
* Read converted OTF Data to internal table.
REFRESH : T_OTFDATA,
PDF_LINES.
LOOP AT W_SFOUTPUT-OTFDATA INTO W_OTFDATA.
APPEND W_OTFDATA TO T_OTFDATA.
ENDLOOP.
* To convert the OTF to PDF.
CALL FUNCTION 'CONVERT_OTF_2_PDF'
IMPORTING
BIN_FILESIZE = FILESIZE
TABLES
OTF = T_OTFDATA
DOCTAB_ARCHIVE = DOCTAB_ARCHIVE
LINES = PDF_LINES
EXCEPTIONS
ERR_CONV_NOT_POSSIBLE = 1
ERR_OTF_MC_NOENDMARKER = 2
OTHERS = 3.
* To save it in an application server directory
IF SY-SUBRC EQ 0.
* derive file name
CALL FUNCTION 'FILE_GET_NAME'
EXPORTING
LOGICAL_FILENAME = OFILE
* PARAMETER_1 = FILE_PARAM
IMPORTING
FILE_NAME = FILE_NAME
EXCEPTIONS
FILE_NOT_FOUND = 01
OTHERS = 99.
CHECK SY-SUBRC IS INITIAL.
OPEN DATASET FILE_NAME IN BINARY MODE FOR OUTPUT.
CHECK SY-SUBRC IS INITIAL.
LOOP AT PDF_LINES.
TRANSFER PDF_LINES TO FILE_NAME.
ENDLOOP.
CLOSE DATASET FILE_NAME.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.