Dear expert,
After successful create document using BAPI_DOCUMENT_CREATE2, i try to check in the document using BAPI_DOCUMENT_CHECKIN2.
I successfull run BAPI_DOCUMENT_CHECKIN2 without error, but when check the document in explorer, this document still check out?
Why this happen please help me...
This is my sample code..
*************
**define required variables
************
** 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,
psx_message TYPE messages.
** Bapi-Return structure
DATA: ls_return LIKE bapiret2.
** internal table in which the information for the originals
** is entered, which is then transferred to the module
DATA: lt_files LIKE bapi_doc_files2 OCCURS 0 WITH HEADER LINE.
********************************************
** Assign the data
******************************************
lf_docnumber = '0000000000000010000000003'.
lf_doctype = 'DMO'.
lf_docversion = '00'.
lf_docpart = '000'.
*empty itab and workarea
REFRESH lt_files.
CLEAR lt_files.
** Checkin the original into the SAP-database
lt_files-storagecategory = 'DMS_C1_ST'.
lt_files-docfile = 'D:\sample.pdf'.
*If the original is to be checked into the old storage, the following must take place
* the assignment of
"lt_files-originaltype = '1'. " or '2'
* some optional fields
"lt_files-description = 'Sample Description2'.
lt_files-wsapplication = 'PDF'. "defines, with what the original
*was opened in R/3-> WORD
APPEND lt_files.
*appending multiple documents possible, repeat the above steps
******************************************************************
** Check in document
******************************************************************
CALL FUNCTION 'BAPI_DOCUMENT_CHECKIN2'
EXPORTING
documenttype = lf_doctype
documentnumber = lf_docnumber
documentpart = lf_docpart
documentversion = lf_docversion
IMPORTING
return = ls_return
TABLES
documentfiles = lt_files.
IF ls_return-type CA 'EA'.
ROLLBACK WORK.
MESSAGE ID '26' TYPE 'I' NUMBER '000'
WITH ls_return-message.
ELSE.
COMMIT WORK.
ENDIF.
Best Regards,
Anastasius