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: 

How to separate pages of document, stored in internal table in BIN format?

former_member699400
Active Participant
0 Kudos
273

Hello All,

I have an archived document, which is stored in internal table in binary format.

This document always has 2 pages and I need to encode these pages in Base64 for including them in PDF form as images.

I would need to separate these pages and process them separately, otherwise including into PDF form does not work.

I am using the following FM for retvrieving the document from archive:

CALL FUNCTION 'SCMS_AO_TABLE_GET'
         
EXPORTING
            mandt        = sy-mandt
            arc_id       = lv_arc_id
            doc_id       = lv_doc_id
            comp_id      =
'data1'
         
IMPORTING
            length       = lv_length
         
TABLES
           
data         = lt_data
         
EXCEPTIONS
            error_http   =
1
            error_archiv =
2
            error_kernel =
3
            error_config =
4
           
OTHERS       = 5.

lt_data " <--- here I get an internal table with 2 pages document in binary format, I need to have both pages in separate internal tables .

Or maybe it is possible to read the archived doccument page by page, not the whole at once as I do?

Any ideas?

Thank you for ideas in advance,

Regards,

Mindaugas

4 REPLIES 4

Former Member
0 Kudos
151

Hi,

If you use F.M SCMS_AO_STATUS it determins components of your document so before using

'SCMS_AO_TABLE_GET' you can seperate the document based on COMPID
         

0 Kudos
151

Hello,

Thank you for the message.

in my case FM SCMS_AO_STATUS gives a table with 2 COMPIDs:

1        data1        image/tiff                781361

2        note        application/x-note        28

In the next step I execute FM SCMS_AO_TABLE_GET with COMPID "data1" ant it gives me

the internal table with document of 2 pages, but I would like to have these pages separately.

It seems FM SCMS_AO_TABLE_GET_BYTES is able to take a part of document, but I doubt if this is helpful, because not clear how many of bytes to take and how to keep structure of file in a correct way, so that file is usable.

Any help is appreciated,

Regards,

Mindaugas

0 Kudos
151

Hi,

this won't be too easy. If this is a multipage tiff, how do you plan to go ahead anyway? I would not know how to put a single-page tiff graphic into pdf format. But TIFF file structure is well-

described.First step will be a TIFF analysis. I did this like 15 or more years ago (not in ABAP), forgot the details.

Download your binary part, take a hex editor, try to find oout to do it manually. If successful, program flow can be implemented in ABAP.

The task will be rather complex as TIFF has been expanded and extended from it's original definition. Check for version, compression techniques.

Check TIFF, Tag Image File Format, FAQ  if you are not already familiar with TIFF.

Regards,

Clemens

0 Kudos
151

Hi,

maybe one of a few options to split the multi page TIFF into separate pages could be done the following way:

1. convert TIFF to OTF

2. split OTF to separate pages (delimiter of pages is // or so)

3. convert OTF to TIFF page by page

These FMs might be helful:

         FM         SX_OBJECT_CONVERT_RAW_TXT

         FM         SX_OBJECT_CONVERT_TXT_INT

         FM         SX_OBJECT_CONVERT_INT_SCR

         FM         SX_OBJECT_CONVERT_SCR_OTF

         FM         SX_OBJECT_CONVERT_OTF_RAW

I did not spend much time on this, but the first step is not succesful,

I send RAW255 table to FM  SX_OBJECT_CONVERT_RAW_TXT,

but conversion fails with sy-subrc = 1

Maybe somebody has experience in using these FMs ?

Thanks,

Regards,

Mindaugas