on 01-05-2011 10:41 PM
while i am checkin a document (attachment) using storage category KPRO ,the document is getting stored but when i use SAP-SYSTEM the Document is not getting stored. How can I get it stored using 'SAP-SYSTEM'
Following is the code;
DATA:
lv_docnum TYPE bapi_doc_aux-docnumber,
lw_docdata TYPE bapi_doc_draw2,
lw_return TYPE bapiret2,
lw_dsp TYPE bapi_doc_drat,
lw_objlink TYPE bapi_doc_drad,
lw_docfile TYPE bapi_doc_files2,
lt_dsp TYPE STANDARD TABLE OF bapi_doc_drat,
lt_objlink TYPE STANDARD TABLE OF bapi_doc_drad,
lt_docfile TYPE STANDARD TABLE OF bapi_doc_files2.
START-OF-SELECTION.
*
*CALL 'SAPCORE' ID 'ID' FIELD 'VERSION'
ID 'TABLE' FIELD kernel_version-sys*.
*READ TABLE kernel_version INDEX 11.
*w_hostname = kernel_version-data.
CLEAR lw_docdata.
lw_docdata-documenttype = 'ZAP'.
lw_docdata-documentversion = 'A0'.
lw_docdata-documentpart = '000'.
lw_docdata-laboratory = '001'.
CLEAR lw_dsp.
lw_dsp-description = 'Test created by xyz'.
lw_dsp-language = 'E'.
APPEND lw_dsp TO lt_dsp.
lw_docfile-docfile = 'C:\test.pdf'.
lw_docfile-docpath = 'C:\test.pdf'.
LW_DOCFILE-ORIGINALTYPE = '1'.
lw_docfile-storagecategory = 'SAP-SYSTEM'.
lw_docfile-storagecategory = 'DMS_C1_ST'.
lw_docfile-wsapplication = 'PDF'.
lw_docfile-language = 'E'.
lw_docfile-checkedin = ' '.
lw_docfile-checkedin = 'X'.
lw_docfile-active_version = 'X'.
APPEND lw_docfile TO lt_docfile.
CLEAR lw_objlink.
lw_objlink-objecttype = 'VBAP'.
lw_objlink-objectkey = '0040011233000010'.
lw_objlink-documentdirection = 'X'.
APPEND lw_objlink TO lt_objlink.
CALL FUNCTION 'BAPI_DOCUMENT_CREATE2'
EXPORTING
documentdata = lw_docdata
pf_ftp_dest = 'SAPFTPA'
pf_http_dest = 'SAPHTTPA'
***************
IMPORTING
documentnumber = lv_docnum
return = lw_return
TABLES
documentdescriptions = lt_dsp
objectlinks = lt_objlink
documentfiles = lt_docfile.
IF lw_return-type CA 'EA'.
CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
MESSAGE ID lw_return-id
TYPE lw_return-type
NUMBER lw_return-number.
ELSE.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'.
CLEAR lw_return.
CALL FUNCTION 'BAPI_DOCUMENT_CHECKIN2'
EXPORTING
documenttype = 'ZAP'
documentnumber = lv_docnum
documentpart = '000'
documentversion = 'A0'
IMPORTING
return = lw_return
TABLES
documentfiles = lt_docfile.
IF lw_return-type CA 'EA'.
CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
MESSAGE ID lw_return-id
TYPE lw_return-type
NUMBER lw_return-number.
ELSE.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'.
WRITE: / 'document number = ', lv_docnum.
ENDIF.
ENDIF.
Any Suggestions please.
Thanks.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I am using FM 'BAPI_DOCUMENT_CREATE2' and FM ''CVAPI_DOC_CHECKIN'' to create document and attachment and then checkin the document.
I am able to accomplish all the step. when i do file checkin the file name in disappearing. How can I keep the file name? When i attach the file I can see the name but when I checkin the file name disappers but the files are there.
I am able to attach only 2 files as attachment. How do you increase number in configuration.
Thanks,
Hi,
based on the posted coding I think that the reason for this behavior is that the used document type has set the flag 'Use KPRO' in transaction DC10. Because the storage category 'SAP-SYSTEM' is not a KPRO storage category like DMS_C1_ST. So if this flag is set in the customer then only originals checked in to a KPRO storage category are displayed. Without this flag the originals in "older" storage categories are displayed (e.g. SAP-SYSTEM, archive,...).
Regarding the limitation of 2 originals per document info record, I can inform you that this is a standard restriction of you do not
check in your originals to a KPRO. With the KPRO storage there is no such limitation.
Generally I'm asking myself why you are using the BAPI_DOCUMENT_CREATE2 and then also the CHECKIN BAPI. Because you can enter the original data also at the CREATE2 BAPI. If you want to checkin files to the KPRO then the filedata has to be
handed over in table DOCUMENTFILES. If you want to check in originals to SAP-SYSTEM then the data has to be entered in table DOCUMENTDATA. For further information please see SAP note 766277 which has a complete BAPI documentation added in its attachment area.
Best regards,
Christoph
User | Count |
---|---|
104 | |
12 | |
11 | |
6 | |
6 | |
4 | |
3 | |
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.