on 03-11-2009 10:15 AM
Hi,
I have a requirement wherein i need to change the document status field in table DRAW. I have document number and document type as input, based on a condition i will be changing the document status. is there any FM or BAPI available to change the document status?
Thanks in advance,
Srilakshmi.
Hi Srilakshmi
The following BAPI could help you,
BAPI Name: Document.SetStatus
Document.SetStatus
Set document status
Functionality
With this method, a new status is set for the document. Optionally, with the help of the field STATUSLOG, one more entry can be made in the status log field.
Notes
The internal or the external status is specified. The internal status defines how the status on the DB is saved; the user can see the external status based on the login language on the screen.
In principle: If the internal status is specified, this has priority, otherwise, the internal status is read via the external status code.
Sample program
*************
**define required variables
************
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 the document data
the status should be changed by this document
******************************************
lf_docnumber = 'Documentnumber'.
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.
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.
Regards
S.Sivakumar
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
98 | |
11 | |
11 | |
6 | |
6 | |
4 | |
4 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.