Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

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

Former Member
0 Kudos

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

4 REPLIES 4

Former Member
0 Kudos

throw some light on this issue plz

0 Kudos

Hello,

Can you explain the problem in detail plz.

I do see that the logic which was proposed is implemented in code.

please check at various places, in run time the following points:

1. Spool ID exported into ABAP Memory.

2. Contents of the Main OTF IntTab.

3. Conversion of the Spool to PFD.Check whether SUBRC = 0. <b>Un-comment all the Exceptions in your FMs where-ever you make a call in your program.</b>

If this conversion of Spool to PDF is successful, you can choose "Append" option from the popup.

Hope this helps you. Or if you have any specific query let me know.

Regards, Murugesh AS

0 Kudos

Dear Murugesh

This function doesnt prompt for appending the o/p

CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'

plz suggest some thing.

thnx

moni

0 Kudos

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