Fonction SAP BAPI_DOCUMENT_SETSTATUS - Set Document Status

Paramètre Reférence Type Long. Valeur par déf. Facultatif Description
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
STATUSEXTERN BAPI_DOC_DRAW-STATUSEXTERN C 2 SPACE X External Status
STATUSINTERN BAPI_DOC_DRAW-STATUSINTERN C 2 SPACE X Internal Status
STATUSLOG BAPI_DOC_DRAW-STATUSLOG C 20 SPACE X Status Log Entry

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

Functionality
You use this method to set a new status for a document. You can usefield STATUSLOG to make an entry in the status log field.

Notes
The system specifies the internal or external status. The internalstatus is the status in the database. The external status is what theuser sees on the user interface, and depends on the logon language.
If the internal status is specified, this has priority. Otherwise, thesystem reads the internal status that corresponds to the external statuskey.

Example
Example program
*************
**Define variables required
************
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_statusextern LIKE bapi_doc_draw-statusextern,
lf_statusintern LIKE bapi_doc_draw-statusintern,
lf_statuslog LIKE bapi_doc_draw-statuslog.
** BAPI return structure
DATA: ls_return LIKE bapiret2.
********************************************
** Assign document data
** The status of this document is to be changed
******************************************
lf_docnumber = 'DOKUMENTNUMMER'.
lf_doctype = 'DRW'.
lf_docversion = '00'.
lf_docpart = '000'.
lf_statusintern = 'AR'.
**********************************
**Call BAPI
**********************************
CALL FUNCTION 'BAPI_DOCUMENT_SETSTATUS'
EXPORTING: documenttype = lf_doctype
documentnumber = lf_docnumber
documentpart = lf_docpart
documentversion = lf_docversion
statusextern = lf_statusextern
statusintern = lf_statusintern
statuslog = lf_statuslog
IMPORTING: return = ls_return.
** Any errors?
IF ls_return-type CA 'EA'.
ROLLBACK WORK.
MESSAGE ID '26' TYPE 'I' NUMBER '000'
WITH ls_return-message.
ELSE.
COMMIT WORK.
ENDIF.

Description
Return structure for messages

Description
New (external) status abbreviation for the document
If the internal status is transferred, this always has priority over
the external status abbreviation.

Description
New (internal) status for the document.
If the internal status is transferred, this always has priority over
the external status abbreviation.

Description
Entry in status log