[ABAP] DMS: Infos zu Dokumenteninfosätzen lesen

Variante 1 (JOIN)

* Dokumentart (TA DC10, Tabelle TDWA)
PARAMETERS: p_type TYPE draw-dokar OBLIGATORY DEFAULT 'XYZ'.
* Dokumentnummer, mit Suchhilfe auf Tabelle DRAW (Dokumentinformationssatz)
PARAMETERS: p_num TYPE draw-doknr OBLIGATORY DEFAULT '10000000001' MATCHCODE OBJECT /plmb/dir_elm.
* Dokumentversion
PARAMETERS: p_ver TYPE draw-dokvr OBLIGATORY DEFAULT '00'.
* Teildokument
PARAMETERS: p_part TYPE draw-doktl OBLIGATORY DEFAULT '000'.

START-OF-SELECTION.

  SELECT FROM draw AS dw
    INNER JOIN drad AS dd ON ( dw~dokar EQ dd~dokar AND dw~doknr EQ dd~doknr AND dw~dokvr EQ dd~dokvr AND dw~doktl EQ dd~doktl )
    INNER JOIN drat AS dt ON ( dw~dokar EQ dt~dokar AND dw~doknr EQ dt~doknr AND dw~dokvr EQ dt~dokvr AND dw~doktl EQ dt~doktl )
    LEFT OUTER JOIN dms_doc2loio AS l ON ( dw~dokar EQ l~dokar AND dw~doknr EQ l~doknr AND dw~dokvr EQ l~dokvr AND dw~doktl EQ l~doktl )
    LEFT OUTER JOIN dms_doc_files AS f ON ( dw~dokar EQ f~dokar AND dw~doknr EQ f~doknr AND dw~dokvr EQ f~dokvr AND dw~doktl EQ f~doktl )
    LEFT OUTER JOIN dms_ph_cd1 AS ph ON ( ph~loio_id EQ l~lo_objid )
    LEFT OUTER JOIN dms_phf_cd1 AS pf ON ( pf~phio_id EQ ph~phio_id )
    LEFT OUTER JOIN dms_phio2file AS o ON ( o~file_id EQ ph~prop08 )
    FIELDS dw~dokar,                    " Dokumentart
           dw~doknr,                    " Dokumentnummer
           dw~dokvr,                    " Dokumentversion
           dw~doktl,                    " Teildokument
           dw~dwnam,                    " Name des zuständigen Sachbearbeiters
           dw~adatum,                   " Ausgabedatum des Dokuments
           dw~document_info_record_key, " Dokumentinfosatzschlüssel konkatenierter Form
           dd~dokob,                    " Verknüpftes SAP-Objekt
           dd~obzae,                    " Zähler Key
           dd~objky,                    " Objektkey Dokumentenverwaltung
           dt~dktxt,                    " Beschreibung
           l~lo_objid,                  " Log.Dokument
           f~dappl,                     " WS-Appl.
           f~filename,                  " Dateiname
           ph~phio_id,                  " Phys.Dokument
           ph~stor_cat,                 " Kategorie
           pf~mimetype,                 " MIME Typ
           pf~file_size,                " Größe
           pf~file_name,                " Komponentenname
           pf~file_type,                " Übertragungsart
           o~file_id,                   " DMS: GUID für Zuordnung PHIO - Dateiname
           o~filename AS file_path      " Original zu Dokument
    WHERE dw~dokar EQ @p_type
      AND dw~doknr EQ @p_num
      AND dw~dokvr EQ @p_ver
      AND dw~doktl EQ @p_part
    INTO TABLE @DATA(it_di).

  cl_demo_output=>write_data( it_di ).

* HTML-Code vom Demo-Output holen
  DATA(lv_html) = cl_demo_output=>get( ).

* Daten im Inline-Browser im SAP-Fenster anzeigen
  cl_abap_browser=>show_html( EXPORTING title       = 'DMS'
                                        html_string = lv_html
                                        container   = cl_gui_container=>default_screen ).

* cl_gui_container=>default_screen erzwingen
  WRITE: space.

Variante 2 (CDS-View P_DOCUMENTINFORECORDATTACHMENT)

