cancel
Showing results for 
Search instead for 
Did you mean: 

Attach PDF document from DMS server & print it in existing smartforms back page

0 Kudos

Hi ALL,

I have a requirement like below.

One PDF document is attach in DMS using CV04n.

Now retrieve the PDF file output & print it in a back page of smartforms.

I have already did the code changes for retrieving the PDF. But now I am unable to print or attach the same in smartforms.

Thanks,

Sagnik

Accepted Solutions (0)

Answers (2)

Answers (2)

0 Kudos

Simplified scenario.

I have a PDF document in presentation server, now need to print the PDF contents to a smartforms, as we have already one smartform. Need to print PDF contents to end of the existing smartforms.

I have tried with below code to available the PDF data in to report. Need to break through after that.

* File read

CALL FUNCTION 'SCMS_DOC_READ'

           EXPORTING

             mandt       = sy-mandt

             stor_cat    = ls_file-storage_cat

             doc_id      = ls_file-ph_objid

           TABLES

             access_info = lt_access

             content_bin = lt_sdokcntbin.

         IF lt_sdokcntbin IS NOT INITIAL.

           READ TABLE lt_access INTO ls_access INDEX 1.

* convert to string

           CALL FUNCTION 'SCMS_BINARY_TO_XSTRING'

             EXPORTING

               input_length = ls_access-comp_size

             IMPORTING

               buffer       = lv_xstring

             TABLES

               binary_tab   = lt_sdokcntbin

             EXCEPTIONS

               failed       = 1

               OTHERS       = 2.

           IF sy-subrc EQ 0.

           ENDIF.

         ENDIF.


In the below code lt_sdokcntbin contains the PDF data as binary forms.


Need help after that to print the content to an existing smartforms back page.


Thanks,

Sagnik

Laszlo_B
Active Contributor
0 Kudos

Hello Sagnik,

you can test whether simply giving a duplex command in the SmartForm will print the PDF data at the back page of the SmartForm spool.

Thing is, I don't know whether the physical printer can handle different data streams (e.g.: PostScript datastream of the SmartForm and PDF data stream from DMS), and whether it would start a new paper between the different data streams.

Anyway, if you can test "normal" printout with SmartForms, and it can print duplex correctly, chances are it should print the PDF in the required way too.

If not, I would contact the printer vendor whether they can provide any information what kind of command would be exactly awaited by the physical printer.

Best regards,

Laszlo

0 Kudos

Hi ,

Can you please tell me how to send PDF data to smartform, suppose I have internal table of all PDF contents in hexadecimal format. I will check duplex command in smartform later.

First need to pass PDF content to one smartform( suppose new smartform first page ).

This simplified process will help to understand the issue.

Laszlo_B
Active Contributor
0 Kudos

Hello Sagnik,

perhaps this would be technologically possible but then the R/3 print would create a regular print data with the PDF data in the middle.

This would mean that the printer would either print the unreadable PDF source code or would stop in the middle of printing.

I guess the composed / binary spool would be a better solution.

Best regards,

Laszlo

Laszlo_B
Active Contributor
0 Kudos

Hello Sagnik,

you can test whether you can create and use a "composed spool".

In this "composed spool" you can store the SmartForm spool, then the retrieved PDF as a RAW data.

(Although I am not sure whether duplex printing is possible in this case, or whether the physical printer will be able to "understand" the RAW PDF data stream.)

This SAP Note may give some hints on "composed spool":

SAP Note #1827856 - "Test program for creating composed spool requests".

Best regards,

Laszlo

0 Kudos

Hi Laszlo ,

Thanks for the help.But something is not clear.

I have a PDF file in application server. But now my requirement is to print the PDF file on back of a existing smartforms page.

When I execute RSPO_TEST_CREATE_SPOOL, its showing create binary spool request with printer. When I execute the same then asking for the file & put the file. Then it throws an error

Spool request 23273 contains no ABAP list data'

After that I check with progname RSTXPDFT5 & now download the original PDF contents.

So now my question is how to print this PDF to smartforms.

Because spool no is generated. But unable to print. Please suggest.

Thanks,

Sagnik

Laszlo_B
Active Contributor
0 Kudos

Hello Sagnik,

I could not replicate the issue you have described.

Post screenshots of each step you have used, perhaps something can be seen there.

Best regards,

Laszlo