Fonction SAP BAPI_DOCUMENT_CHANGE - Change Document

Paramètre Reférence Type Long. Valeur par déf. Facultatif Description
DOCUMENTDATA BAPI_DOC_DRAW u 1364 Document Data
DOCUMENTDATAX BAPI_DOC_DRAWX u 40 Indicator for Relevancy to Change
DOCUMENTNUMBER BAPI_DOC_AUX-DOCNUMBER C 25 Document Number
DOCUMENTPART BAPI_DOC_AUX-DOCPART C 3 Document Part
DOCUMENTTYPE BAPI_DOC_AUX-DOCTYPE C 3 Document Type
DOCUMENTVERSION BAPI_DOC_AUX-DOCVERSION C 2 Document Version
HOSTNAME BAPI_DOC_AUX-HOSTNAME C 20 SPACE X Name of Frontend

Paramètre Reférence Type Long. Description
RETURN BAPIRET2 u 548 BAPI Return

Paramètre Reférence Long. Facultatif Description
CHARACTERISTICVALUES BAPI_CHARACTERISTIC_VALUES 82 X Assigned Characteristic Values
CLASSALLOCATIONS BAPI_CLASS_ALLOCATION 36 X Classifications
DOCUMENTDESCRIPTIONS BAPI_DOC_DRAT 45 X Short texts
DOCUMENTFILES BAPI_DOC_FILES 336 X Originals to Check In
DOCUMENTSTRUCTURE BAPI_DOC_STRUCTURE 64 X Document-Based Structure
LONGTEXTS BAPI_DOC_TEXT 136 X Long Texts
OBJECTLINKS BAPI_DOC_DRAD 215 X Object Links

Functionality

This function module is obsolete. Use Bapi_Document_Change2instead.
You can use this method to change documents.
You can also check the original application files (1 and 2) into the SAPdatabase, 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

  • **..... 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)
    • Description
      Return structure for messages

      Description
      General document data

      Description
      Identifies the parameters that are relevant to the change in theDocumentData. For every parameter in DocumentData, there is acorresponding "marking parameter" in DocumentDataX. Only the fieldsmarked with an X here are used for changing the document data.

      Default

      Description
      Computer name of the front end computer that the BAPI was called from.

      This only needs to be entered if the function module call takes placefrom an external system.

      The appropriate front end type is determined from Customizing for the

      DMS using this computer name.

      Description
      Characteristic value assignment for document
      The required class and characteristic definitions must be determinedbeforehand. If you want to delete characteristic value assignments, youmust explicitly set the "DELETEVALUE" deletion indicator for thecharacteristic in question.
      The appropriate classifications are transferred via CLASSALLOCATION.

      Description
      Classification for document
      The class and characteristic definitions required must be determinedbeforehand. If you want to delete classifications, you must set the"DELETEVALUE" deletion indicator explicitly for the appropriate class.
      The appropriate characteristic values are delivered usingCHARACTERISTICVALUES.

      Description
      Document descriptions
      The texts that are delivered are always added to those that alreadyexist. If you want to delete texts, you must set the "DELETEVALUE"deletion indicator explicitly for the appropriate language.

      Description
      Originals for document
      You can check in original 1 and 2 at the same time. The ORIGINALTYPEparameter controls whether original or original 2 should be checked in.
      ORIGINALTYPE: Original 1 or orginal 2
      SOURCEDATACARRIER: possible data carrier name of a server where theoriginal is stored
      DATACARRIER: name of the data carrier that the original is to bechecked into. The function module determines the storage type, forexample, SAP data base, vault, or archive, using this data carriername.
      DOCFILE: file name of original
      WSAPPLICATION: name of the workstation application. This entry isrequired if the document info record has not yet been allocated to aworkstation application or the new "original" is of a different type.
      The parameters: INTERNAL STATUS, EXTERNAL STATUS, STATUS LOG have norelevance to this function module.

      Description
      Document structure for document
      You can use this to represent document structures for a headerdocument, for example assembly structures for 3D models. A documentstructure is always copied comnpletely. This means that an existingstructure is always overwritten with the new one. If you want to deletespecific items in a structure or BOM, you must explicitly set the"DELETEVALUE" deletion indicator for the item(s) in question.
      All the documents that are copied in the structure must have already

      Description
      Long text for document
      The long texts are always added to those already existing. If you wantto delete text, you must explicitly set the "DELETEVALUE" deletionindicator for the appropriate language.

      Description
      Object links for document
      Object links are always added to those that already exist. If you wantto delete links, you must explicitly set the "DELETEVALUE" deletionindicator.
      OBJECTTYPE: the internal descriptions from table TCLO are used (forexample, MARA for material) for the object type
      OBJECTKEY: the object key is copied as a complete string (according totable TCLO)