* Dokumentart (TA DC10, Tabelle TDWA)
PARAMETERS: p_type TYPE draw-dokar OBLIGATORY DEFAULT 'XYZ'.
* Dokumentnummer, mit Suchhilfe auf Tabelle DRAW (Dokumentinformationssatz)
PARAMETERS: p_num TYPE draw-doknr OBLIGATORY DEFAULT '10000000001' MATCHCODE OBJECT /plmb/dir_elm.
* Dokumentversion
PARAMETERS: p_ver TYPE draw-dokvr OBLIGATORY DEFAULT '00'.
* Teildokument
PARAMETERS: p_part TYPE draw-doktl OBLIGATORY DEFAULT '000'.

START-OF-SELECTION.

  SELECT FROM p_documentinforecordattachment
    FIELDS *
    WHERE documentinforecorddoctype EQ @p_type
      AND documentinforecorddocnumber EQ @p_num
      AND documentinforecorddocversion EQ @p_ver
      AND documentinforecorddocpart EQ @p_part
    INTO TABLE @DATA(it_di).

  TRY.
* SALV-Table
      DATA: o_salv TYPE REF TO cl_salv_table.

      cl_salv_table=>factory( IMPORTING r_salv_table = o_salv
                              CHANGING  t_table      = it_di ).

* Grundeinstellungen
      o_salv->get_functions( )->set_all( abap_true ).
      o_salv->get_columns( )->set_optimize( abap_true ).
      o_salv->get_display_settings( )->set_list_header( 'DMS' ).
      o_salv->get_display_settings( )->set_striped_pattern( abap_true ).
      o_salv->get_selections( )->set_selection_mode( if_salv_c_selection_mode=>row_column ).

* Spaltenüberschriften: technischer Name und Beschreibungstexte, Short Text und Medium Text leer lassen für Autosize
      LOOP AT o_salv->get_columns( )->get( ) ASSIGNING FIELD-SYMBOL(<c>).
        DATA(o_col) = <c>-r_column.
        o_col->set_short_text( || ).
        o_col->set_medium_text( || ).
        o_col->set_long_text( |{ o_col->get_long_text( ) }| ).
      ENDLOOP.

      o_salv->display( ).
    CATCH cx_root INTO DATA(e_txt).
      WRITE: / e_txt->get_text( ).
  ENDTRY.

[ABAP] DMS: Dokumenteninfosätze lesen (CVAPI_DOC_GETDETAIL), URL eines Archivdokumentes ermitteln

* Dokumentart (TA DC10, Tabelle TDWA)
PARAMETERS: p_type TYPE bapi_doc_aux-doctype OBLIGATORY.
* Dokumentnummer, mit Suchhilfe auf Tabelle DRAW (Dokumentinformationssatz)
PARAMETERS: p_num TYPE bapi_doc_aux-docnumber OBLIGATORY DEFAULT '10000000001' MATCHCODE OBJECT /plmb/dir_elm.
* Teildokument
PARAMETERS: p_part TYPE bapi_doc_aux-docpart OBLIGATORY DEFAULT '000'.
* Dokumentversion
PARAMETERS: p_ver TYPE bapi_doc_aux-docversion OBLIGATORY DEFAULT '00'.

START-OF-SELECTION.
* Dokumentinformationssatz
  DATA(lv_draw) = VALUE draw(
                              doknr = p_num
                              dokar = p_type
                              doktl = p_part
                              dokvr = p_ver
                            ).

  DATA: lv_psx_draw TYPE draw.
  DATA: lv_pfx_dktxt TYPE drat-dktxt.
  DATA: it_doc_files TYPE STANDARD TABLE OF cvapi_doc_file WITH DEFAULT KEY.
  DATA: it_doc_comp TYPE STANDARD TABLE OF cvapi_doc_comp WITH DEFAULT KEY.
  DATA: it_drap TYPE STANDARD TABLE OF drap WITH DEFAULT KEY.
  DATA: it_drad TYPE STANDARD TABLE OF drad WITH DEFAULT KEY.
  DATA: it_drat TYPE STANDARD TABLE OF drat WITH DEFAULT KEY.

