09-07-2009 3:53 PM
Can you tell me the function to get a file from a ArchiveLink, I found only one feature that makes you view the file Meserve for us in other things and not watch
09-07-2009 4:09 PM
09-07-2009 4:09 PM
09-07-2009 4:22 PM
I take a file based on certain controls ie attach it to an email only geese I have no idea how to remove an individual file!
09-07-2009 4:38 PM
09-08-2009 8:37 AM
09-08-2009 8:47 AM
Hi,
You can use function module ARCHIVOBJECT_GET_TABLE to fetch the file from archive server.
KR Jaideep,
09-08-2009 9:02 AM
this function that I come back? I simulated in se37 and returns a kind of binary code!!!
09-08-2009 9:19 AM
Hi,
Yes it returns binary code.
You can use the code below to convert it into desired format.
*---Local Variables declaration
DATA: lv_temp TYPE i,
lv_last TYPE i,
lv_toa01 TYPE toa01,
lv_lines TYPE i,
lv_offset TYPE i,
lv_buffer TYPE xstring,
lv_bus2081 TYPE toa01-sap_object VALUE 'BUS2081',
lv_binlength TYPE sapb-length,
lv_object_id TYPE toa01-object_id,
lv_archiv_id TYPE toa01-archiv_id,
lv_ar_status TYPE toaom-ar_status VALUE 'X',
lv_arc_object TYPE toa01-ar_object VALUE 'ZMMILOGINV',
lv_doc_type_pdf TYPE toaom-doc_type VALUE 'PDF',
*---Local Work Area declaration
lwa_binarchivobject TYPE tbl1024,
*---Local Internal Table declaration
li_binarchivobject TYPE TABLE OF tbl1024.
CONCATENATE wa_rbkp-belnr wa_rbkp-gjahr INTO lv_object_id.
CONDENSE lv_object_id.
*---Get content rep id
SELECT SINGLE archiv_id FROM toaom INTO lv_archiv_id
WHERE sap_object = lv_bus2081
AND ar_object = lv_arc_object
AND ar_status = lv_ar_status.
IF sy-subrc NE 0. EXIT. ENDIF.
*---Get connection info from link table
SELECT SINGLE *
FROM toa01
INTO lv_toa01
WHERE sap_object = lv_bus2081
AND object_id = lv_object_id
AND archiv_id = lv_archiv_id .
*---Populate the buffer string.
LOOP AT li_binarchivobject INTO lwa_binarchivobject.
CONCATENATE lv_buffer lwa_binarchivobject-line
INTO lv_buffer IN BYTE MODE .
ENDLOOP.
09-08-2009 9:19 AM
*---Find the number of lines buffer string.
lv_last = XSTRLEN( lv_buffer ) MOD 255.
lv_lines = XSTRLEN( lv_buffer ).
lv_lines = lv_lines / 255.
DO lv_lines TIMES.
*---Check after adding 255 to the offset if length becomes more than
*---total length then don't add 255 instead add lv_last.
lv_temp = lv_offset + 255.
IF lv_temp GE lv_binlength.
lwa_objhex-line = lv_buffer+lv_offset(lv_last).
APPEND lwa_objhex TO li_objhex.
ELSE.
lwa_objhex-line = lv_buffer+lv_offset(255).
APPEND lwa_objhex TO li_objhex.
lv_offset = lv_offset + 255.
ENDIF.
ENDDO.
*---Populate Packing internal table from relevant information required
*---to send the attachment.
CLEAR lv_temp.
DESCRIBE TABLE li_objhex LINES lv_temp.
READ TABLE li_objcont INTO lwa_objcont INDEX lv_temp.
CLEAR lwa_objpack.
lwa_objpack-head_start = c_1.
lwa_objpack-head_num = c_0.
lwa_objpack-body_start = c_1.
lwa_objpack-body_num = lv_temp.
lwa_objpack-doc_type = c_raw.
APPEND lwa_objpack TO li_objpack.
CLEAR lwa_objpack.
CLEAR lwa_objpack-transf_bin.
lwa_objpack-transf_bin = c_x.
lwa_objpack-head_start = c_1.
lwa_objpack-head_num = c_1.
lwa_objpack-body_start = c_1.
lwa_objpack-body_num = lv_temp.
lwa_objpack-obj_name = c_invoice.
CONCATENATE c_invoice wa_rbkp-belnr
INTO lwa_objpack-obj_descr
SEPARATED BY space.
lwa_objpack-doc_size = lv_temp * 255.
APPEND lwa_objpack TO li_objpack.
CLEAR: lwa_objpack.
ENDIF. "IF sy-subrc <> 0.
ENDIF."IF sy-subrc <> 0.
*---Find the document type in which the image was stored in the archieve
*---server.
CASE lv_toa01-reserve.
WHEN c_fax.
doc_type = c_tif.
lwa_objpack-doc_type = c_fax.
WHEN c_pdf.
doc_type = c_pdf.
lwa_objpack-doc_type = c_pdf.
ENDCASE.
Modify it as per your requirement.
KR Jaideep,
09-08-2009 9:30 AM
there is no way to get the names of the file so you just select the desired?
09-08-2009 9:38 AM
09-08-2009 9:48 AM
how they should be declared
lwa_objhex
li_objpack
Edited by: francesco aiello on Sep 8, 2009 10:49 AM
09-08-2009 9:53 AM
Hi,
Declare them as
data: lwa_objhex TYPE solix,
li_objpack TYPE TABLE OF sopcklsti1.
KR Jaideep,
09-08-2009 10:10 AM
09-08-2009 10:36 AM
09-08-2009 10:42 AM
09-08-2009 10:52 AM
09-08-2009 11:14 AM
Hi,
I can't send you the entire code as it is too big. I have selected the code where I am fetching the document from archiver server and converting it into PDF or TIF document. What extra requirement do you have ? In case you are facing any problem with data declarations please let me know.
KR Jaideep,
09-08-2009 11:14 AM
09-08-2009 12:42 PM
09-08-2009 12:45 PM
I can send the function for sending your email program so I can see where to place the structures that are in tuocodice
09-08-2009 12:55 PM
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
DOCUMENT_DATA =
PUT_IN_OUTBOX = ' '
COMMIT_WORK = ' '
IMPORTING
SENT_TO_ALL =
NEW_OBJECT_ID =
TABLES
PACKING_LIST =
OBJECT_HEADER =
CONTENTS_BIN =
CONTENTS_TXT =
CONTENTS_HEX =
OBJECT_PARA =
OBJECT_PARB =
RECEIVERS =
EXCEPTIONS
TOO_MANY_RECEIVERS = 1
DOCUMENT_NOT_SENT = 2
DOCUMENT_TYPE_NOT_EXIST = 3
OPERATION_NO_AUTHORIZATION = 4
PARAMETER_ERROR = 5
X_ERROR = 6
ENQUEUE_ERROR = 7
OTHERS = 8
.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
09-08-2009 1:02 PM
Hi,
I have not used function module instead I have used classes to send the email. In case you want my program then drop me a mail on my alternate id and I will send the program to you.
KR Jaideep,
09-08-2009 1:13 PM
09-08-2009 1:27 PM
09-08-2009 1:36 PM
Please read the Rules of Engagement. Repeated, impatiently demanding "help" is not within the community spirit. All contributions are voluntary.
You've been given plenty of help on this thread, and yet continue to demand more. Exchange of material via personal email is discouraged.
Thread locked.
matt
Edited by: Matt on Sep 8, 2009 2:38 PM