반응형
<OAAD> SAP ArchiveLink
ArchiveLink 가져오기
ARCHIV_GET_CONNECTIONS
TOARANGE_D
function archiv_get_connections.
*"----------------------------------------------------------------------
*"*"Local Interface:
*" IMPORTING
*" VALUE(OBJECTTYPE) LIKE TOAV0-SAP_OBJECT OPTIONAL
*" VALUE(OBJECT_ID) LIKE TOAV0-OBJECT_ID OPTIONAL
*" VALUE(CLIENT) LIKE SY-MANDT OPTIONAL
*" VALUE(ARCHIV_ID) LIKE TOAV0-ARCHIV_ID OPTIONAL
*" VALUE(ARC_DOC_ID) LIKE TOAV0-ARC_DOC_ID OPTIONAL
*" VALUE(DOCUMENTTYPE) LIKE TOAV0-AR_OBJECT OPTIONAL
*" VALUE(FROM_AR_DATE) LIKE TOAV0-AR_DATE OPTIONAL
*" VALUE(UNTIL_AR_DATE) LIKE TOAV0-AR_DATE DEFAULT SY-DATUM
*" VALUE(DOCUMENTCLASS) LIKE TOADD-DOC_TYPE OPTIONAL
*" VALUE(DEL_DATE) LIKE TOAV0-DEL_DATE OPTIONAL
*" VALUE(LIMITED) LIKE TOAOM-AR_STATUS OPTIONAL
*" VALUE(LIMIT) LIKE TOACU-ANZHITLIST OPTIONAL
*" EXPORTING
*" VALUE(COUNT) LIKE SY-INDEX
*" VALUE(REDUCEDBYLIMIT) TYPE SAESTATUS
*" VALUE(REDUCEDBYAUTHORITY) TYPE SAESTATUS
*" TABLES
*" CONNECTIONS STRUCTURE TOAV0 OPTIONAL
*" PARAMETER STRUCTURE TOARANGE_D OPTIONAL
*" FILE_ATTRIBUTES STRUCTURE TOAAT OPTIONAL
*" EXCEPTIONS
*" NOTHING_FOUND
*"----------------------------------------------------------------------
call function 'ARCHIV_GET_CONNECTIONS_INT'
EXPORTING
OBJECTTYPE = OBJECTTYPE
OBJECT_ID = OBJECT_ID
CLIENT = CLIENT
ARCHIV_ID = ARCHIV_ID
ARC_DOC_ID = ARC_DOC_ID
DOCUMENTTYPE = DOCUMENTTYPE
FROM_AR_DATE = FROM_AR_DATE
UNTIL_AR_DATE = UNTIL_AR_DATE
DOCUMENTCLASS = DOCUMENTCLASS
DEL_DATE = DEL_DATE
LIMITED = LIMITED
NO_AUTH_CHECK = SPACE
LIMIT = LIMIT
IMPORTING
COUNT = COUNT
REDUCEDBYLIMIT = REDUCEDBYLIMIT
REDUCEDBYAUTHORITY = REDUCEDBYAUTHORITY
TABLES
CONNECTIONS = CONNECTIONS
PARAMETER = PARAMETER
FILE_ATTRIBUTES = FILE_ATTRIBUTES
EXCEPTIONS
NOTHING_FOUND = 1
OTHERS = 2
.
if sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4
RAISING NOTHING_FOUND.
endif.
endfunction.
DATA : gt_disp TYPE TABLE OF toav0.
FORM get_data .
DATA : lt_parameter TYPE TABLE OF toarange_d,
lv_reduced(1) TYPE c.
APPEND INITIAL LINE TO lt_parameter ASSIGNING FIELD-SYMBOL(<fs_parameter>).
<fs_parameter>-name = 'MANDT'.
<fs_parameter>-dsign = 'I'.
<fs_parameter>-doption = 'EQ'.
<fs_parameter>-dlow = sy-mandt.
LOOP AT s_docid.
APPEND INITIAL LINE TO lt_parameter ASSIGNING <fs_parameter>.
<fs_parameter>-name = 'ARC_DOC_ID'.
<fs_parameter>-dsign = s_docid-sign.
<fs_parameter>-doption = s_docid-option.
<fs_parameter>-dlow = s_docid-low.
<fs_parameter>-dhigh = s_docid-high.
ENDLOOP.
CLEAR : gt_disp[], lv_reduced.
CALL FUNCTION 'ARCHIV_GET_CONNECTIONS'
IMPORTING
reducedbylimit = lv_reduced
TABLES
connections = gt_disp
parameter = lt_parameter
EXCEPTIONS
nothing_found = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE 'No entries exist' TYPE 'S' DISPLAY LIKE 'E'.
REJECT.
ENDIF.
ENDFORM.
ArchiveLink
File download
ALINK_DOWNLOAD_DOCUMENTS
CALL FUNCTION 'ALINK_DOWNLOAD_DOCUMENTS'
TABLES
archivdocs = lt_archivdocs.
FUNCTION ALINK_DOWNLOAD_DOCUMENTS.
*"----------------------------------------------------------------------
*"*"Lokale Schnittstelle:
*" IMPORTING
*" REFERENCE(DTPATH) TYPE SAPB-SAPPFAD OPTIONAL
*" TABLES
*" ARCHIVDOCS STRUCTURE TOAV0
*"----------------------------------------------------------------------
data: putpath(200) type c,
filename like SAPB-SAPPFAD,
rc like sy-subrc,
doc_type like TOADV-DOC_TYPE,
count(8) type n,
count2(8) type n.
if dtpath is initial.
get parameter id 'OAP' field putpath.
if putpath is initial.
message id 'OA' type 'E' number '830' with 'OAP'.
endif.
endif.
perform split_path_with_slash(oaall) using putpath putpath.
describe table archivdocs lines count.
loop at archivdocs.
* check authority
perform authority_check_display(oaall)
using archivdocs-archiv_id
archivdocs-arc_doc_id
archivdocs-sap_object
archivdocs-object_id
archivdocs-ar_object
archivdocs-reserve(20)
changing rc.
if rc = 0.
doc_type(20) = archivdocs-reserve.
concatenate putpath
archivdocs-archiv_id
archivdocs-arc_doc_id '.'
doc_type
into filename.
CALL FUNCTION 'ARCHIVOBJECT_GET_DT_VIA_TABLE'
EXPORTING
ARCHIV_ID = archivdocs-archiv_id
ARCHIV_DOC_ID = archivdocs-arc_doc_id
DOC_TYPE = doc_type
DTPATH = filename
EXCEPTIONS
ERROR_APPLICATION = 1
OTHERS = 2.
if sy-subrc = 0.
count2 = count2 + 1.
endif.
endif.
endloop.
message id 'OA' type 'I' number 831 with count2 count putpath.
ENDFUNCTION.
반응형