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

CVAPI_DOC_CHECKOUTVIEW

Former Member
0 Likes
2,646

Hi Experts,

i am trying to get the content of a file which i created with transaction cv02n.

Code:

CALL FUNCTION 'CVAPI_DOC_CHECKOUTVIEW'
  EXPORTING
    PF_DOKAR                 = lv_doctype
    PF_DOKNR                 = lv_docnumber
    PF_DOKVR                 = lv_docversion
    PF_DOKTL                 = lv_docpart
*   PF_FTP_DEST              = ' '
*   PF_HTTP_DEST             = ' '
*   PF_HOSTNAME              = ' '
    PF_CONTENT_PROVIDE       =  'TBL'
*   PS_API_CONTROL           =
*   PF_STD_URL               = 'X'
 IMPORTING
   PSX_MESSAGE              = ls_mes
   PSX_DRAW                 = ls_draw
 TABLES
   PT_FILES                 = lt_pt_files
   PTX_COMPONENTS           = lt_components
   PTX_CONTENT              = lt_content
          .

ls_draw shows the right result, but lt_pt_files, lt_content and lt_components are empty. ls_mes shows no errors.

Can someone help me?

1 ACCEPTED SOLUTION
Read only

former_member585060
Active Contributor
0 Likes
2,191

Hi,

Try with the BAPI 'BAPI_DOCUMENT_GETDETAIL2'

CALL FUNCTION 'BAPI_DOCUMENT_GETDETAIL2'
    EXPORTING
      documenttype               = current_dokar
      documentnumber             = current_doknr
      documentpart               = current_doktl
      documentversion            = current_dokvr
      getobjectlinks             = c_charx
      getclassification          = c_charx
    IMPORTING
*     DOCUMENTDATA               =
      return                     = wa_return
    TABLES
      objectlinks                = objectlinks_tab.               " this table will have the details which you are looking.
*      DOCUMENTFILES              = DOCUMENTFILES_tab.
*      classallocations           = clas_alloc_tab
*      characteristicvalues       = characteristicvalues_tab.

Check for other Tables paramaters in this BAPI.

Thanks and Regard

Bala Krishna P

12 REPLIES 12
Read only

Former Member
0 Likes
2,191

Hi

Try using BAPI_DOCUMENT_CHECKOUTVIEW or BAPI_DOCUMENT_CHECKOUTVIEW2.

Shiva

Read only

madhu_vadlamani
Active Contributor
0 Likes
2,191

Hi Daniel,

Check with that bapi as Shiva suggested.

Regards,

Madhu.

Read only

0 Likes
2,191

BAPI_DOCUMENT_CHECKOUTVIEW2 works, I can download the file to my local computer. But I want to have the file content in a table, and that doesn't work

Read only

former_member585060
Active Contributor
0 Likes
2,192

Hi,

Try with the BAPI 'BAPI_DOCUMENT_GETDETAIL2'

CALL FUNCTION 'BAPI_DOCUMENT_GETDETAIL2'
    EXPORTING
      documenttype               = current_dokar
      documentnumber             = current_doknr
      documentpart               = current_doktl
      documentversion            = current_dokvr
      getobjectlinks             = c_charx
      getclassification          = c_charx
    IMPORTING
*     DOCUMENTDATA               =
      return                     = wa_return
    TABLES
      objectlinks                = objectlinks_tab.               " this table will have the details which you are looking.
*      DOCUMENTFILES              = DOCUMENTFILES_tab.
*      classallocations           = clas_alloc_tab
*      characteristicvalues       = characteristicvalues_tab.

Check for other Tables paramaters in this BAPI.

Thanks and Regard

Bala Krishna P

Read only

0 Likes
2,191

I tried bapi_get_detail2l. The table objectlinks is empty, documentdescriptions has 1 entry, documentfile has 1 entry ans statuslog 20. The rest is empty

Read only

0 Likes
2,191

Hi,

Just check the Created Document in CV03N transaction and click on the Originals tab, do this DIR have any originals attached to it?

Thanks & Regards

Bala Krishna P

Read only

0 Likes
2,191

The Table looks like:

Appl: WWI

Description: Winword 6.0

Category: SAP-SYSTEM

Name: r000124.rtf

Read only

0 Likes
2,191

Hi,

The file content of the .rtf extension will be in binary format, in order to get that into an internal table, you need to use the BAPI_DOCUMENT_GETDETAIL2 and Loop the table DOCUMENTFILES which is returned from the above BAPI, in that loop use the FM 'SCMS_R3DB_GET'.

CALL FUNCTION 'SCMS_R3DB_GET'
    EXPORTING
*    MANDT              = SY-MANDT
      crep_id            = v_crep_id    " documentfiles-storagecategory
      doc_id             = v_doc_id     " documentfiles-file_id
*    PHIO_ID            =
      comp_id            = v_comp_id  " split the documentfiles-docfile at '\' and use the last field value filename
   IMPORTING
     comp_size          = lv_comp_size
     binary_flg         = lv_binary_flg
     mimetype           = lv_mimetype
    TABLES
      data_txt           = li_content_txt
      data_bin           = li_content_bin         " File in binary in internal table.
   EXCEPTIONS
     error_import       = 1
     error_config       = 2
     OTHERS             = 3
            .
  IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.

Thanks & Regards

Bala Krishna P

Read only

0 Likes
2,191

I get the error "Content repository SAP-SYSTEM does not have storage type R/3 database".

Read only

0 Likes
2,191

Can you post a entry from table DOCUMENTFILES, which is returned by the BAPI. Post only below field entries.

DOCUMENTFILES-STORAGECATEGORY

DOCUMENTFILES-DOCFILE

Read only

0 Likes
2,191

DOCUMENTFILES-STORAGECATEGORY = SAP-SYSTEM

DOCUMENTFILES-DOCFILE = r0000124.rtf

Read only

0 Likes
2,191

Hi,

Just check what is the Storage catogory in the transaction CV03N by openning the DIR, clicking on the tab 'Document Data'. Now go to Transaction OAC0, and see what is the Content repository value for DMS. In our system it is configured as first 6 characters of the value of Storage Catogery.

So it will be similar to SAP-SY in your case, the value of crep_id = documentfiles-storagecategory+0(6) in the FM 'SCMS_R3DB_GET'.

Just test with above changes and also create another DIR and test, as you have used CHECKOUT function modules for the DIR, the document file might not be active.

Thanks & Regards

Bala Krishna.