Quantcast
Channel: SCN : Unanswered Discussions - SAP Document Management
Viewing all articles
Browse latest Browse all 732

BAPI_DOCUMENT_CREATE2 - Missing TOA01 entry

$
0
0

Hello everybody,

I'm a complete newbie on the argument, but... I wrote a simple (local) report in order to understand how a document can be created and archived into an external repository.

The external repository, called ZG, is an archivelink repository; I should have performed all the customizing activities related to both the repo and document type (Z16).

 

My aim is to replicate the behaviour of CV01N transaction by means of specific code.

Here's my sketch of code:

 

REPORT ZUPLOADTEST .

 

 

 

data : ls_file like BAPI_DOC_DRAW2,

         ls_return like bapiret2.

 

 

DATA: lf_doctype    type bapi_doc_draw2-documenttype,

            lf_docnumber  type bapi_doc_draw2-documentnumber,

            lf_docpart    type bapi_doc_draw2-documenttype,

            lf_docversion type bapi_doc_draw2-documentversion.

 

 

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_file-documenttype    = 'Z16'.

ls_file-documentversion = '00'.

ls_file-documentpart    = '000'.

ls_file-statusextern   = 'ER'.

ls_file-DOCFILE1 = 'C:\Users\matt\desktop\test_pdf.pdf'.

ls_file-DATACARRIER1 = 'ZG'.

ls_file-SAVEDOCFILE1 = 'C:\Users\matt\desktop\test_pdf.pdf'.

ls_file-SAVEDATACARRIER1 = 'ZG'.

ls_file-WSAPPLICATION1 = 'PDF'.

 

lt_drat-language    = 'IT'.

lt_drat-description = 'Test Matt from Report - Z16'.

APPEND lt_drat.

 

CALL FUNCTION 'BAPI_DOCUMENT_CREATE2'

   EXPORTING

     documentdata               = ls_file

*  HOSTNAME                   =

*  DOCBOMCHANGENUMBER         =

*  DOCBOMVALIDFROM            =

*  DOCBOMREVISIONLEVEL        =

   CAD_MODE                   = ' '

   PF_FTP_DEST                = ' '

   PF_HTTP_DEST               = ' '

   DEFAULTCLASS               = 'X'

IMPORTING

    DOCUMENTTYPE               = lf_doctype

    DOCUMENTNUMBER             = lf_docnumber

    DOCUMENTPART               = lf_docpart

    DOCUMENTVERSION            = lf_docversion

    RETURN                     = ls_return

TABLES

*  CHARACTERISTICVALUES       =

*  CLASSALLOCATIONS           =

    DOCUMENTDESCRIPTIONS       = lt_drat

*    OBJECTLINKS                = lt_drad

*   DOCUMENTSTRUCTURE          = lt_dstru

*    DOCUMENTFILES              = lt_files.

.

     if ls_return-type ca 'EA'.

 

 

     CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK' .

     message id '26' type 'I' number '000'

             with ls_return-message.

   else.

 

 

     CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

     EXPORTING

       wait = 'X'.

 

   endif.

 

Now; as far as I've seen I get no error from the above code, and looking at CV03N I can access to the DOCUMENTNUMBER generated by the BAPI. I can see there's a document but double-clicking on it, I get the following message:

 

"

SAP ArchiveLink: Object type not assigned to

storage syst. (Customizing)

"

 

This message refers to the OAC3 activity I already performed, as repository ZG is bound to the DRAW-DRW couple.
I guess the problem relies here as no entry has been created in table TOA01 for the uploaded document.

 

Can anyone please support me troubleshooting this issue? I'm proceeding by trial and error but of course, any help could be useful to understand the problem.


Viewing all articles
Browse latest Browse all 732

Trending Articles