Hi all,
I use the fm BAPI_DOCUMENT_CREATE2 to create a SAP document.
The BAPI creates the SAP document but doesn't attach the given files.
Here is my coding:
ls_doc-documenttype = doctyp.
ls_doc-documentnumber = ''.
ls_doc-documentversion = docvs.
ls_doc-documentpart = docprt.
ls_doc-description = it_fdata-bez.
ls_doc-username = sy-uname.
Files
REFRESH lt_files.
CLEAR lt_files.
lt_files-documenttype = doctyp.
lt_files-documentversion = docvs.
lt_files-documentpart = docprt.
lt_files-sourcedatacarrier = 'DEFAULT'.
lt_files-storagecategory = 'DMS_C1_ST'.
lt_files-docfile = it_fdata-path.
lt_files-wsapplication = 'PDF'.
lt_files-description = it_fdata-bez.
lt_files-originaltype = 1.
lt_files-checkedin = 'X'.
APPEND lt_files.
Object link to material master
CLEAR lt_drad.
REFRESH lt_drad.
lt_drad-objecttype = 'MARA'.
lt_drad-objectkey = it_fdata-matnr.
APPEND lt_drad.
Create document
CALL FUNCTION 'BAPI_DOCUMENT_CREATE2'
EXPORTING
documentdata = ls_doc
IMPORTING
return = ls_return
documentnumber = doknr
TABLES
objectlinks = lt_drad
documentfiles = lt_files.
commit work.
What is missing that the files were attached to the SAP document?
I have also tried to add the following fm:
CALL FUNCTION 'BAPI_DOCUMENT_CHECKIN2'
EXPORTING
documenttype = 'DMO'
documentnumber = doknr
documentpart = '000'
documentversion = '00'
hostname = ''
statusintern = ''
statusextern = ''
statuslog = ''
IMPORTING
return = ls_return
TABLES
documentfiles = lt_files.
But the files are also missing.
Any ideas?
regards