Ansicht
Dokumentation

BAPI_DOCUMENT_CHANGE2 - Change Document

BAPI_DOCUMENT_CHANGE2 - Change Document

Addresses (Business Address Services)   CPI1466 during Backup  
This documentation is copyright by SAP AG.
SAP E-Book

Functionality

You can use this function module to change document info records and to check in original application files into the SAP database, vault, or archive.

Constraints

  • Mass check-ins are not supported
  • You can use the DocumentStructure table to enhance any existing document structures as well as to create a new document structure.

The engineering change management objects (DOCBOMCHANGENUMBER, DOCBOMVALIDFROM, or DOCBOMREVISONLEVEL) relate to changes to the document structure only. To determine what was actually changed the system does the following: When you enter a change number, the system explodes any structure that exists with the corresponding validity date. It then compares the exisiting items with those specified in DocumentStructure. If no values are entered for the change objects, the items in the DocumentStructure table are considered to be the new status of the structure on the current date. To delete all items in a structure, a document structure can be transferred if it has just one entry whose deletion flag has been set and that contains the document number '*'.

The document key fields are also the keys for the structure items. A document may not be used for several items.

Notes

In addition to the document data, the following data can also be changed:

  • Object links
    If you have integrated the SAP 3D Visual Enterprise Viewer, you can use this BAPI to create object links to task lists and maintenance orders so that you can display spare parts as 2D images and 3D scenes as well as play visual instructions. For more information, see the documentation for the parameter OBJECTLINKS.
  • Classifications and characteristic value assignments
  • Document long texts
  • Document structures
  • Originals

Example

Example program

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

**Define required variables

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

* Document data (number, version, change number, and so on)

* that uniquely identifies the object

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

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.

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

** Assign document data (which document is to be changed)

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

ls_doc-documenttype = 'DRW'.

ls_doc-documentnumber = 'DOKUMENTNUMMER'.

ls_doc-documentversion = '00'.

ls_doc-documentpart = '000'.

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

** First example:

** Make changes to DIR data

*a) Set deletion flag

*set an 'X' to show that the change will also be changed

ls_docx-deleteindicator = 'X'.

* Execute change

ls_doc-deleteindicator = 'X'.

*b) Set new values for descrition and laboratory

*enter new values

ls_doc-description = 'Gear box'.

ls_doc-laboratory = '002'.

*set an 'X' to show that change exists

ls_docx-description = 'X'.

ls_docX-laboratory = 'X'.

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

*Second example: Object links

*a) Add object links

*Clean up internal table and header row

CLEAR lt_drad.

REFRESH lt_drad.

*Append object type and object key to internal table It_drad

lt_drad-objecttype = 'MARA'.

lt_drad-objectkey = '0817'.

APPEND lt_drad.

*b) delete existing object links

*deletevalue must be set to delete the following specific *data record

lt_drad-DELETEVALUE = 'X'.

lt_drad-objecttype = 'MARA'.

lt_drad-objectkey = '0817'.

APPEND lt_drad.

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

*Fourth example: Originals

*a) Add originals

*Define storage category. In this example, 'SAP-DB'.

lt_files-storagecategory = 'DMS_C1_ST'.

*Specify original that will be uploaded

lt_files-docfile = 'n:\handout.doc'.

*If the original is to be checked in to the old storage, the original type must be as follows:

* lt_files-originaltype = '1'. or '2'

append lt_files.

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

** Call BAPI that changes the 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

documentfiles = lt_files.

** Any errors?

IF ls_return-type CA 'EA'.

ROLLBACK WORK.

MESSAGE ID '26' TYPE 'I' NUMBER '000'

WITH ls_return-message.

ELSE.

**So that the changes are saved, you need:

COMMIT WORK.

ENDIF.

###################################################################################################################################





Parameters

ACCEPT_EMPTY_BOM
CAD_MODE
CHARACTERISTICVALUES
CLASSALLOCATIONS
COMPONENTS
DOCBOMCHANGENUMBER
DOCBOMREVISIONLEVEL
DOCBOMVALIDFROM
DOCUMENTDATA
DOCUMENTDATAX
DOCUMENTDESCRIPTIONS
DOCUMENTFILES
DOCUMENTNUMBER
DOCUMENTPART
DOCUMENTSTRUCTURE
DOCUMENTTYPE
DOCUMENTVERSION
HOSTNAME
LONGTEXTS
OBJECTLINKS
PF_FTP_DEST
PF_HTTP_DEST
RETURN
SENDCOMPLETEBOM

Exceptions

Function Group

CVBAPI

General Material Data   Addresses (Business Address Services)  
This documentation is copyright by SAP AG.

Length: 10818 Date: 20240605 Time: 090904     sap01-206 ( 144 ms )