* DVS: Detaildaten eines Dokuments ermitteln
  CALL FUNCTION 'CVAPI_DOC_GETDETAIL'
    EXPORTING
      pf_dokar        = lv_draw-dokar
      pf_doknr        = lv_draw-doknr
      pf_dokvr        = lv_draw-dokvr
      pf_doktl        = lv_draw-doktl
      pf_read_drad    = abap_true
      pf_read_drap    = abap_true
      pf_active_files = abap_true
    IMPORTING
      psx_draw        = lv_psx_draw
      pfx_description = lv_pfx_dktxt
    TABLES
      pt_files        = it_doc_files
      pt_comp         = it_doc_comp
      pt_drap         = it_drap
      pt_drad         = it_drad
      pt_drat         = it_drat
    EXCEPTIONS
      not_found       = 1
      no_auth         = 2
      error           = 3
      OTHERS          = 4.

  IF sy-subrc = 0.

    cl_demo_output=>write_data( lv_psx_draw ).
    cl_demo_output=>write_data( lv_pfx_dktxt ).
    cl_demo_output=>write_data( it_doc_files ).
    cl_demo_output=>write_data( it_doc_comp ).
    cl_demo_output=>write_data( it_drap ).
    cl_demo_output=>write_data( it_drad ).
    cl_demo_output=>write_data( it_drat ).

* Dateien zum Dokumenteninfosatz durchloopen und anhand der physischen IDs
* die URLs für den Zugriff auf das Archivsystem holen
    LOOP AT it_doc_files ASSIGNING FIELD-SYMBOL(<f>).
      DATA(lv_urls) = VALUE sdokcompurls( ).
      DATA(lv_document_url) = CONV saeuri( '' ).

      DATA(lv_phioobj) = VALUE sdokobject( class = 'DMS_PCD1'      " Tabelle: SDOKIOCL -> DMS_PCD1 (DMS: Physikalische Objekt für Haupt-Originale)
                                           objid = <f>-ph_objid ). " PHIO-ID

* Liefert URL zum Lesen eines physischen Dokuments am Frontend
      CALL FUNCTION 'SDOK_PHIO_GET_URL_FOR_GET'
        EXPORTING
          object_id         = lv_phioobj
        IMPORTING
          urls              = lv_urls
          document_url      = lv_document_url
        EXCEPTIONS
          not_existing      = 1
          not_authorized    = 2
          no_content        = 3
          bad_storage_type  = 4
          no_urls_available = 5
          OTHERS            = 6.
      IF sy-subrc = 0.
        cl_demo_output=>write_data( lv_urls ).
        cl_demo_output=>write_data( lv_document_url ).
      ENDIF.
    ENDLOOP.

* HTML-Code vom Demo-Output holen
    DATA(lv_html) = cl_demo_output=>get( ).

* Daten im Inline-Browser im SAP-Fenster anzeigen
    cl_abap_browser=>show_html( EXPORTING title       = 'CVAPI_DOC_GETDETAIL'
                                          html_string = lv_html
                                          container   = cl_gui_container=>default_screen ).

* cl_gui_container=>default_screen erzwingen
    WRITE: space.

  ENDIF.

[ABAP] DMS: Verknüpfte Dokumenteninfosätze zu einem Objekt lesen (BAPI_DOCUMENT_GETOBJECTDOCS)

* Objekttyp (Material -> MARA)
PARAMETERS: p_otype TYPE bapi_doc_drad-objecttype OBLIGATORY DEFAULT 'MARA'.
* Objektkey (Material -> MATNR)
PARAMETERS: p_okey TYPE bapi_doc_drad-objectkey OBLIGATORY DEFAULT '000000001122334455'.

START-OF-SELECTION.

  DATA: it_doc_keys TYPE STANDARD TABLE OF bapi_doc_keys WITH DEFAULT KEY.
  DATA: lv_return   TYPE bapiret2.

* Determine Documents for an Object
  CALL FUNCTION 'BAPI_DOCUMENT_GETOBJECTDOCS'
    EXPORTING
      objecttype          = p_otype
      objectkey           = p_okey
      currentversionsonly = abap_false " alle Versionen lesen
      date                = sy-datum
    IMPORTING
      return              = lv_return
    TABLES
      documentlist        = it_doc_keys.

  cl_demo_output=>write_data( lv_return ).
  cl_demo_output=>write_data( it_doc_keys ).

* HTML-Code vom Demo-Output holen
  DATA(lv_html) = cl_demo_output=>get( ).

* Daten im Inline-Browser im SAP-Fenster anzeigen
  cl_abap_browser=>show_html( EXPORTING title       = 'BAPI_DOCUMENT_GETOBJECTDOCS'
                                        html_string = lv_html
                                        container   = cl_gui_container=>default_screen ).

* cl_gui_container=>default_screen erzwingen
  WRITE: space.

[ABAP] DMS: Dateien an Dokumenteninfosätze anhängen (CVAPI_DOC_CREATE)

