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

DMS document attachment

Former Member
0 Likes
2,419

Hi,

I am new to DMS & I have to attached scanned images of invoices through MIRO transaction to SAP object. How should I go with it?

Anyone has worked on DMS???

kindly help...

4 REPLIES 4
Read only

Former Member
0 Likes
938

Hi Abhijeet Shinde,

For reading document from DMS you can use below FMs

CVAPI_DOC_VIEW

CVAPI_DOC_VIEW2

Sample code to use it

CALL FUNCTION 'CVAPI_DOC_VIEW'
       EXPORTING
            pf_dokar      = wa_dokar 
            pf_doknr      = wa_doknr
            pf_dokvr      = wa_dokvr
            pf_doktl      = wa_doktl
            pf_appl_start = ' '
            pf_filename   = l_file_src
       IMPORTING
            pfx_file      = g_filep
       EXCEPTIONS
            error         = 1
            not_found     = 2
            no_auth       = 3
            no_original   = 4
            OTHERS        = 5.
  IF sy-subrc  0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
            WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ENDIF.

Also check in function group CVAPI01 you will get some other useful FMs which may satisfy your requirement..

Hope it will solve your problem..

Thanks & Regards

ilesh 24x7

ilesh Nandaniya

Read only

0 Likes
938

HI,

I am using the CVAPI_DOC_VIEW this function module to findt the attached documents by passing DOKAR,DOKNR,DOKVR,DOKTL

fileds values in my database table draw there is no data for filename(filed : draw-fliep).

I am able to see the available documents as a popup.

but my requirement is to see the filename also . how get it .

please sugest the solution,

thanks,

padmja

Read only

Former Member
0 Likes
938

Hi,

Try using this function module mentioned below:

CALL FUNCTION 'CV120_KPRO_MASTER_DATA_GET' " Checking whether the document already have any originals

" attached on it or not

EXPORTING

pf_dokar = i_data_final-doc_type "document type uploaded into an internal table from the external file

pf_doknr = i_data_final-doc_no "document number uploaded into an internal table from the external file

pf_dokvr = i_data_final-doc_ver "document version uploaded into an internal table from the external file

pf_doktl = i_data_final-doc_part "document part uploaded into an internal table from the external file

pf_active_only = ' '

pf_comp_get = ' '

TABLES

ptx_data = i_data

EXCEPTIONS

not_found = 1

error = 2

OTHERS = 3.

if i_data[] is initial.

*- Documentdata

doc_data-documenttype = i_data_final1-doc_type.

doc_data-documentnumber = i_data_final1-doc_no.

doc_data-documentversion = i_data_final1-doc_ver.

doc_data-documentpart = i_data_final1-doc_part.

doc_data-statusintern = i_data_final1-doc_stat.

doc_data-username = i_data_final1-drwng_creator.

IF NOT i_data_final1-doc_desc IS INITIAL.

doc_data-description = i_data_final1-doc_desc.

ENDIF.

APPEND doc_data.

*- ClassAllocations

doc_class_alloc-classtype = c_classtype.

doc_class_alloc-classname = c_classname.

doc_class_alloc-standardclass = 'X'.

APPEND doc_class_alloc.

  • Adding Primary, SUBtye and Design Project Characteristics to the DRAWING Class

CLEAR it_char_val.

it_char_val-classtype = c_classtype.

it_char_val-classname = c_classname.

it_char_val-charname = 'PRIMARYTYPE' .

it_char_val-charvalue = i_data_final1-prim_type.

APPEND it_char_val.

CLEAR it_char_val.

it_char_val-classtype = c_classtype.

it_char_val-classname = c_classname.

it_char_val-charname = 'SUBTYPE' .

it_char_val-charvalue = i_data_final1-sub_type.

APPEND it_char_val.

CLEAR it_char_val.

it_char_val-classtype = c_classtype.

it_char_val-classname = c_classname.

it_char_val-charname = 'DESIGN_PROJECT' .

it_char_val-charvalue = i_data_final1-design_proj.

APPEND it_char_val.

CLEAR it_char_val.

*Bapi called to create the document using tcode CV01N

CALL FUNCTION 'BAPI_DOCUMENT_CREATE2'

EXPORTING

documentdata = doc_data

  • hostname = gv_hostname

pf_http_dest = 'SAPHTTPA'

pf_ftp_dest = 'SAPFTPA'

IMPORTING

documenttype = i_data_final1-doc_type

documentnumber = i_data_final1-doc_no

documentpart = i_data_final1-doc_part

documentversion = i_data_final1-doc_ver

return = ls_return

TABLES

characteristicvalues = it_char_val

classallocations = doc_class_alloc

.

endif.

Hope it helps

Regards

Mansi

Edited by: MANSI ASNANI on Oct 15, 2009 7:09 AM

Read only

Former Member
0 Likes
938

Hi,

for attachment in dms you need to have doc type.

have you attached document in DMS?

Thank You,

Manoj