on 09-07-2009 1:36 PM
Hello,
I need to open a DMS file (any type, especially word file) from outside program by passing
the path & filename by parameter (the outside program was written in VB) with ws_execute function.
I saw that in DRAW table I have such path but it's not working always, it have the first uplaod path but
not the current one (CV04N opens the doc from somewhere else).
How can I get this path ? from which table ? is SAP saving those file by them original kind (word for example) or any
other binnary way ?
Kind Regards,
Amit Berku
Hello Pravin,
I appreciate for your valuable information & quick response. I execute this program & its working fine.
Please suggest -
1. Using this program - i need to download files one by one to our local directory, Is their any option to download all files simultaneously ? Like we extract the reports in one click. because in our planning department one document number can contain 15-20 PDF file so it is being a tedious job for the users. Please assist here.
2. If i use this program, How should i provide this program to users, Is their any risk factor ?
Regards
Gaurav Ahuja
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Gaurav,
It is very easy to achive the requirement you mentioned above. In program DMS_KPRO_READ, after execution system is showing DMS details with no of files attached in the DMS. Just on right side of the screen there is Green Button. If you click on this button it will ask you to download the file on your desktop.
So same logic is to be apply for multiple DMS's to download the file. This can be achived easily with the help of ABAP'er.
On selection screen, maintain following values.
Document Type: DOKAR (Multiple entries)
Document number:DOKNR (Multiple entries)
Document Part: DOKTL
Document version: DOKVR
Authorization Group: DOKAR: BEGRU
After execution your report should show all the DMS with all files attached into it. Give the option of Select All, & Deselect all tab in the report.
Provide a button to download the selected (or All files) in the report. For this use F_BROWSE function. It will ask you to download the file on local P.C.
use below logic for more clarity. Let me know if you have any more issues.
Risk Factor: If the files attached in the DMS are confidentioal then create a Single role for this development & assign the role to required users only.
Use the Function Module : CV120_KPRO_MASTER_DATA_GET
Pass the following data from this F.M.
DOKAR : Document Type
DOKNR: Document Number
DOKTL: Document Part
DOKVR: Document Version
After passing these values we will get the following data:
Logical document (LO_OBJID)
Application (PDF,DOC;XLS)
Physical Document (PH_OBJID)
Counter for documents (PH_INDEX)
Original of document (FILENAME: "C:\temp\Usermanagement.pdf" )
From this Data user should able to download the multiple files.
Hello Praveen,
Really thanks for the valuable solution.
Can you also suggest in my another older requirement.
My Client wants to attach documents to the object links which are not standard object links.
I.e link documents for the transaction fb03, fb60 etc.
How can we add new object links in cv01n screen & that document attachment document should be reflected for attached object link T-code.
Regards
Gaurav Ahuja
Hi Gaurav
It is also easy to achive the above equirement. First you have to do the configuration in SPRO.
Go to Cross Application Component -- Control Data -- Maintain Screen for Object Link
Here you have to define SAP object link (For eg. Production Order as PORDER or Equipment as EQUI) mainatian Authorization as 1. You have to mainatin screen number from 9001 to 9099 (any 04 digit) as standard screen numbers are defined upto 9000.
Then do the config for "Maintain Key Fields" (Just below the node of "Maintain Screen for Object Link" as given above.
Here you have to maintain Table name, Transaction code, Field Name, PID i.e parameter ID .
For ex. If I want to develop a screen for Inspection lot number then data would be as follows.
Table Name: QALS Transaction Code: QA03 Field Name: PRUFLOUES PID: PRU
After doing this ask the ABAP'er to develop the screen with the number you have given screen number in step 01
Once ABAP'er completes his screen development then you can assign that screen number in the required document type in configuration.
Make sure to tell the ABAP'er that if user enter a object link number(Like Accounting document or GRN number) in the developed screen in CV01n or CV02N transaction & if he double clicks on the number system should take it to the display of that object link screen like FB03 or QA03, IE03 etc..
Also you can develop a node in menu or create a Tab of DMS screen in FB03 or QA03 transaction in GO TO menu with the help of ABP'er if DMS screen is not available in that transaction.
Let me know if you have any doubts..
Thanks
Pravin
Hello Praveen,
Could you help me on this below requirement.
I have to move all the DMS documents fom one system to another using RFC. All the object links and files are also to be moved for the newly created document number. Kind of migration from one system to another.
I have used SDOK_PHIO_LOAD_CONTENT to get the data in hexa format in source system. however I am not how to move it into target system, and convert this hexa fromat into file and check in with new document number.
Any help will be highly aprreciated.
Thanks,
Siva Krishna
Hello dstj,
First, Thank you for your answer, I'm checking it and it seems to be working fine,
but as I saw, this function calls the appropriate pc program like word etc' to show the
file on screen, do you know a way that this file will be printed out automaticlly ?
Kind Regards,
Amit Berku
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Amit
I didn't have to print directly so far.
I am not sure that can be done. When printing from Word or any other software, you need to specify on which printer. That printer has nothing to do with SAP itself. But some software have printing switch available and are printing from the default printer.
Suggestions:
1. Verify if there is a parameter that can be sent to the CV120_START_APPLICATION to start the application with the printing parameter.
2. If there is no parameters, verify if it is possible to create an application, in the DMS, that is automatically send the printing switch to the application.
Unfortunattely, I do not have any solution for now.
But if you fine one, please include it in this post.
Regards
dstj
Hello dstj & amit,
Can you please help me out..
I need to create a program to download multiple attach file from SAP DMS, I.e that is attached to a document number or object link. As you guys already have executed the program successfully. Please assist. I am mentioning my Email / Skype Id for faster communication ( gaurav28790@gmail.com / gaurav.ahuja2890 ). Looking forward for your responses..
Regards
Gaurav Ahuja
Hello Amit
Based on my understanding, there is several method used to keep the documents into the DMS.
Sometimes you will have only the path that are refering to a container. and sometimes the document is loaded entirely into the DB.
To retrieve a document that is in the DMS you can use this code:
FORM display_doc .
DATA: lv_lines TYPE i,
ls_draw LIKE draw, " DRAW table structure
ls_doc_file LIKE dms_doc_file, " DMS information
ls_phio LIKE dms_phio, " DMS file information
lv_frontend TYPE dms_frontend_data, " Frontend information
lv_cout_def LIKE dms_checkout_def,
lt_drat LIKE drat OCCURS 0 WITH HEADER LINE,
lt_drad LIKE drad OCCURS 0 WITH HEADER LINE,
lt_draz LIKE draz OCCURS 0 WITH HEADER LINE,
lt_drap LIKE drap OCCURS 0 WITH HEADER LINE,
lt_files TYPE dms_rec_file OCCURS 0 WITH HEADER LINE,
ls_fphio LIKE LINE OF lt_files-tbl_phios.
FREE: lt_drat,
lt_drad,
lt_draz,
lt_drap,
lt_files.
CLEAR: ls_draw,
ls_doc_file,
ls_phio,
lv_frontend,
lv_cout_def,
ls_fphio.
* --- Get Frontend information
CALL FUNCTION 'CV120_GET_FRONTEND_TYPE'
* EXPORTING
* PF_CALL_DIALOG = ' '
* PF_BATCH = ' '
* PF_HOST = ' '
IMPORTING
pfx_frontend_type = lv_frontend-frontend_type
pfx_host = lv_frontend-hostname
pfx_winsys = lv_frontend-winsys
EXCEPTIONS
error = 1
no_valid_frontend = 2
OTHERS = 3
.
IF sy-subrc <> 0.
MESSAGE i011(z1) WITH 'Frontend information problem.'
DISPLAY LIKE 'A'.
ENDIF.
* --- Get table DRAW information
SELECT SINGLE * INTO ls_draw FROM draw WHERE dokar = <DocType>
AND doknr = <DocNumber>
AND dokvr = <DocVersion>
AND doktl = <Docpart>.
IF sy-subrc <> 0.
MESSAGE i011(z1) WITH 'Document information error.'
DISPLAY LIKE 'A'.
ENDIF.
* --- Get all document information
CALL FUNCTION 'CV115_DOC_OPEN_DISPLAY'
EXPORTING: pf_dokar = ls_draw-dokar
pf_doknr = ls_draw-doknr
pf_doktl = ls_draw-doktl
pf_dokvr = ls_draw-dokvr
pf_read_drat = 'X'
pf_read_drad = ''
pf_read_kpro = 'X'
pf_read_comp = 'X'
pf_read_drap = ' ' "note_1003540.
IMPORTING: psx_draw = ls_draw
TABLES: ptx_drat = lt_drat
ptx_draz = lt_draz
ptx_drad = lt_drad
ptx_drap = lt_drap
ptx_files = lt_files
EXCEPTIONS: not_found = 1
no_auth = 2
error = 3
OTHERS = 4.
* --- If more than one document, switch to transaction CV03N
DESCRIBE TABLE lt_files LINES lv_lines.
IF lv_lines > 1.
SET PARAMETER ID 'CV1' FIELD ls_draw-doknr.
SET PARAMETER ID 'CV2' FIELD ls_draw-dokar.
SET PARAMETER ID 'CV3' FIELD ls_draw-dokvr.
SET PARAMETER ID 'CV4' FIELD ls_draw-doktl.
CALL TRANSACTION 'CV03N' AND SKIP FIRST SCREEN.
ELSE.
* --- Retreive the last document information
LOOP AT lt_files.
LOOP AT lt_files-tbl_phios INTO ls_fphio.
MOVE-CORRESPONDING ls_fphio TO ls_phio.
ENDLOOP.
ENDLOOP.
* --- Create temporary file on disk
lv_cout_def-kpro_use = 'X'.
lv_cout_def-comp_get = 'X'.
ls_doc_file-dappl = ls_draw-dappl.
CALL FUNCTION 'CV120_DOC_CHECKOUT_VIEW'
EXPORTING
ps_cout_def = lv_cout_def
pf_tcode = 'CV03'
ps_doc_file = ls_doc_file
ps_draw = ls_draw
ps_phio = ls_phio
ps_frontend = lv_frontend
* PF_STD_URL = 'X'
IMPORTING
pfx_file = ls_doc_file-filename
pfx_url = ls_doc_file-url
* PFX_USE_LAST =
* TABLES
* PT_COMPONENTS =
* PT_DRAZ =
* PTX_CONTENT =
EXCEPTIONS
error = 1
OTHERS = 2
.
IF sy-subrc <> 0.
MESSAGE i011(z1) WITH 'Cannot create temporary file.'
DISPLAY LIKE 'A'.
ENDIF.
CALL FUNCTION 'CV120_START_APPLICATION'
EXPORTING
* PF_API_MODE =
pf_dappl = ls_doc_file-dappl
pf_apptp = '1'
pf_file = ls_doc_file-filename
pf_check_file = 'X'
ps_draw = ls_draw
pf_appnr = '1'
pf_url = ls_doc_file-url
ps_frontend = lv_frontend
* TABLES
* PT_DRAZ =
* PT_COMPONENTS =
EXCEPTIONS
error = 1
file_not_found = 2
OTHERS = 3
.
IF sy-subrc <> 0.
MESSAGE i011(z1) WITH 'Cannot open temporary file.'
DISPLAY LIKE 'A'.
ENDIF.
ENDIF. " If lv_lines > 1 ELSE
ENDFORM. " DISPLAY_DOC
Basicaly, that code is downloading the document, from the DMS, into a temporary file and execute the proper program to open it.
I hope that can help
Regards
dstj
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
99 | |
11 | |
11 | |
6 | |
6 | |
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.