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: 

problem ARCHIVOBJECT_GET_TABLE

Former Member
0 Kudos

Once I run the function returns the table BINARCHIVOBJECT now I have to attack the contents to an email as I do?

the table to email is li_objhex TYPE TABLE OF solix.

other in the same function SO_NEW_DOCUMENT_ATT_SEND_API1 I've already filled the only problem is the file you load the Archivo link it to me by corrupt when I try to open the attachment.

thk

1 ACCEPTED SOLUTION

jaideepsharma
Active Contributor
0 Kudos

Hi,

Can you please let us know the code where you are populating and converting the binary data and passing it to the function module ?

KR Jaideep,

5 REPLIES 5

jaideepsharma
Active Contributor
0 Kudos

Hi,

Can you please let us know the code where you are populating and converting the binary data and passing it to the function module ?

KR Jaideep,

0 Kudos

CALL FUNCTION 'ARCHIVOBJECT_GET_TABLE'

EXPORTING

ARCHIV_ID = 'ZI'

DOCUMENT_TYPE = 'ZFIPREGFAT'

ARCHIV_DOC_ID = '324890'

TABLES

ARCHIVOBJECT = i_docs

BINARCHIVOBJECT = pdf

.

IF SY-SUBRC <> 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

Edited by: francesco aiello on Sep 9, 2009 11:33 AM

0 Kudos

DATA: par_bin_filesize TYPE i,

par_header TYPE xstring,

par_bytes_transfered TYPE i.

DATA: BEGIN OF hex_record,

myhex(255) TYPE x,

END OF hex_record.

DATA: prc_hex_tab LIKE hex_record OCCURS 1 WITH HEADER LINE.

DATA: prc_curr_dest_offset TYPE i VALUE 0,

prc_src_record_length TYPE i VALUE 0,

prc_src_data_rest TYPE i VALUE 0,

prc_dest_data_rest TYPE i VALUE 0,

prc_dest_record_length TYPE i VALUE 0,

prc_header_length TYPE i VALUE 0,

prc_bin_filesize TYPE i VALUE 0,

prc_new_bytes_transfered TYPE i VALUE 0.

FIELD-SYMBOLS: <f_src> TYPE ANY.

DESCRIBE FIELD pdf LENGTH prc_src_record_length

IN BYTE MODE.

DESCRIBE FIELD prc_hex_tab LENGTH prc_dest_record_length

IN BYTE MODE.

prc_bin_filesize = par_bin_filesize.

  • If length is not given, copy whole table

IF prc_bin_filesize = 0.

DATA: prc_lines TYPE i VALUE 0,

prc_line_len TYPE i VALUE 0.

FIELD-SYMBOLS: <f> TYPE ANY.

DESCRIBE TABLE pdf LINES prc_lines.

LOOP AT pdf ASSIGNING <f>.

DESCRIBE FIELD <f> LENGTH prc_line_len IN BYTE MODE.

EXIT.

ENDLOOP.

prc_bin_filesize = prc_lines * prc_line_len.

ENDIF.

prc_dest_data_rest = prc_dest_record_length.

CLEAR prc_hex_tab.

REFRESH prc_hex_tab.

par_bytes_transfered = 0.

prc_header_length = XSTRLEN( par_header ).

IF prc_header_length > 0.

MOVE par_header TO prc_hex_tab-myhex.

prc_curr_dest_offset = prc_header_length.

prc_dest_data_rest = prc_dest_data_rest - prc_header_length.

prc_bin_filesize = prc_bin_filesize + prc_header_length.

par_bytes_transfered = prc_header_length.

ENDIF.

0 Kudos

DATA: par_bin_filesize TYPE i,

par_header TYPE xstring,

par_bytes_transfered TYPE i.

DATA: BEGIN OF hex_record,

myhex(255) TYPE x,

END OF hex_record.

DATA: prc_hex_tab LIKE hex_record OCCURS 1 WITH HEADER LINE.

DATA: prc_curr_dest_offset TYPE i VALUE 0,

prc_src_record_length TYPE i VALUE 0,

prc_src_data_rest TYPE i VALUE 0,

