on 09-24-2010 4:24 PM
Hello,
I start with document managment system : i am able to create new document (CV01N) manually, add a local file and check-in this file.
Now we need to store file which are stored on the SAP Application Server.
Firstly, in the GUI of transaction CV01N, i don't know how to browse file on application server. All files i can't attach as original, are files i can access from my computer.
Is it possible to access also on application server files ?
Moreover, i have to define function module which have to
- Create a document (DMS)
- Attach an orginial file which is stored on application server
- Check-in the file
This function module will be called from a web application
I define this kind of function and run it correctly with a local file (stored on my computer) : i call BAPI "BAPI_DOCUMENT_CREATE2" and "BAPI_DOCUMENT_CHECKIN2"
But i don't how to do with a file stored on application server. I see also note 504692 and try a program like ZZUZTEST_TEST_CHECKIN which use FM CVAPI_DOC_CHECKIN but it return an error Error uploading E:\usr\sap\TD1\DVEBMGS00\data\FACTURE.txt" (this path and file exist on application server and is really the file i want to checkin)
Please could you confirm what i search, is possible or not.
If possible, could help me with some explanations and guidelines and perhaps a sample ?
Thank you very much.
Regards,
Eric
The function used
-
FUNCTION Z_TEST_CHECKIN.
***********************************************************************
Checkin the first original of a document info record *
from the application server and/or in the background *
***********************************************************************
data : w_host like BAPI_DOC_AUX-HOSTNAME.
data: lf_line(255).
data: ls_draw like DRAW,
ls_message_cvapi like messages,
lt_files_cvapi type standard table of CVAPI_DOC_FILE,
lt_files_cvapi_header like CVAPI_DOC_FILE.
data: lt_originals LIKE cvapi_doc_file OCCURS 0 WITH HEADER LINE,
vo_originals LIKE cvapi_doc_file OCCURS 0 WITH HEADER LINE.
ls_draw-dokar = 'ZFT'.
ls_Draw-doknr = '0000000000000004500000032'.
ls_Draw-dokvr = '00'.
ls_Draw-doktl = '000'.
Read Originals contained in the document info record
CALL FUNCTION 'CVAPI_DOC_GETDETAIL'
EXPORTING
pf_batchmode = 'X'
pf_hostname = ' '
pf_dokar = ls_draw-dokar
pf_doknr = ls_draw-doknr
pf_dokvr = ls_draw-dokvr
pf_doktl = ls_draw-doktl
pf_active_files = 'X'
IMPORTING
psx_draw = ls_draw
TABLES
pt_files = vo_originals
EXCEPTIONS
not_found = 1
no_auth = 2
error = 3
OTHERS = 4.
IF sy-subrc <> 0.
WRITE 'Error returned by CVAPI_DOC_GETDETAIL'. "#EC NOTEXT
EXIT.
ENDIF.
Check if we can really access the file from the application server
read table vo_originals index 1.
open dataset vo_originals-filename for input in text mode ENCODING DEFAULT.
if not sy-subrc is initial.
message e500(26) with vo_originals-filename 'not found'.
endif.
read dataset vo_originals-filename into lf_line.
if not sy-subrc is initial.
message e500(26) with vo_originals-filename 'read error'.
endif.
lt_originals = vo_originals.
lt_originals-STORAGE_CAT = 'SAP-SYSTEM'.
append lt_originals.
w_host = sy-host.
CALL FUNCTION 'CVAPI_DOC_CHECKIN'
EXPORTING
PF_DOKAR = ls_draw-dokar
PF_DOKNR = ls_draw-doknr
PF_DOKVR = ls_draw-dokvr
PF_DOKTL = ls_draw-doktl
PS_DOC_STATUS =
PF_FTP_DEST = 'SAPFTPA'
PF_HTTP_DEST = 'SAPHTTPA'
*PF_HOSTNAME = w_host
PS_API_CONTROL =
PF_REPLACE = ' '
PF_CONTENT_PROVIDE = 'SRV'
IMPORTING
PSX_MESSAGE = ls_message_cvapi
TABLES
PT_FILES_X = lt_originals
PT_COMP_X =
PT_CONTENT =
.
IF ls_message_cvapi-msg_type CA 'EA'.
ROLLBACK WORK.
MESSAGE ID '26' TYPE 'I' NUMBER '000'
WITH ls_message_cvapi-msg_txt.
ELSE.
COMMIT WORK and wait.
ENDIF.
ENDFUNCTION.
This is a bit tricky. I spent lots of hours about this .
You have to set PF_HOSTNAME with your name of your AS and gives the path to the file on the server.
You wrote
*PF_HOSTNAME = w_host
But beware: if you have more thän one AS you have to fix one AS for upload or you have to find the servers name of the file. A better way can be to share one folder by each AS.
You also have to decide between HTTP or FTP.
You wrote:
PF_FTP_DEST = 'SAPFTPA'
PF_HTTP_DEST = 'SAPHTTPA'
You must define only one ! Then you have to check your settings in SM59 about working right.
Pls rate, if this was helpful.
Regards,
Markus
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Markus,
Indeed this is really tricky and the usage of this function module is very case specific. For my case in particular I managed to make it work using BOTH the ftp and http. But I believe this is because I wanted to get a file from the application server and store it in an ftp server (vault).
I documented my case and how to make it work in the following document:
http://scn.sap.com/docs/DOC-49337
Cheers
Bruno
I have a similar requirement. Did you manage to solve your problem? Can you share it please?
Thank you.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Bonjour Bruno,
Yes, the similar principle works for adding an file to an existing DMS document.
In this case, of course, you don't have to create the DMS document as it existing (there is a condition)
Unfortunatly, I don't have anymore access to the system. But the structure of T_FILE should simply a record of X characters (example 80) .
The main thing is to read the sever file in that kind ot internal table (read dataset instruction)
Regards
Eric
Hello,
Thanks Ravindra for the anwser.
Basically and initialy, the files are stored on Database.
My issue concern original files.
And i can check-in them manually or with function module when they are stored on my PC.
But i have technical problem when i want to upload files which are initialy located on the server.
E:\usr\sap\TD1\DVEBMGS00\data\FACTURE.txt is a file located on the SAP Application server and i want to "Upload" it with Abap function module in a Document.
My question is precisely how to "Transport this file located on Application server" in the repository.
Thanks for help.
Regards
Eric
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Eric,
The method of storing documents in DMS is either in sap database or external content server. If these files are stored on application server, first thing you need is to transport these files with help of abap program to either sap database or content server whichever you are using to store the dms documents in current scenario.
Once these documents are stored or transported to any of these repositories, you can access them easily.
Hope this will help.
Regards,
Ravindra
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
102 | |
12 | |
11 | |
6 | |
5 | |
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.