2009 May 26 10:20 AM
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.
2009 Jun 06 4:16 PM
2010 Jul 14 3:09 PM
Hi,
Can you please let me know how did u solve this.
I have similar requirement.
Regards
Saroj
2011 Sep 06 9:13 AM
2011 Nov 16 2:51 AM
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
2014 Sep 17 6:32 AM
Hello Gokul,
thank you very much for posting the solution. Your post saved my day 😃
Best regards,
Dominik
2012 Jan 21 3:59 AM
How could you send the fax by GIF with PDF binary interna table data? Thanks a lot! Currently i am facing the same issue.
2014 Dec 02 11:42 AM
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.
2021 Mar 16 1:16 PM
CALL METHOD cl_rmps_general_functions=>convert_1024_to_255 this method saved my life, Thank you very much