Difference between revisions of "SAP ABAP ARCHIVE LINK"

From SapWiki
Line 1: Line 1:
 
==Subir archivo==
 
==Subir archivo==
 
  <nowiki>
 
  <nowiki>
CALL FUNCTION 'ARCHIV_CREATE_DIALOG_META'
+
FORM f_cargar_documento USING p_data TYPE ty_data
  EXPORTING
+
                    CHANGING p_archiv_doc_id.
    ar_object                = gs_arch_info-ar_object
+
  DATA: l_archiv_id    TYPE toaom-archiv_id VALUE 'ZE',
     object_id                = gs_arch_info-object_id
+
        l_ar_object    TYPE toaom-ar_object,
    sap_object              = gs_arch_info-sap_object
+
        l_object_id    TYPE sapb-sapobjid,
  IMPORTING
+
        l_sap_object    TYPE toaom-sap_object VALUE 'ZBUS1309',
     archiv                   = gs_arch_info-archiv_id
+
        l_archiv_doc_id TYPE toav0-arc_doc_id.
    archiv_doc_id            = gs_arch_info-arc_doc_id
+
 
     documentclass           = gs_arch_info-doc_type
+
  CLEAR p_archiv_doc_id.
  CHANGING
+
 
     infiletab               = lt_infiletab  "salida
+
  MOVE p_data-clase_docto TO l_ar_object.
  EXCEPTIONS
+
  MOVE p_data-arc_doc_id TO l_archiv_doc_id.
    error_archiv            = 1
+
  l_object_id = g_object_id.
    error_communicationtable = 2
+
 
    error_connectiontable    = 3
+
  CALL FUNCTION 'ARCHIV_CREATE_DIALOG_META'
    error_kernel            = 4
+
    EXPORTING
    error_parameter          = 5
+
      archiv_id                = l_archiv_id
    error_scanqueue          = 6
+
      ar_object                = l_ar_object
    canceled_by_user        = 7
+
*    DEL_DATE                = ' '
    blocked_by_policy        = 8
+
*     NOTE                    =
    OTHERS                  = 9.
+
      object_id                = l_object_id
 +
      sap_object              = l_sap_object
 +
*    FILE                    = ' '
 +
*    COMMIT_FLAG              = ' '
 +
*    VSCAN_PROFILE            = '/SCMS/KPRO_CREATE'
 +
*    FILE_DESCR_POP_SUP      = ' '
 +
    IMPORTING
 +
*     ARCHIV                   =
 +
      archiv_doc_id            = l_archiv_doc_id
 +
*     DOCUMENTCLASS           =
 +
* TABLES
 +
*    OUTDOCTAB                =
 +
* CHANGING
 +
*     INFILETAB               =
 +
    EXCEPTIONS
 +
      error_archiv            = 1
 +
      error_communicationtable = 2
 +
      error_connectiontable    = 3
 +
      error_kernel            = 4
 +
      error_parameter          = 5
 +
      error_scanqueue          = 6
 +
      canceled_by_user        = 7
 +
      blocked_by_policy        = 8
 +
      OTHERS                  = 9.
 +
  IF sy-subrc <> 0.
 +
* Implement suitable error handling here
 +
    MESSAGE i000(0k) WITH 'Error en Subir Archivo a Archive Link' DISPLAY LIKE 'E'.
 +
  ENDIF.
 +
 
 +
  MOVE l_archiv_doc_id TO p_archiv_doc_id.
 +
 
 +
ENDFORM.                    " F_VER_DOCUMENTO
 
</nowiki>
 
</nowiki>
  

Revision as of 15:01, 8 March 2021

Subir archivo

FORM f_cargar_documento USING p_data TYPE ty_data
                     CHANGING p_archiv_doc_id.
  DATA: l_archiv_id     TYPE toaom-archiv_id VALUE 'ZE',
        l_ar_object     TYPE toaom-ar_object,
        l_object_id     TYPE sapb-sapobjid,
        l_sap_object    TYPE toaom-sap_object VALUE 'ZBUS1309',
        l_archiv_doc_id TYPE toav0-arc_doc_id.

  CLEAR p_archiv_doc_id.

  MOVE p_data-clase_docto TO l_ar_object.
  MOVE p_data-arc_doc_id TO l_archiv_doc_id.
  l_object_id = g_object_id.

  CALL FUNCTION 'ARCHIV_CREATE_DIALOG_META'
    EXPORTING
      archiv_id                = l_archiv_id
      ar_object                = l_ar_object
*     DEL_DATE                 = ' '
*     NOTE                     =
      object_id                = l_object_id
      sap_object               = l_sap_object
