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

* 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 ).
 
* 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: Dokumenteninfosätze löschen (BAPI_DOCUMENT_DELETE_DIRECT)

* Dokumentart (TA DC10, Tabelle TDWA)
PARAMETERS: p_dtype TYPE bapi_doc_aux-doctype OBLIGATORY.
* 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.

  IF lv_return-type CA 'EA'.
    WRITE: / lv_return-message.
  ELSE.
* Alle gefundenen Dokumenteninfosätze durchgehen
    LOOP AT it_doc_keys ASSIGNING FIELD-SYMBOL(<d>).
* Wenn Dokumenttyp gefunden
      IF <d>-documenttype = p_dtype.
        DATA: ret TYPE string.

* Abfrage zum Löschen
        CALL FUNCTION 'POPUP_TO_CONFIRM'
          EXPORTING
            titlebar              = 'Frage'
            text_question         = |Löschen DI { <d>-documentnumber } ?|
            display_cancel_button = abap_true
          IMPORTING
            answer                = ret.

        CASE ret.
          WHEN '1'.
* Ja --> löschen
* Delete document or set deletion indicator
            CALL FUNCTION 'BAPI_DOCUMENT_DELETE_DIRECT'
              EXPORTING
                documenttype    = <d>-documenttype
                documentnumber  = <d>-documentnumber
                documentpart    = <d>-documentpart
                documentversion = <d>-documentversion
              IMPORTING
                return          = lv_return.

            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.
            ENDIF.
          WHEN OTHERS.

        ENDCASE.

      ENDIF.
    ENDLOOP.
  ENDIF.

[ABAP] DMS: Dateien von Dokumenteninfosätzen lesen (SCMS_DOC_READ)

* 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.

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

  DATA: it_documentfiles TYPE STANDARD TABLE OF bapi_doc_files2 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
      getactivefiles     = abap_true
      getdocdescriptions = abap_true
      getdocfiles        = abap_true
    IMPORTING
      documentdata       = lv_bapi_doc_draw2
      return             = lv_bapiret2
    TABLES
      documentfiles      = it_documentfiles.

  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_documentfiles ).

  IF lv_bapiret2-type CA 'EA'.

  ELSE.
    IF lines( it_documentfiles ) > 0.

      DATA: it_access_info TYPE STANDARD TABLE OF scms_acinf WITH DEFAULT KEY.
      DATA: it_content_txt TYPE STANDARD TABLE OF sdokcntasc WITH DEFAULT KEY.
      DATA: it_content_bin TYPE STANDARD TABLE OF sdokcntbin WITH DEFAULT KEY.

* CMS: Dokument lesen
      CALL FUNCTION 'SCMS_DOC_READ'
        EXPORTING
          stor_cat              = it_documentfiles[ 1 ]-storagecategory
          doc_id                = it_documentfiles[ 1 ]-file_id
          no_cache              = abap_true
        TABLES
          access_info           = it_access_info
          content_txt           = it_content_txt
          content_bin           = it_content_bin
        EXCEPTIONS
          bad_storage_type      = 1
          bad_request           = 2
          unauthorized          = 3
          comp_not_found        = 4
          not_found             = 5
          forbidden             = 6
          conflict              = 7
          internal_server_error = 8
          error_http            = 9
          error_signature       = 10
          error_config          = 11
          error_format          = 12
          error_parameter       = 13
          error                 = 14
          OTHERS                = 15.

      IF sy-subrc = 0.
        cl_demo_output=>write_data( it_access_info ).
        cl_demo_output=>write_data( it_content_txt ).

* Binärdaten für weitere Verarbeitung (Speichern, Anzeigen ...)	
        cl_demo_output=>write_data( it_content_bin ).
      ENDIF.
    ENDIF.

* 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       = 'SCMS_DOC_READ'
                                          html_string = lv_html
                                          container   = cl_gui_container=>default_screen ).

* cl_gui_container=>default_screen erzwingen
    WRITE: space.
  ENDIF.

[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)
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)

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