Skip to Content
author's profile photo
Former Member

Smartforms: Appending Spool o/p(report) to PDF generated by SSF

Dear Murugesh

I have attached the code for Appending Spool o/p(report) to PDF generated by SSF below

Please suggest as i will have 2 finish by this SAT.

(Hint : Under 1 SOrdr there may be several line items==>

The material with ref 2 every line-item either may be configurable(ZPL3) or nonconfigurable(ZA3C)) .

*ENCLOSER TO PACKING LIST

SELECT VBELN POSNR INTO CORRESPONDING FIELDS OF TABLE T_VBAP

FROM VBAP

WHERE VBELN = SSORD.

*For capturing the o/p pages from ZPL3 and consolidating into table

*T_OTF to get single PDF

LOOP AT T_VBAP INTO T_VBAP.

ITNO = T_VBAP-POSNR.

SELECT SINGLE * FROM ZPP_PLCMH WHERE VBELN = SSORD

AND POSNR = ITNO.

IF SY-SUBRC EQ 0.

SET PARAMETER ID: 'AUN' FIELD SSORD ,

'APO' FIELD ITNO.

CALL TRANSACTION 'ZPCE' AND SKIP FIRST SCREEN.

IMPORT A = T_OTF2 FROM MEMORY ID 'MEMID'.

LOOP AT T_OTF2 INTO T_OTF2.

APPEND T_OTF2 TO T_OTF.

ENDLOOP.

REFRESH T_OTF2.

ELSE.

*For capturing the o/p pages from ZA3C and Appending

*at the end of the PDF file just created by the above code

SELECT SINGLE * FROM ZPLH WHERE VBELN = SSORD

AND POSNR = ITNO.

IF SY-SUBRC EQ 0.

SET PARAMETER ID: 'AUN' FIELD SSORD,

: 'APO' FIELD ITNO.

CALL TRANSACTION 'ZPNE' AND SKIP FIRST SCREEN.

IMPORT B = SPOOL_ID FROM MEMORY ID 'MEMID2'.

CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'

EXPORTING

SRC_SPOOLID = SPOOL_ID

NO_DIALOG = ''

DST_DEVICE = E_DEVTYPE

  • PDF_DESTINATION = 'LOHP'

IMPORTING

PDF_BYTECOUNT = BTC

  • PDF_SPOOLID =

  • LIST_PAGECOUNT =

  • BTC_JOBNAME =

  • BTC_JOBCOUNT =

TABLES

PDF = T_SPOOL_2_PDF

  • 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

.

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

ELSE.

TEXT02 = ITNO.

MESSAGE I014(ZQOTBANK) WITH TEXT02.

ENDIF.

ENDIF.

ENDLOOP.

CALL FUNCTION 'CONVERT_OTF_2_PDF'

EXPORTING

USE_OTF_MC_CMD = 'X'

  • ARCHIVE_INDEX =

IMPORTING

BIN_FILESIZE = BIN_FILESIZE

TABLES

OTF = T_OTF

DOCTAB_ARCHIVE = T_DOC

LINES = T_LINES

EXCEPTIONS

ERR_CONV_NOT_POSSIBLE = 1

ERR_OTF_MC_NOENDMARKER = 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 'GUI_DOWNLOAD'

EXPORTING

BIN_FILESIZE = BIN_FILESIZE

FILENAME = 'C:\SD6.pdf'

FILETYPE = 'BIN'

APPEND = 'X'

  • WRITE_FIELD_SEPARATOR = ' '

  • HEADER = '00'

  • TRUNC_TRAILING_BLANKS = ' '

  • WRITE_LF = 'X'

  • COL_SELECT = ' '

  • COL_SELECT_MASK = ' '

  • DAT_MODE = ' '

  • CONFIRM_OVERWRITE = ' '

  • NO_AUTH_CHECK = ' '

  • CODEPAGE = ' '

  • IGNORE_CERR = ABAP_TRUE

  • REPLACEMENT = '#'

  • WRITE_BOM = ' '

  • TRUNC_TRAILING_BLANKS_EOL = 'X'

IMPORTING

FILELENGTH = BIN_FILESIZE

TABLES

DATA_TAB = T_LINES

  • FIELDNAMES =

  • EXCEPTIONS

  • FILE_WRITE_ERROR = 1

  • NO_BATCH = 2

  • GUI_REFUSE_FILETRANSFER = 3

  • INVALID_TYPE = 4

  • NO_AUTHORITY = 5

  • UNKNOWN_ERROR = 6

  • HEADER_NOT_ALLOWED = 7

  • SEPARATOR_NOT_ALLOWED = 8

  • FILESIZE_NOT_ALLOWED = 9

  • HEADER_TOO_LONG = 10

  • DP_ERROR_CREATE = 11

  • DP_ERROR_SEND = 12

  • DP_ERROR_WRITE = 13

  • UNKNOWN_DP_ERROR = 14

  • ACCESS_DENIED = 15

  • DP_OUT_OF_MEMORY = 16

  • DISK_FULL = 17

  • DP_TIMEOUT = 18

  • FILE_NOT_FOUND = 19

  • DATAPROVIDER_EXCEPTION = 20

  • CONTROL_FLUSH_ERROR = 21

  • OTHERS = 22

.

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

Thanx

Moni

Message was edited by: md monirujjaman

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

1 Answer

  • author's profile photo
    Former Member
    Posted on Feb 24, 2005 at 03:18 AM

    throw some light on this issue plz

    Add comment
    10|10000 characters needed characters exceeded

    • Hello,

      check the Prg: RSTXPDFT4. The same FM is used here which gives a popup seeking the File name. If the file already exists it go to a second step asking you to replace or append to the existing file.

      Regards, Murugesh AS