TYPES: BEGIN OF bin_file,
         name TYPE string,
         size TYPE i,
         data TYPE solix_tab,
       END OF bin_file.

* Dokumentart (TA DC10, Tabelle TDWA)
PARAMETERS: p_type TYPE bapi_doc_aux-doctype OBLIGATORY.
* Teildokument
PARAMETERS: p_part TYPE bapi_doc_aux-docpart OBLIGATORY DEFAULT '000'.
* Dokumentversion
PARAMETERS: p_ver TYPE bapi_doc_aux-docversion OBLIGATORY DEFAULT '00'.
* Beschreibung
PARAMETERS: p_desc TYPE bapi_doc_drat-description DEFAULT 'Test 123'.
* Ablagekategorie (TA OACT, Tabelle SDOKSTCAE, View V_SDOKSTCA)
PARAMETERS: p_stor TYPE bapi_doc_files2-storagecategory OBLIGATORY.
* Logisches Dokument/Workstation Application (TA S_ALR_87008829, Tabelle TDWP, Bild -> JPG)
PARAMETERS: p_appl TYPE bapi_doc_files2-application_id OBLIGATORY DEFAULT 'JPG'.
* Objekttyp (Material -> MARA)
PARAMETERS: p_otype TYPE bapi_doc_drad-objecttype OBLIGATORY DEFAULT 'MARA'.
* Objektkey (Material -> MATNR)
PARAMETERS: p_okey TYPE bapi_doc_drad-objectkey OBLIGATORY DEFAULT '000000001122334455'.

START-OF-SELECTION.
  TRY.
      DATA: lv_rc TYPE i.
      DATA: it_files TYPE filetable.
      DATA: lv_action TYPE i.

* FileOpen-Dialog aufrufen
      cl_gui_frontend_services=>file_open_dialog( EXPORTING file_filter = |jpg (*.jpg)\|*.jpg\|{ cl_gui_frontend_services=>filetype_all }|
                                                  CHANGING  file_table  = it_files
                                                            rc          = lv_rc
                                                            user_action = lv_action ).

      IF lv_action = cl_gui_frontend_services=>action_ok.
* wenn Datei ausgewählt wurde
        IF lines( it_files ) > 0.
* Dateien auf den Appl.-Server hochladen
          DATA: lv_file TYPE bin_file.
          cl_gui_frontend_services=>gui_upload( EXPORTING filename   = CONV #( it_files[ 1 ]-filename )
                                                          filetype   = 'BIN'
                                                IMPORTING filelength = lv_file-size
                                                CHANGING  data_tab   = lv_file-data ).

          DATA: lv_xstring TYPE xstring.

* Datei binär zu xstring wandeln
          CALL FUNCTION 'SCMS_BINARY_TO_XSTRING'
            EXPORTING
              input_length = lv_file-size
            IMPORTING
              buffer       = lv_xstring
            TABLES
              binary_tab   = lv_file-data.

* Dokumentinformationssatz
          DATA(lv_draw) = VALUE draw(
                                      dokar = p_type
                                      doktl = p_part
                                      dokvr = p_ver
                                    ).

* DVS: Steuerung für APIS
          DATA(lv_api_control) = VALUE cvapi_api_control(
                                                            no_update_task = abap_true
                                                        ).

* Kurztexte für Dokuinfosätze
          DATA: it_drat TYPE STANDARD TABLE OF dms_db_drat WITH DEFAULT KEY.
          it_drat = VALUE #( (
                                langu = sy-langu
                                dktxt = p_desc
                             )
                           ).

* Verknüpfung Dokument-Objekt
          DATA: it_drad TYPE STANDARD TABLE OF dms_db_drad WITH DEFAULT KEY.

          it_drad = VALUE #( (
                               dokob = p_otype
                               objky = p_okey
                             )
                           ).

* Originale für Dokumente (Dateianhang)
          DATA: it_bin_content TYPE STANDARD TABLE OF drao WITH DEFAULT KEY.

          DATA: lv_data_length TYPE i.
          DATA: it_content_raw TYPE STANDARD TABLE OF orblk WITH DEFAULT KEY.

* xstring --> ORBLK (Binärformat mit Zeilenlänge 2550 Bytes)
          CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
            EXPORTING
              buffer        = lv_xstring
            IMPORTING
              output_length = lv_data_length
            TABLES
              binary_tab    = it_content_raw.

