Sapass

 Simplify SAP R/3 development with Excel VBA/VB RFC  
Home> Bapi>Document



Index

Document

Document


The business object Document is a data storage medium containing information of a specific type.


Structure

You can define a document as a group of related documents, or as part
of another document, by linking subordinate documents to superior
documents in a document hierarchy. To define more complex structure, use a document structure.


11-Dec-2005


Methods

Available Methods


  • Change : Change document [ BAPI_DOCUMENT_CHANGE ]
  • Change2 : Change document [ BAPI_DOCUMENT_CHANGE2 ]
  • CheckIn : Check in document [ BAPI_DOCUMENT_CHECKIN ] (Obsolete in 46C)
  • CheckIn2 : Check in document [ BAPI_DOCUMENT_CHECKIN2 ]
  • CheckInReplace2 : Check in document (overwrite originals) [ BAPI_DOCUMENT_CHECKIN_REPLACE2 ]
  • CheckOutModify : Check out document for processing [ BAPI_DOCUMENT_CHECKOUTMODIFY ] (Obsolete in 46C)
  • CheckOutModify2 : Check out document for processing [ BAPI_DOCUMENT_CHECKOUTMODIFY2 ]
  • CheckOutSet2 : Set document to checked out [ BAPI_DOCUMENT_CHECKOUTSET2 ]
  • CheckOutView : Check out document for display [ BAPI_DOCUMENT_CHECKOUTVIEW ]
  • CheckOutView2 : Check out document for display [ BAPI_DOCUMENT_CHECKOUTVIEW2 ]
  • CheckOutViewMultiple : Check out document for display [ BAPI_DOCUMENT_CHECKOUTVIEWX ]
  • Create2 : Create Document [ BAPI_DOCUMENT_CREATE2 ]
  • CreateFromData : Create Document [ BAPI_DOCUMENT_CREATE ]
  • CreateFromData2 : Create Document [ BAPI_DOCUMENT_CREATE2 ] (Obsolete in 46C)
  • CreateFromSource : Create Document with Template Source [ BAPI_DOCUMENT_CREATEFROMSOURCE ] (Obsolete in 46C)
  • CreateFromSource2 : Create Document with Template Source [ BAPI_DOCUMENT_CREATEFROMSRC2 ]
  • CreateNewVersion : Create new document version [ BAPI_DOCUMENT_CREATENEWVERSION ] (Obsolete in 46C)
  • CreateNewVersion2 : Create new document version [ BAPI_DOCUMENT_CREATENEWVRS2 ]
  • Delete : Delete document or set deletion indicator [ BAPI_DOCUMENT_DELETE ]
  • Dequeue : Unlock document [ BAPI_DOCUMENT_DEQUEUE ]
  • Enqueue : Lock document [ BAPI_DOCUMENT_ENQUEUE ]
  • ExistenceCheck1 : Check if document exists [ BAPI_DOCUMENT_EXISTENCECHECK ]
  • GetActualVersion : Determine valid versions for a document [ BAPI_DOCUMENT_GETACTVERSION ]
  • GetApplication : Determine Data for an Application [ BAPI_DOCUMENT_GETAPPLICATION ]
  • GetDataCarrierDetail : Determine detail data of a data carrier [ BAPI_DOCUMENT_GETDCDETAIL ]
  • GetDataCarrierList : Determine List of Data Carriers [ BAPI_DOCUMENT_GETDCLIST ]
  • GetDCList2 : Determine List of Data Carriers [ BAPI_DOCUMENT_GETDCLIST2 ]
  • GetDetail : Determine Detail Data for a Document [ BAPI_DOCUMENT_GETDETAIL ] (Obsolete in 46C)
  • GetDetail2 : Determine Detail Data for a Document [ BAPI_DOCUMENT_GETDETAIL2 ]
  • GetDocumentTypeDetail : Determine Data for a Document Type [ BAPI_DOCUMENT_GETDOCTYPEDETAIL ]
  • GetFrontendType : Determine Frontend Type for Computer [ BAPI_DOCUMENT_GETFRONTENDTYPE ]
  • GetList : Find Document [ BAPI_DOCUMENT_GETLIST ]
  • GetObjectDocuments : Determine Documents for an Object [ BAPI_DOCUMENT_GETOBJECTDOCS ]
  • GetStatus : Determine document status [ BAPI_DOCUMENT_GETSTATUS ]
  • GetStatusList : Determine Status List for a Document Type [ BAPI_DOCUMENT_GETSTATUSLIST ]
  • GetStructure : Determine document structure [ BAPI_DOCUMENT_GETSTRUCTURE ]
  • Load : Copy mass data for documents [ BAPI_DOCUMENT_LOAD ]
  • SetFrontendType : Set frontend type for computer [ BAPI_DOCUMENT_SETFRONTENDTYPE ]
  • SetStatus : Set Document Status [ BAPI_DOCUMENT_SETSTATUS ]

11-Dec-2005


Change

Change


You can use this method to change documents.

You can also check the original application files (1 and 2) into the SAP database, vault, or archive at the same time.

