Skip to Content
author's profile photo Former Member
Former Member

Document not visible in Original document list

Hi

I want to add document to SAP DMS, found BAPI_DOCUMENT_CREATE2 on net.

I found a sample program on a thread but when I am executing this I get the newly created document in CV03N but I dont find the document in Original document list.

FUNCTION Z_DMS_CREATE_DOCUMENT_01.

DATA: ls_doc LIKE bapi_doc_draw2,

ls_return LIKE bapiret2.

DATA: lf_doctype LIKE BAPI_DOC_AUX-DOCTYPE,

lf_docnumber LIKE BAPI_DOC_AUX-DOCNUMBER,

lf_docpart LIKE BAPI_DOC_AUX-DOCPART,

lf_docversion LIKE BAPI_DOC_AUX-DOCVERSION.

DATA: lt_files LIKE bapi_doc_files2 OCCURS 0 WITH HEADER LINE,

lt_drat LIKE bapi_doc_drat OCCURS 0 WITH HEADER LINE,

lt_drad LIKE bapi_doc_drad OCCURS 0 WITH HEADER LINE.

ls_doc-documenttype = 'DRW'.

ls_doc-documentversion = '00'.

ls_doc-documentpart = '000'.

ls_doc-description = 'New doc 23 July'.

ls_doc-username = 'TestUser1'.

REFRESH lt_files.

CLEAR lt_files.

lt_files-docfile = 'E:\temp\Sample.pdf'.

lt_files-wsapplication = 'PDF'.

APPEND lt_files.

CLEAR lt_drat.

REFRESH lt_drat.

lt_drat-language = 'EN'.

lt_drat-description = 'Data01'.

APPEND lt_drat.

lt_drat-language = 'EN'.

lt_drat-description = 'Data02'.

APPEND lt_drat.

CLEAR lt_drad.

REFRESH lt_drad.

lt_drad-objecttype = 'MARA'.

lt_drad-objectkey = 'A006'.

APPEND lt_drad.

CALL FUNCTION 'BAPI_DOCUMENT_CREATE2' EXPORTING:

documentdata = ls_doc

IMPORTING:

documenttype = lf_doctype

documentnumber = lf_docnumber

documentpart = lf_docpart

documentversion = lf_docversion

return = ls_return

TABLES:

documentdescriptions = lt_drat

objectlinks = lt_drad

documentfiles = lt_files.

IF ls_return-type CA 'EA'.

ROLLBACK WORK.

MESSAGE ID '26' TYPE 'I' NUMBER '000' WITH ls_return-message.

ELSE.

COMMIT WORK.

ENDIF.

ENDFUNCTION.

Can anybody help.

Thanks in advance

Ruhi Hira

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • Posted on Jul 23, 2009 at 11:17 AM

    Hi,

    based on the sample coding I think that some more data needs to be passed in parameter lt_files. I would recommend you to see the BAPI description in transaction BAPI for the DOCUMENT_CREATE2 BAPI and made sure that the necessary data for

    BAPI table DOCUMENTFILES are also handed over correctly.

    Best regards,

    Christoph

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 08, 2010 at 03:40 AM

    Resolved

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.