11-30-2007 2:41 PM
Hi All,
I am trying to convert the Spool data to PDF and sending it as email. The email has sent sucessfully, but the problem here is the data is getting truncated. But in spool I can see all the fields displayed. Where as in PDF some fields are getting truncated. When I run my spool request using standard program "RSTXPDFT4", I am getting the same problem. Please help me if any one has some idea regarding this.
Here I am sending the code which I am using for this.
*....Convert Spool to PDF
CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
EXPORTING
SRC_SPOOLID = G_SPOOL_NUM
NO_DIALOG = 'X'
DST_DEVICE = G_PDEST
IMPORTING
PDF_BYTECOUNT = NUMBYTES
TABLES
PDF = PDFDATA
EXCEPTIONS
ERR_NO_ABAP_SPOOLJOB = 1
ERR_NO_SPOOLJOB = 2
ERR_NO_PERMISSION = 3
ERR_CONV_NOT_POSSIBLE = 4
ERR_BAD_DESTDEVICE = 5
USER_CANCELLED = 6
ERR_SPOOLERROR = 7
ERR_TEMSEERROR = 8
ERR_BTCJOB_OPEN_FAILED = 9
ERR_BTCJOB_SUBMIT_FAILED = 10
ERR_BTCJOB_CLOSE_FAILED = 11
OTHERS = 12.
LOOP AT PDFDATA.
TRANSLATE PDFDATA USING ' ~'.
CONCATENATE GD_BUFFER PDFDATA INTO GD_BUFFER.
ENDLOOP.
TRANSLATE GD_BUFFER USING '~ '.
DO.
IT_MESS_ATT = GD_BUFFER.
APPEND IT_MESS_ATT.
SHIFT GD_BUFFER LEFT BY 255 PLACES.
IF GD_BUFFER IS INITIAL.
EXIT.
ENDIF.
ENDDO.
Creating the document to be sent
DOC_CHNG-OBJ_NAME = 'IG Balance'.
DOC_CHNG-OBJ_DESCR = 'IG Balance Confirmation Report'.
OBJTXT = 'Thanks & Regards'.
APPEND OBJTXT.
OBJTXT = 'P.K'.
APPEND OBJTXT.
OBJTXT = '+91-9'.
APPEND OBJTXT.
DESCRIBE TABLE OBJTXT LINES TAB_LINES.
READ TABLE OBJTXT INDEX TAB_LINES.
DOC_CHNG-DOC_SIZE = ( TAB_LINES - 1 ) * 2560 + STRLEN( OBJTXT ).
Creating the entry for the compressed document
CLEAR OBJPACK-TRANSF_BIN.
OBJPACK-HEAD_START = 1.
OBJPACK-HEAD_NUM = 0.
OBJPACK-BODY_START = 1.
OBJPACK-BODY_NUM = TAB_LINES.
OBJPACK-DOC_TYPE = 'RAW'.
APPEND OBJPACK.
DESCRIBE TABLE OBJBIN LINES TAB_LINES.
OBJHEAD = 'IG Balace.PDF'. APPEND OBJHEAD.
Creating the entry for the compressed attachment
OBJPACK-TRANSF_BIN = 'X'.
OBJPACK-HEAD_START = 1.
OBJPACK-HEAD_NUM = 1.
OBJPACK-BODY_START = 1.
OBJPACK-BODY_NUM = TAB_LINES.
OBJPACK-DOC_TYPE = 'PDF'.
OBJPACK-OBJ_NAME = 'ATTACHMENT'.
OBJPACK-OBJ_DESCR = 'IG Balance Report'.
OBJPACK-DOC_SIZE = TAB_LINES * 255.
APPEND OBJPACK..
Entering names in the distribution list
RECLIST-RECEIVER = 'p.com'.
RECLIST-REC_TYPE = 'U'.
APPEND RECLIST.
RECLIST-RECEIVER = 'j.com'.
RECLIST-REC_TYPE = 'U'.
APPEND RECLIST.
Sending the document
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
DOCUMENT_DATA = DOC_CHNG
PUT_IN_OUTBOX = 'X'
COMMIT_WORK = 'X'
TABLES
PACKING_LIST = OBJPACK
OBJECT_HEADER = OBJHEAD
CONTENTS_BIN = OBJBIN
CONTENTS_TXT = OBJTXT
RECEIVERS = RECLIST
EXCEPTIONS
TOO_MANY_RECEIVERS = 1
DOCUMENT_NOT_SENT = 2
OPERATION_NO_AUTHORIZATION = 4
OTHERS = 99.
Regards.
JR.
Message was edited by:
Jayant
11-30-2007 2:44 PM
Hi,
after the spool no is created, make a note of it ..
and execute RSTXPDFT4 with the spool no on the selection screen..i think u will be getting the PDF...
Regards,
Karthick.
11-30-2007 2:48 PM
Try this:
CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
EXPORTING
SRC_SPOOLID = G_SPOOL_NUM
NO_DIALOG = ' '
.
.
.
.
Regards,
Amit
12-03-2007 6:28 AM
I am able to generate a PDF,but it gets truncated.
In the place where its expected to display 200 CHARACTERS,
it displays only 85 CHARACTERS.
REST is TRUNCATED.
Any more solutions???
I am looking at a solution to overcome TRUNCATION.........
Helpfule replies will be awarded for sure
Message was edited by:
Jayant