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: 

'ARCHIVOBJECT_GET_TABLE' attach and send TIFF images as email

vsubbakrishna
Participant
0 Kudos
1,772

Hi all,

I am having problem in converting from type TBL1024 to type solix_tab(for emailing purposes).

Need some guidance on how we can do this conversion or once we call 'ARCHIVOBJECT_GET_TABLE' can we use any other Function module to attach and send as 'TIFF' image files.

REPORT Z_ARCH_SEND .

DATA: send_request TYPE REF TO cl_bcs.

DATA: text TYPE bcsy_text.

data: binary_content1 type STANDARD TABLE OF TBL1024 WITH HEADER LINE.

data: binary_content type solix_tab.

DATA: document TYPE REF TO cl_document_bcs.

DATA: sender TYPE REF TO cl_sapuser_bcs.

DATA: recipient TYPE REF TO if_recipient_bcs.

DATA: bcs_exception type ref to cx_bcs.

data: sent_to_all type os_boolean.

DATA: ARCHIVOBJECT TYPE STANDARD TABLE OF DOCS WITH HEADER LINE,

LENGTH LIKE SAPB-LENGTH,

BINLENGTH LIKE SAPB-LENGTH.

START-OF-SELECTION.

CALL FUNCTION 'ARCHIVOBJECT_GET_TABLE'

EXPORTING archiv_id = 'T1'

document_type = 'PDF'

archiv_doc_id = '2794762'

*ALL_COMPONENTS =

SIGNATURE = 'X'

*COMPID = 'DATA'

IMPORTING LENGTH = LENGTH

BINLENGTH = BINLENGTH

TABLES ARCHIVOBJECT = ARCHIVOBJECT

BINARCHIVOBJECT = binary_content1

EXCEPTIONS ERROR_ARCHIV = 1

ERROR_COMMUNICATIONTABLE = 2

ERROR_KERNEL = 3

OTHERS = 4.

binary_content[] = binary_content1[].

PERFORM main.

FORM main.

try.

send_request = cl_bcs=>create_persistent( ).

  • -------- create and set document with attachment ---------------

  • create document from internal table with text

APPEND 'Hello world!' TO text.

document = cl_document_bcs=>create_document( i_type = 'RAW' i_text =

text i_length = '12' i_subject = 'test created ' ).

  • add attachment to document

  • BCS expects document content here e.g. from document upload

  • binary_content = ...

CALL METHOD document->add_attachment EXPORTING i_attachment_type = 'GIF'

i_attachment_subject = 'My attachment' i_att_content_hex =

binary_content.

  • add document to send request

CALL METHOD send_request->set_document( document ).

sender = cl_sapuser_bcs=>create( sy-uname ).

CALL METHOD send_request->set_sender EXPORTING i_sender = sender.

recipient =

cl_cam_address_bcs=>create_internet_address( ' ' )

CALL METHOD send_request->add_recipient

EXPORTING i_recipient = recipient

i_express = 'X'.

CALL METHOD send_request->set_send_immediately( 'X' ).

CALL METHOD send_request->send( exporting i_with_error_screen = 'X'

receiving result = sent_to_all ).

COMMIT WORK.endform.

8 REPLIES 8

vsubbakrishna
Participant
0 Kudos
299

solved on own.

0 Kudos
299

Hi,

Can you please let me know how did u solve this.

I have similar requirement.

Regards

Saroj

0 Kudos
299

solved

0 Kudos
299

You can use the following to do this.

Below compress/decompress function modules convert the binary data from lt_bin (structure TBL1024) to target_tab (structure SOLIX). From Raw 1024 to Raw 255

DATA: aux_tab LIKE soli OCCURS 10. - temp table

  • Compress table

CALL FUNCTION 'TABLE_COMPRESS'

TABLES

in = lt_bin

out = aux_tab

EXCEPTIONS

compress_error = 1

OTHERS = 2.

  • Decompress table

CALL FUNCTION 'TABLE_DECOMPRESS'

TABLES

in = aux_tab

out = target_tab

EXCEPTIONS

compress_error = 1

table_not_compressed = 2

OTHERS = 3.

Regards,

Gokul

0 Kudos
299

Hello Gokul,

thank you very much for posting the solution. Your post saved my day 😃

Best regards,

Dominik

0 Kudos
299

How could you send the fax by GIF with PDF binary interna table data? Thanks a lot! Currently i am facing the same issue.

Former Member
299

Hello,

I have done this and it's work fine:

      DATA:

            lv_lengt            TYPE sapb-length,

            lv_binlength        TYPE sapb-length,

            lt_archivobject     TYPE TABLE OF docs,

            lt_binarchivobject  TYPE TABLE OF tbl1024.

      REFRESH: lt_archivobject,

               lt_binarchivobject.

      CLEAR: lv_lengt,

             lv_binlength.

      CALL FUNCTION 'ARCHIVOBJECT_GET_TABLE'

        EXPORTING

          archiv_id                = 'DA'

          document_type       = 'PDF'

          archiv_doc_id         = '54744A9E4E3738A2E1000000AC18F95D'

          all_components       = space

          signature                = space

          compid                   = space

        IMPORTING

          length                     = lv_lengt

          binlength                 = lv_binlength

        TABLES

          archivobject             = lt_archivobject

          binarchivobject          = lt_binarchivobject

        EXCEPTIONS

          error_archiv             = 1

          error_communicationtable = 2

          error_kernel             = 3

          OTHERS                = 4.

      IF sy-subrc NE 0.

        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

      ENDIF.

      IF lt_binarchivobject[] IS NOT INITIAL.

        REFRESH lt_binary_data.

        CALL METHOD cl_rmps_general_functions=>convert_1024_to_255

          EXPORTING

            im_tab_1024 = lt_binarchivobject[]

          RECEIVING

            re_tab_255  = lt_binary_data[].

      ENDIF.

Regards.

0 Kudos
299

CALL METHOD cl_rmps_general_functions=>convert_1024_to_255 this method saved my life, Thank you very much