* Datenaufbereitung
          LOOP AT it_content_raw ASSIGNING FIELD-SYMBOL(<raw>).

            APPEND VALUE #(
                            zaehl = sy-tabix
                            appnr = '1'
                            dokar = p_type
                            orln  = lv_data_length
*                            orbkl = 2550
                            orblk = <raw>
                          ) TO it_bin_content.
          ENDLOOP.

* DVS: Originale zu einem Dokument
          DATA: it_doc_files TYPE STANDARD TABLE OF cvapi_doc_file WITH DEFAULT KEY.

          it_doc_files = VALUE #( ( updateflag  = 'I'
                                    appnr       = '1'
                                    dappl       = p_appl
                                    filename    = it_files[ 1 ]-filename
                                    storage_cat = p_stor
                                    description = p_desc ) ).

          DATA(lv_message) = VALUE messages( ).
          DATA(lv_pfx_dokar) = VALUE draw-dokar( ).
          DATA(lv_pfx_doknr) = VALUE draw-doknr( ).
          DATA(lv_pfx_dokvr) = VALUE draw-dokvr( ).
          DATA(lv_pfx_doktl) = VALUE draw-doktl( ).

* DVS: Dokument anlegen
          CALL FUNCTION 'CVAPI_DOC_CREATE'
            EXPORTING
              ps_draw            = lv_draw
              ps_api_control     = lv_api_control
              pf_content_provide = 'TBL' " Binärdaten des Files als Tabelle übergeben
            IMPORTING
              psx_message        = lv_message
              pfx_dokar          = lv_pfx_dokar
              pfx_doknr          = lv_pfx_doknr
              pfx_dokvr          = lv_pfx_dokvr
              pfx_doktl          = lv_pfx_doktl
            TABLES
              pt_drad_x          = it_drad
              pt_drat_x          = it_drat
              pt_files_x         = it_doc_files
              pt_content         = it_bin_content.

          IF lv_message-msg_type CA 'EA'.
* Rollback bei Fehler
            CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
          ELSE.
* Daten verbuchen
            CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
              EXPORTING
                wait = abap_true.

            cl_demo_output=>write_data( lv_message ).
            cl_demo_output=>write_data( lv_pfx_dokar ).
            cl_demo_output=>write_data( lv_pfx_doknr ).
            cl_demo_output=>write_data( lv_pfx_dokvr ).
            cl_demo_output=>write_data( lv_pfx_doktl ).

* HTML-Code vom Demo-Output holen
            DATA(lv_html) = cl_demo_output=>get( ).

* Daten im Inline-Browser im SAP-Fenster anzeigen
            cl_abap_browser=>show_html( EXPORTING title       = 'CVAPI_DOC_CREATE'
                                                  html_string = lv_html
                                                  container   = cl_gui_container=>default_screen ).

* cl_gui_container=>default_screen erzwingen
            WRITE: space.
          ENDIF.
        ENDIF.
      ENDIF.
    CATCH cx_root INTO DATA(e_text).
      MESSAGE e_text->get_text( ) TYPE 'S' DISPLAY LIKE 'E'.
  ENDTRY.

[ABAP] DMS: Dateien an Dokumenteninfosätze anhängen (BAPI_DOCUMENT_CREATE2)

* Dokumentart (TA DC10, Tabelle TDWA)
PARAMETERS: p_dtype TYPE bapi_doc_aux-doctype OBLIGATORY.
* Teildokument
PARAMETERS: p_dpart TYPE bapi_doc_aux-docpart OBLIGATORY DEFAULT '000'.
* Dokumentversion
PARAMETERS: p_dver TYPE bapi_doc_aux-docversion OBLIGATORY DEFAULT '00'.
* Beschreibung
PARAMETERS: p_desc TYPE bapi_doc_drat-description DEFAULT 'Test 123'.
* Ablagekategorie (TA OACT, Tabelle SDOKSTCAE, View V_SDOKSTCA)
PARAMETERS: p_stor TYPE bapi_doc_files2-storagecategory OBLIGATORY.
* Logisches Dokument/Workstation Application (TA S_ALR_87008829, Tabelle TDWP, Bild -> JPG)
PARAMETERS: p_appl TYPE bapi_doc_files2-application_id OBLIGATORY DEFAULT 'JPG'.
* Objekttyp (Material -> MARA)
PARAMETERS: p_otype TYPE bapi_doc_drad-objecttype OBLIGATORY DEFAULT 'MARA'.
* Objektkey (Material -> MATNR)
PARAMETERS: p_okey TYPE bapi_doc_drad-objectkey OBLIGATORY DEFAULT '000000001122334455'.

