Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

KPRO file export

Former Member
0 Likes
1,586

Hi,

can anybody tell me, how to export a file (e.g. a picture) <b>from KPRO to local file-system</b>. The file i want is element of the filelist of a DVS (DIS)

Problem is - i have to use an outstanding report and (as far as i know) can't use HTTP-response. Also, the download should work automatically in background and save the file to defined path.

There is a FM CV120_DOC_CHECKOUT_TO_CLIENT that looks right, but i can't get it work.

Also i have the requirement to get a link for the file in KPRO, wich i can later use to build html img-tags with this source. I used BAPI_DOCUMENT_GET_DETAIL2 and get the filelist (with file_id). I also tried CV120_KPRO_MASTER_DATA_GET to get file_id. Both works well, but when i try to get the url by calling the FM CV120_KPRO_CHECKOUT_TO_URL the function SCMS_URL_GENERATE raise "sdoki_subrc_bad_stor_cat" and later on handle the error as "no_content".

<b>Most important is to get the file to local folder.</b>

Thx for every answer.

3 REPLIES 3
Read only

Former Member
0 Likes
972

Hi Thomas,

First I use FM "CVAPI_DOC_GETDETAIL" to get a list of files which are connected to the DIS. Then FM "CV120_DOC_CHECKOUT_VIEW" to copy files from kpro to application server.

Here my codeing:


      clear st_def.
      st_def-kpro_use = 'X'.
      st_def-comp_get = 'X'.
      st_def-content_provide = 'SRV'.

      clear st_doc_file.
      st_doc_file-langu       = it_pool-langu.
      t_dappl = it_pool-dappl.
      translate t_dappl to lower case.
      concatenate path_daten1 it_pool-description '.' t_dappl
        into st_doc_file-filename.
      st_doc_file-dappl       = it_pool-dappl.

      clear st_phio.
      select single protected from dms_phio2file
                              into st_phio-protected
                              where file_id = it_pool-file_id.
      st_phio-lo_objid = it_pool-lo_objid.
      st_phio-ph_objid = it_pool-ph_objid.
      st_phio-langu    = it_pool-langu.
      st_phio-filename = it_pool-filename.
      st_phio-file_id  = it_pool-file_id.
      st_phio-storage_cat = it_pool-storage_cat.
      st_phio-created_by = it_pool-created_by.
      st_phio-created_at = it_pool-created_at.
      st_phio-changed_by = it_pool-changed_by.
      st_phio-changed_at = it_pool-changed_at.

      clear st_frontend.
      call function 'CV_GET_FRONTEND_TYPE'
        importing
          pf_frontend_type        = st_frontend-frontend_type
          pf_hostname             = st_frontend-hostname
          pf_winsys               = st_frontend-winsys.

      call function 'CV120_DOC_CHECKOUT_VIEW'
        exporting
          ps_cout_def         = st_def
          ps_doc_file         = st_doc_file
          ps_draw             = st_draw
          ps_phio             = st_phio
          ps_frontend         = st_frontend
        exceptions
          error               = 1
          others              = 2.

Regards,

martin

Read only

0 Likes
972

OK, very interesting to see how to fill all the structures.

Some (newbie-) questions left:

it_pool seems to be a structure of file list, right?

What about st_def-content_provide? Is 'SRV' a specific value in your case? how can i find out, what i have to take.

Last question:

Where's the right place to define LOCAL Path (e.g. C:\xyz\) I wont check out to appliation server.

Read only

0 Likes
972

Now, i tried your coding and it works "nearly" fine.

I get a strange hostname (iuEZxaeu#*ae#w#i#w-I) while using the FM for frontend type. It works the first time and than - never again.

Also found the part of coding where i can enter the path

Will debug this next week.