09-08-2008 7:48 AM
Hi,
I am new to ABAP, could you please let me know what are the mandatory fields that I need to provide to create the Document Number in this BAPI BAPI_DOCUMENT_CREATE2. Please provide the complete details.
Also let me know will it allow us to create an external document number, i.e this document no can flow from another system to SAP R/3
Regards,
Nithiyanandam
09-08-2008 7:54 AM
CALL FUNCTION 'BAPI_DOCUMENT_CREATE2'
EXPORTING: documentdata = ls_doc
IMPORTING: documenttype = lf_doctype
documentnumber = lf_docnumber
documentpart = lf_docpart
documentversion = lf_docversion
return = ls_return
TABLES: documentdescriptions = lt_drat
objectlinks = lt_drad
documentfiles = lt_files.
above are mandatory fields . after calling bapi_document_create2 ..check for sy-subrc and call BAPI_TRANSACTION_COMMIT as i have shown below.
** Did an error occur ??
if ls_return-type ca 'EA'.
rollback work.
message id '26' type 'I' number '000'
with ls_return-message.
else.
commit work.
call function 'BAPI_TRANSACTION_COMMIT'
* EXPORTING
* WAIT = WAIT
* IMPORTING
* RETURN = RETURN
.
write:/ lf_doctype,
lf_docnumber,
lf_docpart,
lf_docversion.
endif.
clear: lt_drad, lt_files, ls_doc.
refresh: lt_drad, lt_files.
09-08-2008 7:54 AM
CALL FUNCTION 'BAPI_DOCUMENT_CREATE2'
EXPORTING: documentdata = ls_doc
IMPORTING: documenttype = lf_doctype
documentnumber = lf_docnumber
documentpart = lf_docpart
documentversion = lf_docversion
return = ls_return
TABLES: documentdescriptions = lt_drat
objectlinks = lt_drad
documentfiles = lt_files.
above are mandatory fields . after calling bapi_document_create2 ..check for sy-subrc and call BAPI_TRANSACTION_COMMIT as i have shown below.
** Did an error occur ??
if ls_return-type ca 'EA'.
rollback work.
message id '26' type 'I' number '000'
with ls_return-message.
else.
commit work.
call function 'BAPI_TRANSACTION_COMMIT'
* EXPORTING
* WAIT = WAIT
* IMPORTING
* RETURN = RETURN
.
write:/ lf_doctype,
lf_docnumber,
lf_docpart,
lf_docversion.
endif.
clear: lt_drad, lt_files, ls_doc.
refresh: lt_drad, lt_files.
09-08-2008 7:54 AM
09-08-2008 7:55 AM
Hi Friend,
Check this link for complete information regarding BAPI_DOCUMENT_CREATE2:
http://abap.wikiprog.com/wiki/BAPI_DOCUMENT_CREATE2
Regards,
Chandra Sekhar
09-08-2008 9:34 AM
Hi,
Could you please provide me these details of the values that I can provide for those fields, because the doc no is not getting generated.
Regards,
Nithiyanandam
09-08-2008 9:49 AM
Hi,
If the document number is not getting generated check SPRO settings also once....since if this is an external numbering then system would be expecting a document number provided by user .
Otherwise the essential fields are :
In document description table the language and the description field.
Under documentdata
1. the document type
2. the documnet number
3. the version
4. the document part
5. status extern
Thanks
Papiya
09-08-2008 7:57 AM
09-08-2008 9:40 AM
hii
here DOCUMENTDATA is mandatory field.you can check that in SE37 IMPORT parameters.
document number is generated by system so it will not allow you to create external document number.
regards
twinkal
09-08-2008 10:07 AM
Hi twinkal patel,
Please check the link, i have provided.
This is related to the fields present in DOCUMENTDATA. I want to know the values which I need to pass, so that th document number is created.
http://rapidshare.com/files/143564533/Document_create.PNG.html
Regards,
Nithiyanandam
09-08-2008 11:10 AM