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: 

Download PDF File from Archiv to SAP Application Server

Former Member
0 Kudos

Hi,

I need to download the PDF file from an NAST-Dataset (how is stored from the message via SAP ArchivLink) to the SAP Application Server.

1) At first i read the Archiv-Link data via function module WFMC_GET_ARCHIVE_OBJECT_TYPE

2) Then i get the Connection-Infos via function module ARCHIV_GET_CONNECTIONS_INT

3) Now i read the file from archiv as table via function module ARCHIVOBJECT_GET_BYTES

4) Save to the SAP Appl.Server via:

- OPEN DATASET ld_dpfad FOR OUTPUT IN BINARY MODE

- LOOP and TRANSFER lf_archivobject TO ld_dpfad.

- CLOSE DATASET ld_dpfad.

In the dialog of NAST-Dataset (Messages) i can open the PDF-File without any errors (display originals). But after the filetransfer to the SAP Appl.Server i get the following errors during the file opening dialog from Adobe Acrobat Reader:

- the embedded font u201CArialu201D cant to be extract

- not enough data for the picture

The reader can display the PDF-File but only without the picture (Logo) and with alternative font.

The same transfer from archiv and sending as an attachement to the BOR-Object via function module SO_DOCUMENT_INSERT_API1 works very fine and without any errors.

Can any one please help me to solve this Issue?

Thanks in Advance,

Thomas

5 REPLIES 5

Former Member
0 Kudos

Hello Thomas

In a previous project we used:

1) FUNCTION 'ARCHIVOBJECT_GET_TABLE' - receiving the data as RAW in TABLES parameter binarchivobject, and also importing LENGTH

2) then we used FUNCTION 'SCMS_BINARY_TO_XSTRING' - exporting the RAW variable in TABLES param binary_tab and LENGTH in parameter input_length -- receiving xstring data back in parameter BUFFER.

BUFFER was fed to a Web Dynpro UI Adobe UI element and it displayed fine. I hope this might help you.

0 Kudos

Hello Keith,

many thanks for your answer.

I am tested we XSTRING-way, but the result is not correct. Now i get another errors message while opening with Acrobat Reader:

- the file is corrupt

- during the analyse of the image an error occured

I get the file via email after an ftp-transfer from our SAP-Basis.

After the function module ARCHIVOBJECT_GET_BYTES (Data in table lt_archivobject) follow this coding:

CALL FUNCTION 'SCMS_BINARY_TO_XSTRING'

EXPORTING

input_length = ld_length

IMPORTING

buffer = lf_serverobject

TABLES

binary_tab = lt_archivobject

EXCEPTIONS

failed = 1

OTHERS = 2.

OPEN DATASET ld_dpfad FOR OUTPUT IN BINARY MODE.

IF NOT lf_serverobject IS INITIAL.

TRANSFER lf_serverobject TO ld_dpfad.

endif.

Where is my mistake?

Via transaction AL11 i can see the filedata directly and he looks different, especcially in die STREAM-Section ( is now lesser).

Many thanks.

Thomas

Edited by: Thomas Engler on Apr 23, 2010 1:52 PM

0 Kudos

Hello *,

have any others an idea?

Ciao Thomas

Edited by: Thomas Engler on Apr 26, 2010 9:44 AM

0 Kudos

I can't be sure but your parameter name lt_archivobject suggests you're using the ARCHIVOBJECT parameter out of ARCHIVOBJECT_GET_BYTES - what about trying the BINARCHIVOBJECT parameter? I don't think you want xstring for your Application server file either -- sorry I described the 'SCMS_BINARY_TO_XSTRING' step before - I think that should come out.

0 Kudos

Hello Keith,

Many thanks for your answer.

In the past i didnu2019t need the BINARCHIVOBJECT-Parameter and so i overlook this option.

Now, the File looks a little bit different, but only in the STREAM-section.

During the Fileopen-Dialog i get only one message now - "not enough data for image" and the image will not displayed. The rest seems to be correct.

The relevant coding is now:

ld_doc_typ = pf_connections-reserve.

CALL FUNCTION 'ARCHIVOBJECT_GET_BYTES'

EXPORTING

archiv_id = pf_connections-archiv_id

archiv_doc_id = pf_connections-arc_doc_id

document_type = ld_doc_typ

length = ld_length1

offset = ld_offset

IMPORTING

binlength = ld_length

offset = ld_offset

TABLES

binarchivobject = lt_binarchivobj

EXCEPTIONS

error_archiv = 1

error_communicationtable = 2

error_kernel = 3

OTHERS = 4.

  • Zieldatei zum Schreiben öffnen

OPEN DATASET ld_dpfad FOR OUTPUT IN BINARY MODE.

  • Inhalte in Zieldatei schreiben

LOOP AT lt_binarchivobj INTO lf_binarchivobj.

TRANSFER lf_binarchivobj TO ld_dpfad NO END OF LINE.

ENDLOOP.

  • Zieldatei schließen

CLOSE DATASET ld_dpfad.

Where is the error for the image data?

Ciao Thomas

Push up by: Thomas Engler on May 3, 2010 4:54 PM