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

ArchiveLink - Problem when storing from program

Former Member
0 Likes
3,063

Hello Experts,

I'm encountering a problem with documents stored in IXOS and linked to a SAP object (BUS2105/purchase request in this case).

I'm using FMs ARCHIV_CONNECTDEFINITION_GET, ARCHIVOBJECT_CREATE_FILE and ARCHIV_CONNECTION_INSERT to store the file and create the link with the related SAP Object.

The problem happens when we want to get the archived file from the attachement list of the SAP Object: the file extension (doc) is not recognized and we have to first download the file and rename it appending the correct extension.

If we attach a document using the same document type via SAPGUI / General Object Services, everything goes well, so it seems not to be related to ArchiveLink customizing.

These are some parts of the code:

...
* Get the file content using MIME-UPLOAD macro
  mime-upload 1 wt_data w$_filel.
...
*  Temporarly store the file on server
    OPEN DATASET wl_fname FOR OUTPUT IN BINARY MODE.
    LOOP AT wt_data.
      TRANSFER wt_data TO wl_fname.
    ENDLOOP.
    CLOSE DATASET wl_fname.
...
* Get the ArchiveLink parameters of these object/document types
    CALL FUNCTION 'ARCHIV_CONNECTDEFINITION_GET'
      EXPORTING
        objecttype    = cv_objecttype
        documenttype  = cv_documenttype
        client        = sy-mandt
      IMPORTING
        connection    = lv_connection
        archivid      = lv_archivid.
...
 CALL FUNCTION 'ARCHIVOBJECT_CREATE_FILE'
      EXPORTING
        archiv_id                = lv_archivid
        document_type            = cv_doctype
        path                     = lv_path
      IMPORTING
        archiv_doc_id            = lv_archiv_doc_id.
...
CALL FUNCTION 'ARCHIV_CONNECTION_INSERT'
      EXPORTING
        ARCHIV_ID                   = lv_archivid
        arc_doc_id                  = lv_archiv_doc_id
        AR_DATE                     = sy-datum
        ar_object                   = cv_documenttype
        object_id                   = lv_objectID
        sap_object                  = cv_objecttype
        DOC_TYPE                    = cv_doctype.

Does anyone see where could be the mistake?

Many thanks in advance for any information that could help!

Jerome.

4 REPLIES 4
Read only

Former Member
0 Likes
1,174

Hello ,

y u need to save file contents in appserver ? , what u can do if you are uploading files from PC

  
1*---Get File Name & contents......

    clear l_lines.
*--- File Size.

2.determine file size...

    describe table lt_content lines l_lines.
    l_supposed_length = l_lines * 1022.
*---Convert into RAW1024 format.
    refresh : lt_docs.

3....Convert into RAW

    call function 'SLVC_X1022_TO_X1024'
      exporting
        i_file_length = l_supposed_length
      tables
        et_x1024      = lt_docs[]
        it_x1022      = lt_content[].

4...
*---Create ALink
    call function 'ARCHIV_CREATE_TABLE'
      exporting
        ar_object       = p_link-ar_object "'ZGLACCR'
        object_id       = p_link-object_id "'B72890000001522009'
        sap_object      = p_link-sap_object"'YFIE_00007'
        flength         = l_length
        doc_type        = l_doc_type
      importing
        outdoc          = l_outdoc
      tables
        binarchivobject = lt_docs.

try this and let me know if you have any Q's.

regards

Prabhu

Read only

0 Likes
1,174

Hello Prabhu,

I forgot to mention that the program is running in an ITS context. The file content is retreived using the mime-upload macro.

Nethertheless I've tryied your solution but it's getting worse. Now I'm not able to open the file anymore.

The File extension is still missing and now word cannot open the file even by adding the file extension.

Any idee?

Thanks,

Jerome.

Edited by: Support TAS SC-TAS on Apr 20, 2010 1:47 PM

Read only

0 Likes
1,174

Hi all,

I permit to up this thread as we didn't find any solution yet.

Thanks in advance for any help.

Jerome.

Read only

0 Likes
1,174

Hello,

The problem could be solved by following the note 987267.

Jerome.