prc_dest_data_rest TYPE i VALUE 0,

prc_dest_record_length TYPE i VALUE 0,

prc_header_length TYPE i VALUE 0,

prc_bin_filesize TYPE i VALUE 0,

prc_new_bytes_transfered TYPE i VALUE 0.

FIELD-SYMBOLS: <f_src> TYPE ANY.

DESCRIBE FIELD pdf LENGTH prc_src_record_length

IN BYTE MODE.

DESCRIBE FIELD prc_hex_tab LENGTH prc_dest_record_length

IN BYTE MODE.

prc_bin_filesize = par_bin_filesize.

  • If length is not given, copy whole table

IF prc_bin_filesize = 0.

DATA: prc_lines TYPE i VALUE 0,

prc_line_len TYPE i VALUE 0.

FIELD-SYMBOLS: <f> TYPE ANY.

DESCRIBE TABLE pdf LINES prc_lines.

LOOP AT pdf ASSIGNING <f>.

DESCRIBE FIELD <f> LENGTH prc_line_len IN BYTE MODE.

EXIT.

ENDLOOP.

prc_bin_filesize = prc_lines * prc_line_len.

ENDIF.

prc_dest_data_rest = prc_dest_record_length.

CLEAR prc_hex_tab.

REFRESH prc_hex_tab.

par_bytes_transfered = 0.

prc_header_length = XSTRLEN( par_header ).

IF prc_header_length > 0.

MOVE par_header TO prc_hex_tab-myhex.

prc_curr_dest_offset = prc_header_length.

prc_dest_data_rest = prc_dest_data_rest - prc_header_length.

prc_bin_filesize = prc_bin_filesize + prc_header_length.

par_bytes_transfered = prc_header_length.

ENDIF.

0 Kudos

LOOP AT pdf.

  • Check if this line should be transmitted

IF par_bytes_transfered >= prc_bin_filesize.

EXIT.

ENDIF.

ASSIGN pdf TO <f_src> TYPE 'X'.

  • Check if only part this line should be sent

prc_new_bytes_transfered =

par_bytes_transfered + prc_src_record_length.

IF prc_new_bytes_transfered > prc_bin_filesize.

prc_src_data_rest = prc_bin_filesize - par_bytes_transfered.

ELSE.

prc_src_data_rest = prc_src_record_length.

ENDIF.

DO.

  • Check if data from source line fit into current destination line

IF prc_src_data_rest < prc_dest_data_rest.

MOVE <f_src>(prc_src_data_rest)

TO prc_hex_tab-myhex+prc_curr_dest_offset.

par_bytes_transfered =

par_bytes_transfered + prc_src_data_rest.

prc_curr_dest_offset =

prc_curr_dest_offset + prc_src_data_rest.

prc_dest_data_rest =

prc_dest_data_rest - prc_src_data_rest.

prc_src_data_rest = 0.

EXIT.

ELSE.

  • Move all data from source to dest that fit in current dest line

MOVE <f_src>(prc_dest_data_rest)

TO prc_hex_tab-myhex+prc_curr_dest_offset.

par_bytes_transfered =

par_bytes_transfered + prc_dest_data_rest.

  • Get next dest line for the rest of the src data

APPEND prc_hex_tab.

prc_curr_dest_offset = 0.

prc_src_data_rest =

prc_src_data_rest - prc_dest_data_rest.

  • Check if not all source line data have been written, e.g.

  • we had prc_src_data_rest > prc_dest_data_rest

IF prc_src_data_rest > 0.

  • Continue writing rest of source line

ASSIGN <f_src>+prc_dest_data_rest(prc_src_data_rest)

TO <f_src> TYPE 'X'.

prc_dest_data_rest = prc_dest_record_length.

ELSE.

  • Get next source line

prc_dest_data_rest = prc_dest_record_length.

EXIT.

ENDIF.

ENDIF.

ENDDO.

  • Handled one source line, get next

ENDLOOP.

  • Handled pdf.

  • Write last dest line to table.

IF prc_curr_dest_offset > 0.

APPEND prc_hex_tab.

ENDIF.

MOVE prc_hex_tab[] TO objhex[].