Skip to Content
0
Apr 08, 2010 at 01:22 PM

Get the attach file from opportunities and upload in server directory

79 Views

Hi Experts!

I have a problem with the attach documents in opportunities.

I need to get the XLS attached in a opportunity and put it in a server directory for be consumed by a legacy system. But when i try to get it with the method cl_crm_documents=>get_whit_table i get a binary table

CALL METHOD cl_crm_documents=>get_with_table
    EXPORTING
*       loio                = ls_loios
       phio                = ls_phios
        text_as_stream      = 'X'

    IMPORTING
     file_access_info    = lt_file_inf
     file_content_ascii  = lt_file_ascii
     file_content_binary = lt_file_bin
*    error               =
*    bad_ios             =
      .

but i can't reconstruct the XLS file in the server. i try with this ( among thousand other things ) but is not working =(

open DATASET  'data.xls' for output in TEXT MODE ENCODING *?*  .
LOOP AT lt_file_bin into ls_file_bin.
lv_string = ls_file_bin-line .
TRANSFER lv_string to  'data.xls' .
CLEAR ls_file_bin.

ENDLOOP.

CLOSE DATASET 'data.xls'.

Can you help me?

Thanks!