*     FILE                     = ' '
*     COMMIT_FLAG              = ' '
*     VSCAN_PROFILE            = '/SCMS/KPRO_CREATE'
*     FILE_DESCR_POP_SUP       = ' '
    IMPORTING
*     ARCHIV                   =
      archiv_doc_id            = l_archiv_doc_id
*     DOCUMENTCLASS            =
* TABLES
*     OUTDOCTAB                =
* CHANGING
*     INFILETAB                =
    EXCEPTIONS
      error_archiv             = 1
      error_communicationtable = 2
      error_connectiontable    = 3
      error_kernel             = 4
      error_parameter          = 5
      error_scanqueue          = 6
      canceled_by_user         = 7
      blocked_by_policy        = 8
      OTHERS                   = 9.
  IF sy-subrc <> 0.
* Implement suitable error handling here
    MESSAGE i000(0k) WITH 'Error en Subir Archivo a Archive Link' DISPLAY LIKE 'E'.
  ENDIF.

  MOVE l_archiv_doc_id TO p_archiv_doc_id.

ENDFORM.                    " F_VER_DOCUMENTO

Bajar archivo

DATA: l_sapobj LIKE toa01-sap_object  VALUE 'BUS1309',
      l_objid  LIKE toa01-object_id   VALUE '%6527124%',
      l_archiv LIKE toa01-archiv_id   VALUE 'ZP',
      l_object LIKE toa01-ar_object   VALUE 'ZAFISH46'.

SELECT *  INTO CORRESPONDING FIELDS OF TABLE t_alf
    FROM toa01
    WHERE
          sap_object  =     l_sapobj  AND
          object_id   LIKE  l_objid   AND
          archiv_id   =     l_archiv  AND
  ar_object  =     l_object.
  IF sy-subrc = 0.
    DATA: l_tabix LIKE sy-tabix,
          w_toaat TYPE toaat.

    LOOP AT t_alf INTO w_alf.
      l_tabix = sy-tabix.
      CLEAR w_toaat.
      SELECT SINGLE * INTO w_toaat
        FROM toaat
      WHERE arc_doc_id = w_alf-arc_doc_id.

      w_alf-responsable  = w_toaat-creator.
*    w_alf-bp_emp     = wa_alv-object_id+12(10).
      w_alf-filename  = w_toaat-filename.
      w_alf-descr     = w_toaat-descr.
      MODIFY t_alf FROM w_alf INDEX l_tabix.

      REFRESH :t_arc_obj, t_binarc_obj.

      CALL FUNCTION 'ARCHIV_GET_TABLE'
        EXPORTING
          ar_object                = w_alf-ar_object
          object_id                = w_alf-object_id
          sap_object               = l_sapobj
        IMPORTING
          length                   = ld_len
*         BINLENGTH                =
        TABLES
          archivobject             = t_arc_obj
          binarchivobject          = t_binarc_obj
        EXCEPTIONS
          error_archiv             = 1
          error_communicationtable = 2
          error_connectiontable    = 3
          error_kernel             = 4
          error_parameter          = 5
          not_unique               = 6
          OTHERS                   = 7.
      IF sy-subrc <> 0.
* Implement suitable error handling here
*        error = c_x.
      ENDIF.

move ld_len to slen.

      CALL FUNCTION 'SCMS_BINARY_TO_XSTRING'
        EXPORTING
          input_length = slen
*         FIRST_LINE   = 0
*         LAST_LINE    = 0
        IMPORTING
          buffer       = p_xstring
        TABLES
          binary_tab   = t_binarc_obj
        EXCEPTIONS
          failed       = 1
          OTHERS       = 2.
      IF sy-subrc <> 0.
* Implement suitable error handling here
      ENDIF.


Ver documento

FORM f_ver_documento .
  DATA: l_archiv_id     TYPE toaom-archiv_id VALUE 'ZE',
        l_ar_object     TYPE toaom-ar_object,
        l_object_id     TYPE sapb-sapobjid,
        l_sap_object    TYPE toaom-sap_object VALUE 'ZBUS1309',
        l_archiv_doc_id TYPE toav0-arc_doc_id.

  MOVE wa_data-clase_docto TO l_ar_object.
  MOVE wa_data-arc_doc_id TO l_archiv_doc_id.
  l_object_id = g_object_id.

  CALL FUNCTION 'ARCHIVOBJECT_DISPLAY'
    EXPORTING
      archiv_doc_id            = l_archiv_doc_id
      archiv_id                = l_archiv_id
      object_id                = l_object_id
      ar_object                = l_ar_object
    EXCEPTIONS
      error_archiv             = 1
      error_communicationtable = 2
      error_kernel             = 3
      OTHERS                   = 4.

  IF sy-subrc <> 0.
* Implement suitable error handling here
  ENDIF.

ENDFORM.                    " F_VER_DOCUMENTO