START-OF-SELECTION.

  TRY.
      DATA: lv_rc TYPE i.
      DATA: it_files TYPE filetable.
      DATA: lv_action TYPE i.

* FileOpen-Dialog aufrufen
      cl_gui_frontend_services=>file_open_dialog( EXPORTING file_filter = |jpg (*.jpg)\|*.jpg\|{ cl_gui_frontend_services=>filetype_all }|
                                                  CHANGING  file_table  = it_files
                                                            rc          = lv_rc
                                                            user_action = lv_action ).

      IF lv_action = cl_gui_frontend_services=>action_ok.
* wenn Datei ausgewählt wurde
        IF lines( it_files ) > 0.

          DATA(lv_bapi_doc_draw2) = VALUE bapi_doc_draw2(
                                                          documenttype    = p_dtype
                                                          documentversion = p_dver
                                                          documentpart    = p_dpart
                                                        ).

          DATA: lv_documenttype TYPE bapi_doc_aux-doctype.
          DATA: lv_documentnumber TYPE bapi_doc_aux-docnumber.
          DATA: lv_documentpart TYPE bapi_doc_aux-docpart.
          DATA: lv_documentversion TYPE bapi_doc_aux-docversion.
          DATA: lv_return TYPE bapiret2.

          DATA: it_documentdescriptions TYPE STANDARD TABLE OF bapi_doc_drat WITH DEFAULT KEY.
          it_documentdescriptions = VALUE #( (
                                                description  = p_desc
                                                language     = 'D'
                                                language_iso = 'DE'
                                             )
                                           ).

          DATA: it_documentfiles TYPE STANDARD TABLE OF bapi_doc_files2 WITH DEFAULT KEY.

          it_documentfiles = VALUE #( (
                                        originaltype      = '1'
*                                        sourcedatacarrier = 'SAP-SYSTEM' " oder 'DEFAULT'
                                        created_by        = sy-uname
                                        storagecategory   = p_stor
                                        docfile           = it_files[ 1 ]-filename
                                        wsapplication     = p_appl
*                                        checkedin         = abap_true
                                      )
                                    ).

          DATA: it_objectlinks TYPE STANDARD TABLE OF bapi_doc_drad WITH DEFAULT KEY.

          it_objectlinks = VALUE #( (
                                      objecttype    = p_otype
                                      objectkey     = p_okey
                                    )
                                  ).

* Create Document
          CALL FUNCTION 'BAPI_DOCUMENT_CREATE2'
            EXPORTING
              documentdata         = lv_bapi_doc_draw2
            IMPORTING
              documenttype         = lv_documenttype
              documentnumber       = lv_documentnumber
              documentversion      = lv_documentversion
              documentpart         = lv_documentpart
              return               = lv_return
            TABLES
              documentdescriptions = it_documentdescriptions
              documentfiles        = it_documentfiles
              objectlinks          = it_objectlinks.

          IF lv_return-type CA 'EA'.
* Rollback bei Fehler
            CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
          ELSE.
* Daten verbuchen
            CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
              EXPORTING
                wait = abap_true.

            cl_demo_output=>write_data( lv_documenttype ).
            cl_demo_output=>write_data( lv_documentnumber ).
            cl_demo_output=>write_data( lv_documentversion ).
            cl_demo_output=>write_data( lv_documentpart ).
            cl_demo_output=>write_data( lv_return ).

* HTML-Code vom Demo-Output holen
            DATA(lv_html) = cl_demo_output=>get( ).

* Daten im Inline-Browser im SAP-Fenster anzeigen
            cl_abap_browser=>show_html( EXPORTING title       = 'BAPI_DOCUMENT_CREATE2'
                                                  html_string = lv_html
                                                  container   = cl_gui_container=>default_screen ).

* cl_gui_container=>default_screen erzwingen
            WRITE: space.
          ENDIF.
        ENDIF.
      ENDIF.
    CATCH cx_root INTO DATA(e_text).
      MESSAGE e_text->get_text( ) TYPE 'S' DISPLAY LIKE 'E'.
  ENDTRY.

Links

[ABAP] DMS: Dokumenteninfosätze lesen (BAPI_DOCUMENT_GETDETAIL2)

