SAP ABAP ARCHIVE LINK

From SapWiki
Revision as of 14:57, 8 March 2021 by WikiSysop (talk | contribs) (Created page with "==Subir archivo== <nowiki> CALL FUNCTION 'ARCHIV_CREATE_DIALOG_META' EXPORTING ar_object = gs_arch_info-ar_object object_id...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Subir archivo

      CALL FUNCTION 'ARCHIV_CREATE_DIALOG_META'
        EXPORTING
          ar_object                = gs_arch_info-ar_object
          object_id                = gs_arch_info-object_id
          sap_object               = gs_arch_info-sap_object
        IMPORTING
          archiv                   = gs_arch_info-archiv_id
          archiv_doc_id            = gs_arch_info-arc_doc_id
          documentclass            = gs_arch_info-doc_type
        CHANGING
          infiletab                = lt_infiletab  "salida
        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.

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.