Limitations:

  • Additional files are not supported
  • Long texts for object links are not supported

  • Value assignments for the object links are not supported
  • Mass check-ins are not supported
  • Example

    **..... Document data
    DATA: ls_doc    LIKE bapi_doc_draw.
    **..... Indicator for relevancy to change

          ls_docx   LIKE bapi_doc_drawx,
    **..... Bapi return structure
          ls_return LIKE bapiret2.
    **.... Originals that are checked in at the same time
    DATA: lt_files LIKE bapi_doc_files OCCURS 0 WITH HEADER LINE,

    **.... Descriptions
          lt_drat  LIKE bapi_doc_drat OCCURS 0 WITH HEADER LINE,
    **.... Object links
          lt_drad  LIKE bapi_doc_drad OCCURS 0 WITH HEADER LINE.
    **----------------------------------------------------------------------

    ** Allocate document data
     ls_doc-documenttype    = 'DRW'.
     ls_doc-documentnumber  = '4711'.
     ls_doc-documentversion = '000'.
     ls_doc-documentpart    = '00'.
     ls_doc-description    = 'Gear box'.

     ls_doc-laboratory     = ''.
    **  Set indicator for relevancy to change
     ls_docx-description    = 'X'.
     ls_docX-laboratory     = 'X'.
    ** Add/create object link
     CLEAR lt_drad.

     REFRESH lt_drad.
     lt_drad-objecttype = 'MARA'.
     lt_drad-objectkey  = 'M0815'.
     APPEND lt_drad.
    **----------------------------------------------------------------------
    ** Change document
    **----------------------------------------------------------------------

      CALL FUNCTION 'BAPI_DOCUMENT_CHANGE'
           EXPORTING: documenttype    = ls_doc-documenttype
                      documentnumber  = ls_doc-documentnumber
                      documentpart    = ls_doc-documentpart
                      documentversion = ls_doc-documentversion

                      documentdata    = ls_doc
                      documentdatax   = ls_docx
           IMPORTING: return          = ls_return
           TABLES:    objectlinks     = lt_drad.
    ** Error occurred ??

     IF ls_return-type CA 'EA'.
       ROLLBACK WORK.
       MESSAGE ID '26' TYPE 'I' NUMBER '000'
               WITH ls_return-message.
     ELSE.
       COMMIT WORK.
     ENDIF.

    Notes

    Apart from the document data, the follwoing data can be changed:


  • Object links
  • Classifications and characteristic value assignments
  • Language-dependent document descriptions
  • Document long texts
  • Document structures
  • Originals (1 and 2)

  • 11-Dec-2005


    Change2

    Change2


    You can change documents with this function module.

    It can also be used to check in original application files into the SAP database, vault, or archive simultaneously.

    Restrictions:

  • Additonal files are supported only as interface parameter for future deveoplemnt

  • Mass check in is not supported
  • Example

    **..... Document data
    DATA: ls_doc    LIKE bapi_doc_draw2.
    **..... Indicator for change relevance
          ls_docx   LIKE bapi_doc_drawx2,
    
    
    **..... Bapi return structure
          ls_return LIKE bapiret2.
    **.... Originals that are checked in simultaneously
          lt_files LIKE bapi_doc_files OCCURS 0 WITH HEADER LINE,
    **.... Short texts

          lt_drat  LIKE bapi_doc_drat OCCURS 0 WITH HEADER LINE,
    **.... Object links
          lt_drad  LIKE bapi_doc_drad OCCURS 0 WITH HEADER LINE.
    **----------------------------------------------------------------------

     ls_doc-documenttype    = 'DRW'.
     ls_doc-documentnumber  = '4711'.
     ls_doc-documentversion = '00'.
     ls_doc-documentpart    = '000'.
     ls_doc-description    = 'Transmission'.

     ls_doc-laboratory     = ''.
    **  Set indicator for change relevance
     ls_docx-description    = 'X'.
     ls_docX-laboratory     = 'X'.
    ** Insert object links
     CLEAR lt_drad.
     REFRESH lt_drad.

     lt_drad-objecttype = 'MARA'.
     lt_drad-objectkey  = 'M0815'.
     APPEND lt_drad.
    **----------------------------------------------------------------------
    ** Change document
    **----------------------------------------------------------------------

      CALL FUNCTION 'BAPI_DOCUMENT_CHANGE2'
           EXPORTING: documenttype    = ls_doc-documenttype
                      documentnumber  = ls_doc-documentnumber
                      documentpart    = ls_doc-documentpart
                      documentversion = ls_doc-documentversion

                      documentdata    = ls_doc
                      documentdatax   = ls_docx
           IMPORTING: return          = ls_return
           TABLES:    objectlinks     = lt_drad.
    ** Did an error occur ??

     IF ls_return-type CA 'EA'.
       ROLLBACK WORK.
       MESSAGE ID '26' TYPE 'I' NUMBER '000'
               WITH ls_return-message.
     ELSE.
       COMMIT WORK.
     ENDIF.

    Notes

    In addition to the document data you can also change the following data:


  • Object links
  • Classification and characteristic valuations
  • Language dependent document descriptions
  • Document long texts
  • Document structures
  • Original application files

  • 11-Dec-2005


    CheckIn

    CheckIn


    You can use this method to check a document into an archive, a vault,or the SAP database. You can check both original application files (1 and 2) in at the same time.

    When you check a document in, you can set a new status.

    Restrictions:

  • Additional files are not supported

  • Example

    **..... Document key
    DATA: lf_doctype    LIKE bapi_doc_draw-documenttype,
          lf_docnumber  LIKE bapi_doc_draw-documentnumber,
          lf_docpart    LIKE bapi_doc_draw-documentpart,
          lf_docversion LIKE bapi_doc_draw-documentversion,

          lf_status     LIKE bapi_doc_draw-statusextern,
    **.... Bapi return structure
          ls_return LIKE bapiret2.
    **.... Originals
    DATA: lt_files LIKE bapi_doc_files OCCURS 0 WITH HEADER LINE.

    **----------------------------------------------------------------------
    ** Allocate document data
     lf_doctype    = 'DRW'.
     lf_docnumber  = '4711'.
     lf_docversion = '000'.
     lf_docpart    = '00'.

     lf_status     = 'RE'.
    ** Check original 1 into the SAP database
      REFRESH lt_files.
      CLEAR lt_files.
      lt_files-originaltype = '1'.                        " Original 1
      lt_files-datacarrier  = 'SAP-SYSTEM'.               " Check in = SAPDB

      lt_files-docfile      = 'c:\temp\drawing1.dwg'.     " Original file
      APPEND lt_files.
    **----------------------------------------------------------------------
    ** Check in document
    **----------------------------------------------------------------------

     CALL FUNCTION 'BAPI_DOCUMENT_CHECKIN'
          EXPORTING: documenttype    = lf_doctype
                     documentnumber  = lf_docnumber
                     documentpart    = lf_docpart
                     documentversion = lf_docversion

                     hostname        = ''
                     statusintern    = ''
                     statusextern    = lf_status
                     statuslog       = ''
          IMPORTING: return     = ls_return
          TABLES: documentfiles = lt_files.

    ** Error occurred ??
     IF ls_return-type CA 'EA'.
       ROLLBACK WORK.
       MESSAGE ID '26' TYPE 'I' NUMBER '000'
               WITH ls_return-message.
     ELSE.
       COMMIT WORK.

     ENDIF.


    11-Dec-2005


    CheckIn2

    CheckIn2


    You can use a function module to check in a document into an archive, avault, or into the R/3 Database. You can also check in originals "DOCUMENTFILES" at the same time.

    Optional you can also set the following data when you check in a document:


  • Status with log entry
  • Revision level
  • Change number
  • restrictions:

  • Additional files are supported only as interface parameters for future development.
  • Example

    **..... Document key
    DATA: lf_doctype LIKE bapi_doc_draw-documenttype,

    lf_docnumber LIKE bapi_doc_draw-documentnumber,
    lf_docpart LIKE bapi_doc_draw-documenttype,
    lf_docversion LIKE bapi_doc_draw-documentversion,
    lf_status LIKE bapi_doc_draw-statusextern,

    **.... Bapi-Return structure
    ls_return LIKE bapiret2.

    **.... Originals

    DATA: lt_files LIKE bapi_doc_files2 OCCURS 0 WITH HEADER LINE.

    **----------------------------------------------------------------------

    ** Allocate document data
    lf_doctype = 'DRW'.
    lf_docnumber = '4711'.
    lf_docversion = '00'.
    lf_docpart = '000'.
    lf_status = 'RE'.


    ** Check in original 1 into R/3 Database
    REFRESH lt_files.
    CLEAR lt_files.

    lt_files-storagecategory = 'R/3 SYSTEM'. " Storage = R/3-DB
    lt_files-docfile = 'c:\temp\drawing1.dwg'. " Original file
    APPEND lt_files.


    **----------------------------------------------------------------------
    ** Check in document
    **----------------------------------------------------------------------
    CALL FUNCTION 'BAPI_DOCUMENT_CHECKIN2'
    EXPORTING: documenttype = lf_doctype
    documentnumber = lf_docnumber

    documentpart = lf_docpart
    documentversion = lf_docversion
    hostname = ''
    statusintern = ''
    statusextern = lf_status
    statuslog = ''
    IMPORTING: return = ls_return
    TABLES: documentfiles = lt_files.


    ** Error occured ??
    IF ls_return-type CA 'EA'.
    ROLLBACK WORK.
    MESSAGE ID '26' TYPE 'I' NUMBER '000'
    WITH ls_return-message.

    ELSE.
    COMMIT WORK.
    ENDIF.


    11-Dec-2005


    CheckInReplace2

    CheckInReplace2


    Use this function module to check a document into an archive, a vaultor the SAP Database. You can also check in all original application files "DOCUMENTFILES" ate the same time.

    Optional:You can assign the following data when checking in a document:


  • Status with log entry
  • Revision status
  • Change number
  • restrictions:

  • Additional files are currently not supported. Interface parameter, 'COMPONENTS' for future developments vorgesehen
  • Example

    ** Document key
    DATA: lf_doctype LIKE bapi_doc_draw-documenttype,
    lf_docnumber LIKE bapi_doc_draw-documentnumber,

    lf_docpart LIKE bapi_doc_draw-documentpart,
    lf_docversion LIKE bapi_doc_draw-documentversion,
    lf_status LIKE bapi_doc_draw-statusextern,

    ** Bapi Return structure
    ls_return LIKE bapiret2.

    ** Originals
    DATA: lt_files LIKE bapi_doc_files2 OCCURS 0 WITH HEADER LINE.


    ******************************************************************

    ** Assign document data
    lf_doctype = 'DRW'.
    lf_docnumber = '4711'.
    lf_docversion = '00'.
    lf_docpart = '000'.
    lf_status = 'RE'.

    ** Check in original to SAP Database
    REFRESH lt_files.
    CLEAR lt_files.


    lt_files-stroagecategory = 'SAP-SYSTEM'. " Ablage = SAP-DB
    lt_files-docfile = 'c:\temp\drawing1.dwg'. " Originalfile
    APPEND lt_files.

    ******************************************************************
    ** Check in document

    ******************************************************************
    CALL FUNCTION 'BAPI_DOCUMENT_CHECKIN2'
    EXPORTING: documenttype = lf_doctype
    documentnumber = lf_docnumber
    documentpart = lf_docpart
    documentversion = lf_docversion

    hostname = ''
    statusintern = ''
    statusextern = lf_status
    statuslog = ''
    IMPORTING: return = ls_return
    TABLES: documentfiles = lt_files.


    ** Errors ??
    IF ls_return-type CA 'EA'.
    ROLLBACK WORK.
    MESSAGE ID '26' TYPE 'I' NUMBER '000'
    WITH ls_return-message.

    ELSE.
    COMMIT WORK.
    ENDIF.


    11-Dec-2005


    CheckOutModify

    CheckOutModify


    This method is used to check out a document for processing.

    Restrictions:

  • Additional files are not supported.
  • You cannot check out several documents for processing at the same time.
  • Example

    **..... Document key

     DATA: lf_doctype    LIKE bapi_doc_draw-documenttype,
           lf_docnumber  LIKE bapi_doc_draw-documentnumber,
           lf_docpart    LIKE bapi_doc_draw-documenttype,
           lf_docversion LIKE bapi_doc_draw-documenttype,

           lf_filename   LIKE bapi_doc_draw-docfile1,
           lf_status     LIKE bapi_doc_draw-statusextern,
    **.... Bapi-Return structure
           ls_return LIKE bapiret2.
    **----------------------------------------------------------------------

    ** Assign document data
     lf_doctype    = 'DRW'.
     lf_docnumber  = '4711'.
     lf_docversion = '000'.
     lf_docpart    = '00'.
     REFRESH lt_files.
     CLEAR lt_files.
    
    
    ** Define path where you want original to be stored
     lf_filename = 'c:\temp\work.dwg'.
    ** Set new status for document
      lf_status = 'IA'.
    ** Check out document (original 1) for processing

      CALL FUNCTION 'BAPI_DOCUMENT_CHECKOUTMODIFY'
           EXPORTING: documenttype     = lf_doctype
                      documentnumber   = lf_docnumber
                      documentpart     = lf_docpart
                      documentversion  = lf_docversion

                      originaltype     = '1'
                      documentfile     = lf_filename
                      statusextern     = lf_status
            IMPORTING: return = ls_return.
    ** Errors ??
     IF ls_return-type CA 'EA'.

       ROLLBACK WORK.
       MESSAGE ID '26' TYPE 'I' NUMBER '000'
               WITH ls_return-message.
     ELSE.
       COMMIT WORK.
     ENDIF.


    11-Dec-2005


    CheckOutModify2

    CheckOutModify2


    You use this method to check out a document for processing. Optionallyyou can assign the following data when you check in a document:

  • Status with log entry
  • Revision level
  • Change number
  • Restrictions:

  • Additional files are not supported. These exist as interface parameters for future development.

  • You cannot check out several documents for processing.
  • Example

    **..... Document key
    DATA: lf_doctype LIKE bapi_doc_draw-documenttype,
    lf_docnumber LIKE bapi_doc_draw-documentnumber,
    lf_docpart LIKE bapi_doc_draw-documenttype,

    lf_docversion LIKE bapi_doc_draw-documenttype,
    ls_documentfile LIKE bapi_doc_files2,
    ls_checkedoutfile LIKE bapi_doc_files2,
    lf_status LIKE bapi_doc_draw-statusextern,

    **.... Bapi Return structure

    ls_return LIKE bapiret2.


    **----------------------------------------------------------------------

    ** Assign document data

    lf_doctype = 'DRW'.
    lf_docnumber = '4711'.
    lf_docversion = '00'.
    lf_docpart = '000'.

    REFRESH lt_files.
    CLEAR lt_files.

    ** Define path in which the original is to be stored


    ls_documentfile-docfile = 'c:\temp\work.dwg'.

    * alternative

    ls_documentfile-docpath = 'c:\temp\.',

    ls_documentfile-docfile = 'work.dwg'.


    ** Set new status for document
    lf_status = 'IA'.

    ** Check out document (Original 1) for changes

    CALL FUNCTION 'BAPI_DOCUMENT_CHECKOUTMODIFY2'
    EXPORTING: documenttype = lf_doctype
    documentnumber = lf_docnumber
    documentpart = lf_docpart
    documentversion = lf_docversion
    documentfile = ls_documentfile

    statusextern = lf_status
    IMPORTING: return = ls_return
    checkedoutfile = ls_checkedoutfile.

    ** Errors ??
    IF ls_return-type CA 'EA'.
    ROLLBACK WORK.
    MESSAGE ID '26' TYPE 'I' NUMBER '000'
    WITH ls_return-message.

    ELSE.
    COMMIT WORK.
    ENDIF.


    11-Dec-2005


    CheckOutSet2

    CheckOutSet2


    Use this method to check out a document for processing without physically transporting the original.

    The originals are then set to status checked-out.

    Example

    ** Document key
    DATA: lf_doctype LIKE bapi_doc_draw-documenttype,

    lf_docnumber LIKE bapi_doc_draw-documentnumber,
    lf_docpart LIKE bapi_doc_draw-documentpart,
    lf_docversion LIKE bapi_doc_draw-documentversion,
    ls_documentfile LIKE bapi_doc_files2,
    ls_checkedoutfile LIKE bapi_doc_files2,
    lf_status LIKE bapi_doc_draw-statusextern,


    ** Bapi Return structure

    ls_return LIKE bapiret2.

    ***************************************************************

    ** Assign document data

    lf_doctype = 'DRW'.
    lf_docnumber = '4711'.
    lf_docversion = '00'.
    lf_docpart = '000'.


    REFRESH lt_files.
    CLEAR lt_files.

    ** Define path shown by original

    ls_documentfile-docfile = 'c:\temp\work.dwg'.

    * Alternative

    ls_documentfile-docpath = 'c:\temp\.',

    ls_documentfile-docfile = 'work.dwg'.


    ** Set new status for document
    lf_status = 'IA'.

    ** Check out original for change

    CALL FUNCTION 'BAPI_DOCUMENT_CHECKOUTSET2'
    EXPORTING: documenttype = lf_doctype
    documentnumber = lf_docnumber
    documentpart = lf_docpart
    documentversion = lf_docversion
    documentfile = ls_documentfile

    statusextern = lf_status
    IMPORTING: return = ls_return
    checkedoutfile = ls_checkedoutfile.

    ** Errors ??
    IF ls_return-type CA 'EA'.
    ROLLBACK WORK.
    MESSAGE ID '26' TYPE 'I' NUMBER '000'
    WITH ls_return-message.

    ELSE.
    COMMIT WORK.
    ENDIF.


    11-Dec-2005


    CheckOutView

    CheckOutView


    You can use this method to check out a document and any existing document structure for display.

    You can use the "GetStructure" button if you want to check out thedocument structure aswell. The "DocumentStructure" table is used to define how many documents should be checked out in the document
    structure (certain documents may be checked out in current status).When the documents are transferred to the function module using the"DocumentStructure" table, only the documents that you have preselected are checked out.

    Restrictions:

  • Additional files are not supported.

  • Example

    **..... Document key
     DATA: lf_doctype    LIKE bapi_doc_draw-documenttype,
           lf_docnumber  LIKE bapi_doc_draw-documentnumber,
           lf_docpart    LIKE bapi_doc_draw-documenttype,
           lf_docversion LIKE bapi_doc_draw-documenttype,

           lf_pathname   LIKE bapi_doc_draw-docfile1,
    **.... Bapi return structure
           ls_return LIKE bapiret2.
    **.... Originals that have been checked out
     DATA: lt_files LIKE bapi_doc_files OCCURS 0 WITH HEADER LINE.

    **----------------------------------------------------------------------
    ** Allocate document data
     lf_doctype    = 'DRW'.
     lf_docnumber  = '4711'.
     lf_docversion = '000'.
     lf_docpart    = '00'.

     REFRESH lt_files.
     CLEAR lt_files.
    ** Define path where file is stored
     lf_pathname = 'c:\temp\'.
    ** Check out document (original 1) for viewing
     CALL FUNCTION 'BAPI_DOCUMENT_CHECKOUTVIEW'

          EXPORTING: documenttype      = lf_doctype
                     documentnumber    = lf_docnumber
                     documentpart      = lf_docpart
                     documentversion   = lf_docversion
                     originaltype      = '1'

                     getstructure      = '1'
                     originalpath      = lf_pathname
                     hostname          = ' '
         IMPORTING:  return            = ls_return
         TABLES:     documentfiles     = lt_files.

    ** Errors occurred ??
     IF ls_return-type CA 'EA'.
       ROLLBACK WORK.
       MESSAGE ID '26' TYPE 'I' NUMBER '000'
               WITH ls_return-message.
     ELSE.
       COMMIT WORK.

     ENDIF.


    11-Dec-2005


    CheckOutView2

    CheckOutView2


    You use this function module to check out originals of a document and available dokument structures for display.

    The function module BAPI_DOCUMENT_CHECKOUTVIEW has been enhanced toallow checking out document types that have two originals allocated to them.


    The parameter DOCUMENTFILE controls which original you want to check out.

  • You can decide with the switch GetStructure whether an availabledocument structure can also be checked out. The application (DOCUMENTFILE-WSAPPLICATION) is also available as a selection criterion.
  • The table DocumentStructure is used to define which documents ofthe structure you want to check out (certain documents can already have been checked out in the current status).
  • Only consistent documents in a table are checked out.

  • If no entry is made the function module checks out all documents of the structure for display.
  • Restrictions:

  • Additional files are supported only as interface parameters for future developments.
  • Example



    **..... Document key
    DATA: lf_doctype LIKE bapi_doc_draw-documenttype,
    lf_docnumber LIKE bapi_doc_draw-documentnumber,
    lf_docpart LIKE bapi_doc_draw-documenttype,
    lf_docversion LIKE bapi_doc_draw-documenttype,
    lf_pathname LIKE bapi_doc_draw-docfile1,


    **.... Bapi-Returnstruktur
    ls_return LIKE bapiret2.

    **.... Originals that were checked out
    DATA: lt_files LIKE bapi_doc_files2 OCCURS 0 WITH HEADER LINE.

    DATA: ls_documentfile LIKE bapi_doc_files2.

    **----------------------------------------------------------------------


    ** Allocate document data
    lf_doctype = 'DRW'.
    lf_docnumber = '4711'.
    lf_docversion = '000'.
    lf_docpart = '00'.

    REFRESH lt_files.
    CLEAR lt_files.

    ** Define path in which original is stored
    lf_pathname = 'c:\temp\'.


    ls_documentfile-wsapplication = 'TXT'.

    ** Document (Originals of application type WRD) check out for viewing
    CALL FUNCTION 'BAPI_DOCUMENT_CHECKOUTVIEW2'
    EXPORTING: documenttype = lf_doctype
    documentnumber = lf_docnumber
    documentpart = lf_docpart

    documentversion = lf_docversion
    documentfile = ls_documentfile
    getstructure = '1'
    originalpath = lf_pathname
    hostname = ' '
    IMPORTING: return = ls_return

    TABLES: documentfiles = lt_files.

    ** Error occurred ??
    IF ls_return-type CA 'EA'.
    ROLLBACK WORK.
    MESSAGE ID '26' TYPE 'I' NUMBER '000'
    WITH ls_return-message.

    ELSE.
    COMMIT WORK.
    ENDIF.


    11-Dec-2005


    CheckOutViewMultiple

    CheckOutViewMultiple


    This function module makes it possible to display several documents at once.

    You have two possbilities:

  • You can list documents in the table Documents and in enter in the workstation applications in the table
    WSApplication
    that more clearly identify the originals.
  • The data of the documents is read. The first original found is checkedout that has the same workstation application as a workstation application in the table WSApplication.


  • You can olso enter originals directly in the table DocumentFiles.
  • Restrictions:

  • Additional files are not supported.
  • Example

    DATA: lt_documentdata LIKE bapi_doc_draw2 OCCURS 0 WITH HEADER LINE,

    lt_documentfiles_in LIKE bapi_doc_files2 OCCURS 0 WITH HEADER LINE,


    lt_documentfiles_out LIKE bapi_doc_files2 OCCURS 0 WITH HEADER LINE,

    lt_wsapplication LIKE bapi_doc_files2 OCCURS 0 WITH HEADER LINE,

    DATA: return LIKE bapiret2.

    CLEAR lt_documentdata.

    REFRESH lt_documentdata.


    (a)

    lt_documentdata-documentnumber = 'dd01'.

    lt_documentdata-documenttype = 'drw'.

    lt_documentdata-documentversion = '00'.

    lt_documentdata-documentpart = '000'.

    APPEND lt_documentdata.

    lt_documentdata-documentnumber = 'dd01'.


    lt_documentdata-documenttype = 'drw'.

    lt_documentdata-documentversion = '01'.

    lt_documentdata-documentpart = '000'.

    APPEND lt_documentdata.

    lt_documentdata-documentnumber = 'dd01'.

    lt_documentdata-documenttype = 'drw'.


    lt_documentdata-documentversion = '02'.

    lt_documentdata-documentpart = '000'.

    APPEND lt_documentdata.

    CLEAR lt_wsapplication.

    REFRESH lt_wsapplication.

    lt_wsapplication-wsappl = 'ASM'.

    APPEND lt_wsapplication.


    lt_wsapplication-wsappl = 'PRT'.

    APPEND lt_wsapplication.

    CLEAR: lt_documentfiles_out.

    REFRESH: lt_documentfiles_out.

    CALL FUNCTION 'BAPI_DOCUMENT_CHECKOUTVIEWX'

    EXPORTING

    getcomponents = '1'


    originalpath = 'C:\TEMP\trash\'

    hostname = ' '

    IMPORTING

    return = return

    TABLES

    documents = lt_documentdata

    documentfiles_out = lt_documentfiles_out


    wsapplication = lt_wsapplication.

    (b)

    CLEAR: lt_documentfiles_in, lt_documentfiles_out.

    REFRESH: lt_documentfiles_in, lt_documentfiles_out.

    lt_documentfiles_in-originaltype = '1'.


    lt_documentfiles_in-documentnumber = 'dd01'.

    lt_documentfiles_in-documenttype = 'drw'.

    lt_documentfiles_in-documentversion = '00'.

    lt_documentfiles_in-documentpart = '000'.

    lt_documentfiles_in-originaltype = '1'.

    APPEND lt_documentfiles_in.


    lt_documentfiles_in-originaltype = '1'.

    lt_documentfiles_in-documentnumber = 'dd01'.

    lt_documentfiles_in-documenttype = 'drw'.

    lt_documentfiles_in-documentversion = '01'.

    lt_documentfiles_in-documentpart = '000'.

    lt_documentfiles_in-originaltype = '1'.


    APPEND lt_documentfiles_in.

    lt_documentfiles_in-originaltype = '1'.

    lt_documentfiles_in-documentnumber = 'dd01'.

    lt_documentfiles_in-documenttype = 'drw'.

    lt_documentfiles_in-documentversion = '02'.

    lt_documentfiles_in-documentpart = '000'.


    lt_documentfiles_in-originaltype = '1'.

    APPEND lt_documentfiles_in.

    CALL FUNCTION 'BAPI_DOCUMENT_CHECKOUTVIEWX'

    EXPORTING

    getcomponents = '1'

    originalpath = 'C:\TEMP\trash\'

    hostname = ' '


    IMPORTING

    return = return

    TABLES

    documentfiles_in = lt_documentfiles_in

    documentfiles_out = lt_documentfiles_out

    wsapplication = lt_wsapplication.

    IF return-type CA 'EA'.


    ROLLBACK WORK.

    WRITE: / '**************** FEHLER ******************'.

    WRITE:/ return-message.

    ELSE.

    COMMIT WORK.

    WRITE: / '**************** ERFOLG ******************'.

    ENDIF.


    11-Dec-2005


    Create2

    Create2


    You can use this function module to create documents and all data thatbelongs to it. You can create a document info record with the following data:

  • Langauge dependent short and long texts
  • Any number of originals
  • Object links
  • Classification characteristics

  • Document structures
  • You can also check in the original application files into the R/3 Database, vault, or archive.

    Restrictions:

  • Additional files supported only as interface parameters COMPONENTS for future development.
  • Valuations of object links are not supported.

  • Example


    **..... Document data
    DATA: ls_doc LIKE bapi_doc_draw2.

    **..... Bapi-Returnstruktur
    ls_return LIKE bapiret2.

    **.... Key feilds of the document
    DATA: lf_doctype LIKE bapi_doc_draw2-documenttype,
    lf_docnumber LIKE bapi_doc_draw2-documentnumber,
    lf_docpart LIKE bapi_doc_draw2-documenttype,

    lf_docversion LIKE bapi_doc_draw2-documenttype.

    **.... Originals that are checked in simultaneously
    DATA: lt_files LIKE bapi_doc_files2 OCCURS 0 WITH HEADER LINE,

    **.... Short texts
    lt_drat LIKE bapi_doc_drat OCCURS 0 WITH HEADER LINE,

    **.... Object links

    lt_drad LIKE bapi_doc_drad OCCURS 0 WITH HEADER LINE.
    **----------------------------------------------------------------------

    ** Allcoate document data
    ls_doc-documenttype = 'DRW'.
    ls_doc-documentnumber = '4711'.
    ls_doc-documentversion = '00'.

    ls_doc-documentpart = '000'.

    ls_doc-statusextern = 'AF'.
    ls_doc-laboratory = '001'.


    ** Check in original 1 simultaneously in the R/3 Database
    REFRESH lt_files.
    CLEAR lt_files.

    lt_files-storagecategory = 'SAP-SYSTEM'.
    lt_files-docfile = 'c:\temp\drawing.txt'.
    lt_wsapplication = 'TXT'.

    APPEND lt_files.

    lt_files-storagecategory = 'VAULT'.
    lt_files-docfile = 'c:\temp\drawing.dwg'.
    lt_wsapplication = 'DWG'.
    APPEND lt_files.

    lt_files-storagecategory = 'SAP-SYSTEM'.
    lt_files-docfile = 'c:\temp\drawing.ppt'.
    lt_wsapplication = 'PPT'.
    APPEND lt_files.

    ** Short texts

    CLEAR lt_drat.
    REFRESH lt_drat.

    ** German short text
    lt_drat-language = 'DE'.
    lt_drat-description = 'Getriebe'.
    APPEND lt_drat.

    ** English short text
    lt_drat-language = 'EN'.
    lt_drat-description = 'gear'.
    APPEND lt_drat.

    ** Object link to material master
    CLEAR lt_drad.
    REFRESH lt_drad.

    lt_drad-objecttype = 'MARA'.
    lt_drad-objectkey = 'M4711'.
    APPEND lt_drad.

    * ---------------------------------------------------------------------
    * Create document
    * ---------------------------------------------------------------------
    CALL FUNCTION 'BAPI_DOCUMENT_CREATE2'

    EXPORTING: documentdata = ls_doc
    IMPORTING: documenttype = lf_doctype
    documentnumber = lf_docnumber
    documentpart = lf_docpart
    documentversion = lf_docversion
    return = ls_return

    TABLES: documentdescriptions = lt_drat
    objectlinks = lt_drad
    documentfiles = lt_files.

    ** Did an error occur ??
    IF ls_return-type CA 'EA'.
    ROLLBACK WORK.
    MESSAGE ID '26' TYPE 'I' NUMBER '000'
    WITH ls_return-message.

    ELSE.
    COMMIT WORK.
    ENDIF.

    Notes

    You can insert the following data in addition to document data:

  • Object links
  • Classifications and characteristic valuation
  • Language dependent document descriptions
  • Long text documents
  • Document structure

  • Originals

  • 11-Dec-2005


    CreateFromData

    CreateFromData


    You can use this method to create documents and their respective data.

    You can also check the original application files (1 and 2) into the SAP data base, vault, or archive.

    Restrictions:

  • Additional files are not supported
  • Long texts for object links are not supported

  • Value assignments for the object links are not supported
  • Example

    **..... Document data
    DATA: ls_doc    LIKE bapi_doc_draw.
    **..... Bapi return structure
          ls_return LIKE bapiret2.

    **.... key fields of new document
    DATA: lf_doctype    LIKE bapi_doc_draw-documenttype,
          lf_docnumber  LIKE bapi_doc_draw-documentnumber,
          lf_docpart    LIKE bapi_doc_draw-documenttype,
          lf_docversion LIKE bapi_doc_draw-documenttype.

    **.... Originals that are checked in at the same time
    DATA: lt_files LIKE bapi_doc_files OCCURS 0 WITH HEADER LINE,
    **.... Descriptions
          lt_drat  LIKE bapi_doc_drat OCCURS 0 WITH HEADER LINE,

    **.... Object links
          lt_drad  LIKE bapi_doc_drad OCCURS 0 WITH HEADER LINE.
    **----------------------------------------------------------------------
    ** Allocate document data
     ls_doc-documenttype    = 'DRW'.

     ls_doc-documentnumber  = '4711'.
     ls_doc-documentversion = '000'.
     ls_doc-documentpart    = '00'.
     ls_doc-description    = 'Gear box'.
     ls_doc-statusextern   = 'AF'.
     ls_doc-laboratory     = '001'.

     ls_doc-wsapplication1 = 'DWG'.
    ** Check original 1 into the SAP data base at the same time
     REFRESH lt_files.
     CLEAR lt_files.
     lt_files-originaltype = '1'.
     lt_files-datacarrier  = 'SAP-SYSTEM'.

     lt_files-docfile      = 'c:\temp\drawing1.dwg'.
     APPEND lt_files.
    ** Description in english
     CLEAR lt_drat.
     REFRESH lt_drat.
     lt_drat-language    = 'EN'.
     lt_drat-description = 'gear'.

     APPEND lt_drat.
    ** Object link to material master
     CLEAR lt_drad.
     REFRESH lt_drad.
     lt_drad-objecttype = 'MARA'.
     lt_drad-objectkey  = 'M4711'.
     APPEND lt_drad.
    * ---------------------------------------------------------------------

    * Create document
    * ---------------------------------------------------------------------
     CALL FUNCTION 'BAPI_DOCUMENT_CREATE'
          EXPORTING: documentdata         = ls_doc
          IMPORTING: documenttype         = lf_doctype

                     documentnumber       = lf_docnumber
                     documentpart         = lf_docpart
                     documentversion      = lf_docversion
                     return               = ls_return
         TABLES: documentdescriptions = lt_drat

                 objectlinks          = lt_drad
                 documentfiles        = lt_files.
    ** Error occurred ??
      IF ls_return-type CA 'EA'.
        ROLLBACK WORK.
        MESSAGE ID '26' TYPE 'I' NUMBER '000'

                WITH ls_return-message.
      ELSE.
        COMMIT WORK.
      ENDIF.

    Notes

    Apart from the document data, you can create the following data:

  • Object links
  • Classifications and characteristic value assignments

  • Language-dependent document descriptions
  • Document long texts
  • Document structures
  • Originals (1 and 2)

  • 11-Dec-2005


    CreateFromData2

    CreateFromData2


    You can use this function module to create documents and all data thatbelongs to it. You can create a document info record with the following data:

  • Langauge dependent short and long texts
  • Any number of originals
  • Object links
  • Classification characteristics

  • Document structures
  • You can also check in the original application files into the R/3 Database, vault, or archive.

    Restrictions:

  • Additional files supported only as interface parameters COMPONENTS for future development.
  • Valuations of object links are not supported.

  • Example


    **..... Document data
    DATA: ls_doc LIKE bapi_doc_draw2.

    **..... Bapi-Returnstruktur
    ls_return LIKE bapiret2.

    **.... Key feilds of the document
    DATA: lf_doctype LIKE bapi_doc_draw2-documenttype,
    lf_docnumber LIKE bapi_doc_draw2-documentnumber,
    lf_docpart LIKE bapi_doc_draw2-documenttype,

    lf_docversion LIKE bapi_doc_draw2-documenttype.

    **.... Originals that are checked in simultaneously
    DATA: lt_files LIKE bapi_doc_files2 OCCURS 0 WITH HEADER LINE,

    **.... Short texts
    lt_drat LIKE bapi_doc_drat OCCURS 0 WITH HEADER LINE,

    **.... Object links

    lt_drad LIKE bapi_doc_drad OCCURS 0 WITH HEADER LINE.
    **----------------------------------------------------------------------

    ** Allcoate document data
    ls_doc-documenttype = 'DRW'.
    ls_doc-documentnumber = '4711'.
    ls_doc-documentversion = '00'.

    ls_doc-documentpart = '000'.

    ls_doc-statusextern = 'AF'.
    ls_doc-laboratory = '001'.


    ** Check in original 1 simultaneously in the R/3 Database
    REFRESH lt_files.
    CLEAR lt_files.

    lt_files-storagecategory = 'SAP-SYSTEM'.
    lt_files-docfile = 'c:\temp\drawing.txt'.
    lt_wsapplication = 'TXT'.

    APPEND lt_files.

    lt_files-storagecategory = 'VAULT'.
    lt_files-docfile = 'c:\temp\drawing.dwg'.
    lt_wsapplication = 'DWG'.
    APPEND lt_files.

    lt_files-storagecategory = 'SAP-SYSTEM'.
    lt_files-docfile = 'c:\temp\drawing.ppt'.
    lt_wsapplication = 'PPT'.
    APPEND lt_files.

    ** Short texts

    CLEAR lt_drat.
    REFRESH lt_drat.

    ** German short text
    lt_drat-language = 'DE'.
    lt_drat-description = 'Getriebe'.
    APPEND lt_drat.

    ** English short text
    lt_drat-language = 'EN'.
    lt_drat-description = 'gear'.
    APPEND lt_drat.

    ** Object link to material master
    CLEAR lt_drad.
    REFRESH lt_drad.

    lt_drad-objecttype = 'MARA'.
    lt_drad-objectkey = 'M4711'.
    APPEND lt_drad.

    * ---------------------------------------------------------------------
    * Create document
    * ---------------------------------------------------------------------
    CALL FUNCTION 'BAPI_DOCUMENT_CREATE2'

    EXPORTING: documentdata = ls_doc
    IMPORTING: documenttype = lf_doctype
    documentnumber = lf_docnumber
    documentpart = lf_docpart
    documentversion = lf_docversion
    return = ls_return

    TABLES: documentdescriptions = lt_drat
    objectlinks = lt_drad
    documentfiles = lt_files.

    ** Did an error occur ??
    IF ls_return-type CA 'EA'.
    ROLLBACK WORK.
    MESSAGE ID '26' TYPE 'I' NUMBER '000'
    WITH ls_return-message.

    ELSE.
    COMMIT WORK.
    ENDIF.

    Notes

    You can insert the following data in addition to document data:

  • Object links
  • Classifications and characteristic valuation
  • Language dependent document descriptions
  • Long text documents
  • Document structure

  • Originals

  • 11-Dec-2005


    CreateFromSource

    CreateFromSource


    This function module is old. Please use Bapi_Document_Createfromsource2.

    You can use this method to create a new document by copying from an existing document.

    Notes

  • When the new document is created, any document structure that may exist is also copied.

  • You can define whether all, only specific, or no object links are copied.

  • 11-Dec-2005


    CreateFromSource2

    CreateFromSource2


    You use this function for creating new documents using a template.

    Optionally you can assign the following data:

  • Status log entry
  • Revision level
  • Change number
  • Notes

  • An existing document structure is copied when you create a new document.

  • You can define how you want to copy the object links:
  • Copye Value for OBJECTTYPE

    all *

    Only certain <Database table>

    None Blank

    Explanation of the <Database table>


    The internal descriptions from the table TCLO (for example, MARA for material) are used for the object type OBJECTTYPE.

    The object key OBJECTKEY is made of key fields of the SAP object that is also in the table TCLO.


    11-Dec-2005


    CreateNewVersion

    CreateNewVersion


    This function module is obsolete. Use: Bapi_Document_CreateNewVersion2.

    You can use this method to create a new version for an existing document.

    Notes

  • When you create the new document, any existing document structure is also copied.

  • You can define whether all, only specific, or no object links at all should be copied.

  • 11-Dec-2005


    CreateNewVersion2

    CreateNewVersion2


    You use this function module to create new versions of documents. Optionally the following data can be changed:

  • Log entry
  • Revision level
  • Change number
  • Notes

  • You can copy an available document structure when creating a new document.

  • You can also set how you want to copy object links:
  • Copy Value for OBJECTTYPE

    all *

    Only certain <Databasetable>

    none Blank

    Explanation for <Databasetable>


    The internal descriptions from the table TCLO (for example, MARA formaterial) are used for the object type OBJECTTYPE. The object keyOBJECTKEY contains the kex fields of the SAP Object that is also taken from the table TCLO.


    11-Dec-2005


    Delete

    Delete


    You can use this method to delete documents.


    11-Dec-2005


    Dequeue

    Dequeue


    You can use this method to withdraw a change lock.


    11-Dec-2005


    Enqueue

    Enqueue


    You can use this method to lock a document against a change.

    Notes

    The lock is withdrawn by either the following change BAPI or by calling BAPI_DOCUMENT_DEQUEUE.


    11-Dec-2005


    ExistenceCheck1

    ExistenceCheck1


    ou can use this method to check whether a document exists.


    11-Dec-2005


    GetActualVersion

    GetActualVersion


    You can use this method to determine the current and valid version of a document.

    Notes

    You can use the "ReleasedOnly" button to determine whether just the released versions or all the versions should be determined.


    11-Dec-2005


    GetApplication

    GetApplication


    You can use this method to determine all the Customizing settings for one work station application.


    11-Dec-2005


    GetDataCarrierDetail

    GetDataCarrierDetail


    You can use this method to determine the Customizing settings for a specific data carrier.


    11-Dec-2005


    GetDataCarrierList

    GetDataCarrierList


    ou can use this method to determine the data carriers defined in Customizing.

    You can use the appropriate button to define which types of datacarrier should be displayed, for example, only archives, vaults, and so on.

    Notes

    See also: BAPI_DOCUMENT_GETDCDETAIL


    11-Dec-2005


    GetDCList2

    GetDCList2


    You can use this method to report the data carriers that are defined in Customizing.

    You can use each switch to define which tyoe of data carrier you want to display, for example, only archives, vaults and so on.

    Notes

    See also BAPI_DOCUMENT_GETDCDETAIL


    11-Dec-2005


    GetDetail

    GetDetail


    This function module is old. Please use Bapi_Document_GetDetail2.

    You can use this method to determine detailed data for a document.

    Notes

    The following data can be read:

  • Main document data
  • Short texts/descriptions

  • Long texts
  • Object links

  • 11-Dec-2005


    GetDetail2

    GetDetail2


    You can use this method to set detail data for a document. The following import parameters are available for controlling output:

  • GetObjectLinks
  • GetStatusLog
  • GetLongTexts
  • GetActiveFiles
  • Setting additional files is not supported. Future development supports the interface parameters GetComponents and COMPONENTS.


    Example

    ** Document key
    DATA: lf_doctype LIKE bapi_doc_draw-documenttype,
    lf_docnumber LIKE bapi_doc_draw-documentnumber,
    lf_docpart LIKE bapi_doc_draw-documenttype,
    lf_docversion LIKE bapi_doc_draw-documenttype.


    ** Bapi-Return structure
    ls_return LIKE bapiret2.


    ** Originals Document hierarchy
    DATA: lt_files LIKE bapi_doc_files2 OCCURS 0 WITH HEADER LINE,
    ls_document LIKE bapi_doc_draw2.

    *********************************************************************

    ** Allocate document data
    lf_doctype = 'DRW'.
    lf_docnumber = '4711'.
    lf_docversion = '00'.

    lf_docpart = '000'.

    REFRESH lt_files.
    CLEAR lt_files.

    ** Set detail information for the document
    CALL FUNCTION 'BAPI_DOCUMENT_GETDETAIL2'
    EXPORTING: documenttype = lf_doctype
    documentnumber = lf_docnumber
    documentpart = lf_docpart

    documentversion = lf_docversion
    getobjectlinks = 'X'
    getstatuslog = 'X'
    getlongtexts = 'X'
    getactivefiles = 'X'
    IMPORTING:
    documentdata = ls_document
    return = ls_return

    TABLES: documentfiles = lt_files.

    ** Did error occur ??
    IF ls_return-type CA 'EA'.
    MESSAGE ID '26' TYPE 'I' NUMBER '000'
    WITH ls_return-message.
    ENDIF.

    Notes

    The following data can be read:


  • Document main data
  • Short texts
  • Long texts
  • Object links
  • Originals

  • 11-Dec-2005


    GetDocumentTypeDetail

    GetDocumentTypeDetail


    You can use this method to determine the Customizing settings for a specific document type.


    11-Dec-2005


    GetFrontendType

    GetFrontendType


    You can use this method to determine the appropriate front end type for a front end computer.


    11-Dec-2005


    GetList

    GetList


    You can use this method to find a document and select a list of documents. A table containing the document data is created.

    You can use the "MAXROWS" parameter to restrict the number of selected documents in the hit list.

    Example

    **... List of selected documents

    DATA: LT_DOC_DATA  LIKE BAPI_DOC_DRAW  OCCURS 0 WITH HEADER LINE,
    **... Value range for document number
          LT_DOCNR_SEL LIKE BAPI_DOC_SELNR OCCURS 0 WITH HEADER LINE,
    **... Bapi return structure

          LS_RETURN LIKE BAPIRET2,
    **... Max.  number of data records that are returned
          LF_MAXROWS LIKE BAPI_DOC_AUX-MAXROWS,
    **... Number of data records (number of records in the hit list)
          LF_FOUNDROWS LIKE BAPI_DOC_AUX-MAXROWS.

    **----------------------------------------------------------------------
    ** Construct value range for document number
     CLEAR: LT_DOCNR_SEL.
     LT_DOCNR_SEL-SIGN   = 'I'.
     LT_DOCNR_SEL-OPTION = 'CP'.

     LT_DOCNR_SEL-DOCUMENTNUMBER_LOW = 'JB*'.

    APPEND LT_DOCNR_SEL.

    ** Select documents
     CALL FUNCTION 'BAPI_DOCUMENT_GETLIST'
        EXPORTING: DOCUMENTTYPE       = 'DRW'
                   DESCRIPTION        = 'Gear*'

                   MAXROWS            = 250           " max 250 data records
        IMPORTING: FOUNDROWS          = LF_FOUNDROWS
                   RETURN             = LS_RETURN
        TABLES:    DOCNUMBERSELECTION = LT_DOCNR_SEL

                   DOCUMENTLIST       = LT_DOC_DATA.
    ** Errors occurred ??
     IF ls_return-type CA 'EA'.
       MESSAGE ID '26' TYPE 'E' NUMBER '000'
               WITH ls_return-message.
       EXIT.
     ENDIF.

     LOOP AT LT_DOC_DATA.
      ....
      ....
    ENDLOOP.

    Notes

    You can use the following data as search criteria:

  • Document type
  • Document number (as value range from ... to ...)
  • Document part

  • Document version
  • Description
  • Person responsible
  • Authorization group
  • Office/laboratory
  • Change number
  • Deletion flag
  • Data carrier
  • CAD indicator
  • Work station application
  • Document status

  • 11-Dec-2005


    GetObjectDocuments

    GetObjectDocuments


    You can use this method to determine all the documents that are linked to an object (for example, material master).

    Notes

  • The internal descriptions from TCLO are used for the object type (for example, MARA for material master).
  • The object key is copied as a string (according to TCLO).

  • 11-Dec-2005


    GetStatus

    GetStatus


    You can use this method to read the current status of the document.

    Notes

    The external language-dependent status abbreviation (in the appropriate logon language) and the internal status are entered.


    11-Dec-2005


    GetStatusList

    GetStatusList


    You can use this method to determine the features of the status that are defined in Customizing.

    If no status is entered, all the statuses that are defined for the document type are determined.

    These are, for example:

  • List of all the statuses (F4 help)

  • Status network
  • Status types
  • .....

  • 11-Dec-2005


    GetStructure

    GetStructure


    You can use this method to determine the document structure for an existing document.


    11-Dec-2005


    Load

    Load


    This function module is for mass data transfer using the data transfersupported by the Workbench. You can create and change dokument inforecords. IDOCs serve as data interfaces. The correct segment type is 'DOCUMENT_LOAD01'.

    The behavior of the function module for creating and changing documents is different than its behavior in normal dialog.


    The differences are:

  • No consistency check of the status network. This makes it possible to create documents directly from the release status.
  • No status depenedent checks
  • No checks whether a function such as check-in is inactive

  • No check whether a field is a required field or ready for entry
  • If a document already exists and you want to overwrite it, all data including the original data is overwritten without warning.
  • You can run these checks before the actual data transfer.


    It is possible to create a document info record with the following data:

  • The actual document data
  • Language dependent short texts and long texts
  • Object links
  • Valuations and long texts of object links are not supported


  • Originals and additional files
  • Original application files can be checked in directly to the storagecategories. Original applications files must accessible to the frontend. The transport of originals occurs automatically from thefrontend into the appropriate storage systems. This means that you must not call the function module using a batch-job.


  • Classification and evaluations
  • Status log data

  • 11-Dec-2005


    SetFrontendType

    SetFrontendType


    You can use this method to set the appropriate front end type for a front end computer.


    11-Dec-2005


    SetStatus

    SetStatus


    You can use this method to set a new status for the document.

    Notes

    The internal and external status is displayed. Basically the followingapplies: if the internal status is displayed, this has priority, otherwise the internal status is read via the external status
    abbreviation.


    11-Dec-2005