Skip to Content
avatar image
Former Member

BAPI_DOCUMENT_CREATE2 - Copy Attached file issue

Hi,

I am trying to create a document with attachment in CV01 using the BAPI BAPI_DOCUMENT_CREATE2.

Here my requirement is to copy the attached files from a document to another document (which I will be creating newly).

I mean attachments from document 1 to document 2.

When I try using this bapi BAPI BAPI_DOCUMENT_CREATE2, what should I give in the docpath parameter.

I have storage category to maintain.

Even though if I pass storage category, the parameter is not checked in. So, it is throwing with error as “Error while checking and sorting”.

So, In debugging , I set to checked in again and ran successfully.

But, when I try to open the attached file in newly created document 2. Getting error as could not be accessed.

Adding one more point is that, the fiel might have been uploaded from application server earlier and they might have removed that file from the application server. So, i should not access this file again trough application server.

Please suggest if I am doing anything wrong.

Thanks,

Prabu

Message was edited by: prabu kailasam

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

2 Answers

  • avatar image
    Former Member
    Sep 16, 2014 at 02:56 AM

    Hi,

    Is it possible to handle this directly using this BAPI_DOCUMENT_CREATE2 or should i proceed the following approach.

    1) Get the document file content using SCMS_DOCUMENT_READ

    2) Use write dataset to write in the application server.

    3) Then use the BAPI_DOCUMENT_CREATE2 to attach that file updated in step 2 in the document in cv01.

    Please suggest.

    Thanks,

    Prabu

    Add comment
    10|10000 characters needed characters exceeded

    • Hi Prabhu,

      Obviously this FM checks the storage category and file location in database so if it does not exist it will give you an error so your above approach will be a correct approach.

      Check it like this

      ** Check in original 1 simultaneously in the SAP Database

      REFRESH lt_files.

      CLEAR lt_files.

      lt_files-storagecategory = 'SAP-SYSTEM'.

      lt_files-docfile = 'c:\temp\drawing.txt'.

      lt_wsapplication = 'TXT'.

      APPEND lt_files.

      Thanks

  • avatar image
    Former Member
    Sep 26, 2014 at 07:14 PM


    Hi All,

    Thanks for your response. I found the solution. Used the FM CV120_KPRO_LOIO_COPY to solve this issue.

    Thanks,

    Prabu

    Add comment
    10|10000 characters needed characters exceeded