* Dokumentart (TA DC10, Tabelle TDWA)
PARAMETERS: p_type TYPE bapi_doc_aux-doctype OBLIGATORY.
* Dokumentnummer, mit Suchhilfe auf Tabelle DRAW (Dokumentinformationssatz)
PARAMETERS: p_num TYPE bapi_doc_aux-docnumber MATCHCODE OBJECT /plmb/dir_elm.
* Teildokument
PARAMETERS: p_part TYPE bapi_doc_aux-docpart OBLIGATORY.
* Dokumentversion
PARAMETERS: p_ver TYPE bapi_doc_aux-docversion OBLIGATORY.

START-OF-SELECTION.

  DATA: lv_bapi_doc_draw2 TYPE bapi_doc_draw2.
  DATA: lv_bapiret2 TYPE bapiret2.

  DATA: it_objectlinks TYPE STANDARD TABLE OF bapi_doc_drad WITH DEFAULT KEY.
  DATA: it_documentdescriptions TYPE STANDARD TABLE OF bapi_doc_drat WITH DEFAULT KEY.
  DATA: it_longtexts TYPE STANDARD TABLE OF bapi_doc_text WITH DEFAULT KEY.
  DATA: it_statuslog TYPE STANDARD TABLE OF bapi_doc_drap WITH DEFAULT KEY.
  DATA: it_documentfiles TYPE STANDARD TABLE OF bapi_doc_files2 WITH DEFAULT KEY.
  DATA: it_components TYPE STANDARD TABLE OF bapi_doc_comp WITH DEFAULT KEY.
  DATA: it_characteristicvalues TYPE STANDARD TABLE OF bapi_characteristic_values WITH DEFAULT KEY.
  DATA: it_classallocations TYPE STANDARD TABLE OF bapi_class_allocation WITH DEFAULT KEY.
  DATA: it_documentstructure TYPE STANDARD TABLE OF bapi_doc_structure WITH DEFAULT KEY.
  DATA: it_whereusedlist TYPE STANDARD TABLE OF bapi_doc_structure WITH DEFAULT KEY.

* Determine Detail Data for a Document
  CALL FUNCTION 'BAPI_DOCUMENT_GETDETAIL2'
    EXPORTING
      documenttype         = p_type
      documentnumber       = p_num
      documentpart         = p_part
      documentversion      = p_ver
      getobjectlinks       = abap_true
      getcomponents        = abap_true
      getstatuslog         = abap_true
      getlongtexts         = abap_true
      getactivefiles       = abap_true
      getdocdescriptions   = abap_true
      getdocfiles          = abap_true
      getclassification    = abap_true
      getstructure         = abap_true
      getwhereused         = abap_true
*     hostname             = ''
      inherited            = abap_true
*     PF_BAPI_CALL         =
    IMPORTING
      documentdata         = lv_bapi_doc_draw2
      return               = lv_bapiret2
    TABLES
      objectlinks          = it_objectlinks
      documentdescriptions = it_documentdescriptions
      longtexts            = it_longtexts
      statuslog            = it_statuslog
      documentfiles        = it_documentfiles
      components           = it_components
      characteristicvalues = it_characteristicvalues
      classallocations     = it_classallocations
      documentstructure    = it_documentstructure
      whereusedlist        = it_whereusedlist.

  cl_demo_output=>write_data( p_type ).
  cl_demo_output=>write_data( p_num ).
  cl_demo_output=>write_data( p_part ).
  cl_demo_output=>write_data( p_ver ).
  cl_demo_output=>write_data( lv_bapiret2 ).
  cl_demo_output=>write_data( lv_bapi_doc_draw2 ).
  cl_demo_output=>write_data( it_objectlinks ).
  cl_demo_output=>write_data( it_documentdescriptions ).
  cl_demo_output=>write_data( it_longtexts ).
  cl_demo_output=>write_data( it_statuslog ).
  cl_demo_output=>write_data( it_documentfiles ).
  cl_demo_output=>write_data( it_components ).
  cl_demo_output=>write_data( it_characteristicvalues ).
  cl_demo_output=>write_data( it_classallocations ).
  cl_demo_output=>write_data( it_documentstructure ).
  cl_demo_output=>write_data( it_whereusedlist ).

* HTML-Code vom Demo-Output holen
  DATA(lv_html) = cl_demo_output=>get( ).

* Daten im Inline-Browser im SAP-Fenster anzeigen
  cl_abap_browser=>show_html( EXPORTING title       = 'Infos'
                                        html_string = lv_html
                                        container   = cl_gui_container=>default_screen ).

* cl_gui_container=>default_screen erzwingen
  WRITE: space.

[SAP] Dokumentenmanagement (DMS)

Transaktionen

CV01N (Dokument anlegen)
CV02N (Dokument ändern)
CV03N (Dokument anzeigen)
CV04N (Dokument suchen)
CV90 (Nummernkreise Dokumente)
DC10 (Dokumentarten definieren)
OACT (Pflege Kategorien)
S_ALR_87008829 (IMG-Aktivität: SIMG_VC_DVS30)
CC04 (Anzeigen Produktstruktur)
OAC0 (CMS Customizing Content Repositories)
CSADMIN (Content-Server-Administration)
SLG1 (Application-Log anzeigen)

  • Objekte: SDOK und SCMS

Tabellen

DRAW (Dokumentinformationssatz)
DRAD (Verknüpfung Dokument-Objekt)
DRAO (Originale für Dokumente)
DRAT (Kurztexte für Dokuinfosätze)
DRAP (Protokolldatei Dokument)
DMS_PH_CD1 (DVS: PHIOS der Hauptoriginale)
DMS_PHF_CD1 (DVS: PHIOS-Komponenten der Hauptoriginale (conv. document))
DMS_PH_HD1 (DVS: PHIOS der Zusatzoriginale)
DMS_PHF_HD1 (DVS: PHIOS-Komponenten der Zusatzdateien (help document))
DMS_DOC2LOIO (DVS: Verknüpfungstabelle DVS-Key <-> LOIO-ID)
DMS_DOC_FILES (DMS: Dateinamen für Dokumente)
DMS_PHIO2FILE (DMS: Dateinamen zu Phios)
SDOKSTCAE (SDOK: Kategorie)
TDWA (Dokumentarten)
TDWAT (Beschreibungen für Dokumentart)
TDWO (Objektverknüpfung Dokumentenverwaltung)
TDWOT (Texte Objektverknüpfung Dokumentenverwaltung)
TDWP (Workstation-Applikationen)
TDWS (Dokumentstatus)
TDWST (Text für Dokumentstatus)

Views

ESD_DRAW (Sicht der Tabelle DRAW (DVS))
V_SDOKSTCA (Generated Table for View V_SDOKSTCA)
M_CV01O (Generierter View für Matchcode ID CV01 -O)

CDS-Views

shsm_drad_draw (Value help for search help CV01O)
p_documentinforecordattachment (JOIN über alle relv. DMS-Tabellen)

Suchhilfen

/PLMB/DIR_ELM (Dokumentenverwaltung)

Paket

CV (Dokumentenverwaltung)

Programme

DMS_KPRO_READ (Originaldaten aus KPRO für ein Dokument ermitteln)
RSHTTP80 (Content Server Performance)
RSCMST (CMS: Test programs)

Business-Objekttypen

DRAW (Dokument)

Funktionsbausteine

CVAPI_DOC_GETDETAIL (DVS: Detaildaten eines Dokuments ermitteln)
CVAPI_DOC_CREATE (DVS: Dokument anlegen)

BAPIs

BAPI_DOCUMENT_CREATE
BAPI_DOCUMENT_CREATE2 (Create Document)
BAPI_DOCUMENT_CHANGE
BAPI_DOCUMENT_CHANGE2
BAPI_DOCUMENT_DELETE
BAPI_DOCUMENT_DELETE_DIRECT (Delete document or set deletion indicator)
BAPI_DOCUMENT_ENQUEUE
BAPI_DOCUMENT_DEQUEUE
BAPI_DOCUMENT_EXISTENCECHECK
BAPI_DOCUMENT_GETAPPLICATION
BAPI_DOCUMENT_GETDETAIL2 (Determine Detail Data for a Document)
BAPI_DOCUMENT_GETLIST
BAPI_DOCUMENT_GETOBJECTDOCS (Determine Documents for an Object)
BAPI_DOCUMENT_GETSTATUS
BAPI_DOCUMENT_SETSTATUS

Fiori App

Dokumente verwalten (F2733)

OData-Services

API_DMS_PROCESS_SRV (API für DMS)
API_CV_ATTACHMENT_SRV (Gateway: API für Anlagenservice)

Links