Read SAP Inbox Excel Attachment

Hi,
In my SAP inbox there is a mail with Excel attachment. Can you please let me know how to read this excel attachment. I am able to read contents but not the Excel Attachment.
Thanks,
Usman Malik

Hi,
I think using FM SO_DOCUMENT_READ_API1 you can read attachment content.
Kindly check the following link:
http://wiki.sdn.sap.com/wiki/display/ABAP/ReadingPDFattachmentfromsapinboxthrough+ABAP
Thanks & Regards,
S.Senthilkumar.

Similar Messages

  • Error when reading a pdf attachment file in sap inbox

    Hi all,
    I have created a RFC which sends mail from an external user to my sap inbox with attachment.
    the problem is with the PDF attachment where when i received the mail in my sap inbox in sbwp, it says that there is an error that it wasnt correctly decode.
    I used the class cl_document_bcs...
    and used the method add_attachment...
    would plz help me out

    this is my code
    FUNCTION ZMAIL_READ.
    *"*"Local Interface:
    *"  IMPORTING
    *"     VALUE(SUBJECT) TYPE  SO_OBJ_DES
    *"     VALUE(TEXT) TYPE  STRING
    *"     VALUE(SENDER) TYPE  ADR6-SMTP_ADDR
    *"     VALUE(RECEIVER) TYPE  ADR6-SMTP_ADDR
    *"     VALUE(ATTACHMENTS) TYPE  Z_T_XATTACH OPTIONAL
    *"  EXPORTING
    *"     VALUE(MESSAGE) TYPE  STRING
    DATA: lo_sender TYPE REF TO if_sender_bcs VALUE IS INITIAL,
          lo_bcs_send_request TYPE REF TO cl_bcs,
          l_send type ADR6-SMTP_ADDR ,
          l_rec type  ADR6-SMTP_ADDR .
    data: it_text type table of soli,
          wa_text type soli.
    DATA: lo_send_request TYPE REF TO cl_bcs VALUE IS INITIAL.
    DATA: lo_recipient TYPE REF TO if_recipient_bcs VALUE IS INITIAL.
    DATA: lv_recipient_uid TYPE uname,
          lv_recipient_mail TYPE adr6-smtp_addr.
    data: lo_message type ref to cx_send_req_bcs value is initial,
          text_val type string.
    data: it_userlist type table of BAPIUSNAME,
          wa_userlist type BAPIUSNAME.
    data: it_selection_range type table of BAPIUSSRGE,
          wa_selection_range type BAPIUSSRGE.
    data: wa_attachment TYPE ZXATTACH,
          attachment_sub type SO_OBJ_DES.
    DATA: xstr type xstring,
          str TYPE string,
          str1 type string,
          it_str2 type table of soli,
          wa_STR2 TYPE SOLI.
    DATA: LOC_CONV TYPE REF TO CL_ABAP_CONV_IN_CE,
          wa_solix type solix,
          it_solix type table of solix,
          wa_soli type soli,
          it_soli type table of soli.
    data result TYPE boolean.
    data: i_ext(10) type c,
          i_type type soodk-objtp.
    wa_text-line = text.
    append wa_text to it_text.
    CLASS cl_bcs DEFINITION LOAD.
    try.
    lo_send_request = cl_bcs=>create_persistent( ).
    catch cx_send_req_bcs.
    endtry.
    * Message body and subject
    data: lo_document TYPE REF TO cl_document_bcs VALUE IS INITIAL.
    try.
    lo_document = cl_document_bcs=>create_document(
         i_type = 'RAW'
         i_text =  it_text
         i_subject = subject ).
    catch cx_send_req_bcs.
    catch cx_document_bcs.
    catch cx_address_bcs.
    endtry.
    loop at attachments into wa_attachment.
    attachment_sub = wa_attachment-file_name.
    it_str2 = wa_attachment-attach.
    loop at it_str2 into wa_str2.
      str1 = wa_str2-line.
    try.
    CALL FUNCTION 'SSFC_BASE64_DECODE'
      EXPORTING
        B64DATA                        = str1
    *   B64LENG                        =
    *   B_CHECK                        =
      IMPORTING
        BINDATA                        = xstr
    * EXCEPTIONS
    *   SSF_KRN_ERROR                  = 1
    *   SSF_KRN_NOOP                   = 2
    *   SSF_KRN_NOMEMORY               = 3
    *   SSF_KRN_OPINV                  = 4
    *   SSF_KRN_INPUT_DATA_ERROR       = 5
    *   SSF_KRN_INVALID_PAR            = 6
    *   SSF_KRN_INVALID_PARLEN         = 7
    *   OTHERS                         = 8
    IF SY-SUBRC <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    catch cx_sy_dyn_call_illegal_type.
    endtry.
    CALL METHOD CL_ABAP_CONV_IN_CE=>CREATE
          EXPORTING
            INPUT       = xstr
            ENCODING    = 'UTF-8'
    *        REPLACEMENT = '?'
    *        IGNORE_CERR = ABAP_TRUE
          RECEIVING
            CONV        = loc_CONV.
    TRY.
        CALL METHOD LOC_CONV->READ
          IMPORTING
            DATA = STR.
    CATCH CX_SY_CONVERSION_CODEPAGE.
    CATCH CX_SY_CODEPAGE_CONVERTER_INIT.
    CATCH CX_PARAMETER_INVALID_TYPE.
    CATCH CX_PARAMETER_INVALID_RANGE.
    ENDTRY.
    wa_solix-line = xstr.
    append wa_solix to it_solix.
    wa_soli-line = str.
    append wa_soli to it_soli.
    endloop.
    try.
    CALL FUNCTION 'SA_KW_RFC_FILENAME_EXT_GET'
      EXPORTING
       AREA            = 'IWBSOLAR'
        MIMETYPE        = wa_attachment-type
    IMPORTING
       EXTENSION       = i_ext
    catch cx_sy_dyn_call_illegal_type.
    endtry.
    i_type = i_ext.
    if i_ext <> 'pdf'.
    try.
      lo_document->add_attachment(
      EXPORTING
        i_attachment_type = i_type
        i_attachment_subject = attachment_sub
        i_att_content_hex = it_solix ).
           CATCH cx_document_bcs.
    endtry.
    clear wa_solix.
    refresh it_solix.
    else.
    TRY.
      CALL METHOD LO_DOCUMENT->ADD_ATTACHMENT
        EXPORTING
          I_ATTACHMENT_TYPE     = i_type
          I_ATTACHMENT_SUBJECT  = attachment_sub
    *      I_ATTACHMENT_SIZE     =
    *      I_ATTACHMENT_LANGUAGE = SPACE
          I_ATT_CONTENT_TEXT    = it_soli
    *      I_ATT_CONTENT_HEX     =
    *      I_ATTACHMENT_HEADER   =
       CATCH CX_DOCUMENT_BCS .
      ENDTRY.
    ENDIF.
    endloop.
    try.
    lo_send_request->set_document( lo_document ).
    CATCH cx_send_req_bcs.
    endtry.
    wa_selection_range-PARAMETER = 'address'.
    wa_selection_range-field = 'e_mail'.
    wa_selection_range-sign = 'I'.
    wa_selection_range-option = 'EQ'.
    wa_selection_range-low = receiver.
    append wa_selection_range to it_selection_range.
    try.
    CALL FUNCTION 'BAPI_USER_GETLIST'
    * EXPORTING
    *   MAX_ROWS              = 0
    *   WITH_USERNAME         = ' '
    * IMPORTING
    *   ROWS                  =
    TABLES
        SELECTION_RANGE       = it_selection_range
    *   SELECTION_EXP         =
        USERLIST              = it_userlist
    *   RETURN                =
    catch cx_sy_dyn_call_illegal_type.
    endtry.
    read table it_userlist into wa_userlist index 1.
    try.
      lo_sender = cl_cam_address_bcs=>create_internet_address( sender ).
      lo_send_request->set_sender(
         EXPORTING
         i_sender = lo_sender ).
    catch cx_send_req_bcs.
    catch cx_document_bcs.
    catch cx_address_bcs.
      return.
    endtry.
    try.
        lo_recipient = cl_sapuser_bcs=>create( wa_userlist-USERNAME ).
        lo_send_request->add_recipient(
           EXPORTING
             i_recipient = lo_recipient ).
    *         i_express = 'X' ).
      catch cx_send_req_bcs.
      catch cx_document_bcs.
      catch cx_address_bcs.
    endtry.
    try.
    ** Send email
         LO_SEND_REQUEST->SET_SEND_IMMEDIATELY( 'X' ).
         lo_send_request->send( EXPORTING
         i_with_error_screen = ' '
         RECEIVING
         result = result ).
         COMMIT WORK.
    CATCH CX_DOCUMENT_BCS.
    CATCH CX_SEND_REQ_BCS INTO lo_message.
    CATCH CX_ADDRESS_BCS.
    text_val = lo_message->IF_MESSAGE~GET_TEXT( ).
    endtry.
    if result = 'X'.
      message = 'E-Mail sent'.
    else.
      message = 'E-Mail not sent'.
    endif.
    ENDFUNCTION.

  • Sending ALV output to the SAP Inbox.

    Hi
    I'm using  SAP report <b>sendlist_bcs</b> for sending report output to the SAP inbox but attachment is not getting delivered.
    Can anybody help to resolve the issue...
    My report is:
    *& Report  ZTTEST_SAGAR
    REPORT  ZTTEST_SAGAR.
    *& Report  SENDLIST_BCS
    *& Sample report from note 190669 for sending lists via SAPconnect
    *& using the BCS interface
    *&  Note:
    *&  1. Set a commit work statement after the sending
    *&  2. Give binary data of type x not type c to send module, i.e.
    *&     use structure solix instead of soli and give it to tables
    *&     parameter contents_hex instead of contents_bin
    *&     Do this by filling contents_hex directly from the module
    *&     table_compress. In case of reading the data from spool, convert
    *&     to solix using so_solitab_to_solixtab
    *&  3. Don't calculate document size. It is done internally
    *report sendlist_bcs no standard page heading message-id so.
    selection-screen begin of block mode with frame title text-001.
    parameters: submit radiobutton group mode default 'X'.
    parameters: write  radiobutton group mode .
    parameters: spool  radiobutton group mode.
    selection-screen end of block mode.
    global data
    data g_list_content type solix_tab.
    data g_text_content type soli_tab.
    data sysid(10) TYPE C.
    *---- start-of-selection -
    start-of-selection.
      perform create_text_content changing g_text_content.
      perform create_list_content changing g_list_content.
      perform send using g_text_content
                         g_list_content.
    a commit work has to be set somewhere after the sending!
      commit work.
    Form routines                                                        *
    *&      Form  create_list_content
    form create_list_content changing list_content type solix_tab.
    1st possibility - use "submit <report> exporting list to memory"
      if submit = 'X'.
        perform use_submit changing list_content.
      endif.
    2nd possibility - create a new list within this report.
      if write = 'X'.
        perform write_a_list changing list_content.
      endif.
    3rd possibility - get list from spool
      if spool = 'X'.
        perform get_list_from_spool changing list_content.
      endif.
    endform.                                         "create_list_content
    *&      Form  create_text_content
    form create_text_content changing text_content type soli_tab.
      append 'This is the first line'  to text_content.         "#EC NOTEXT
      append 'This is the second line' to text_content.         "#EC NOTEXT
    convert the content from RAW to TXT
      call function 'SO_RAW_TO_RTF'
        tables
          objcont_old = text_content
          objcont_new = text_content
        exceptions
          others      = 0.
    endform.                                         "create_text_content
    *&      Form  SEND
    form send using text_content type soli_tab
                    list_content type solix_tab.
      data  send_request       type ref to cl_bcs.
      data  text               type bcsy_text.
      data  document           type ref to cl_document_bcs.
      data  recipient          type ref to if_recipient_bcs.
      data  bcs_exception      type ref to cx_bcs.
      data  sent_to_all        type os_boolean.
      try.
        create the send request
          send_request = cl_bcs=>create_persistent( ).
        create the document with attachments
        main document
          append 'Hi,' to text.
          append 'attached you will find the list.' to text.
          document = cl_document_bcs=>create_document(
                                    i_type    = 'RAW'
                                    i_text    = text
                                    i_subject = 'ABAPlist' ).
        add text attachment to document
          document->add_attachment( i_attachment_type    = 'TXT'
                                    i_attachment_subject = text-002
                                    i_att_content_text   = text_content ).
        add list attachment to document
          document->add_attachment( i_attachment_type    = 'ALI'
                                    i_attachment_subject = text-003
                                    i_att_content_hex    = list_content ).
        add document to send request
          send_request->set_document( document ).
          sysid = sy-sysid.
          data : uname type ad_uname.
          uname = 'USTZZSKAZI'.
        create recipient and add to send request
          recipient = cl_cam_address_bcs=>CREATE_RML_ADDRESS( i_syst     = sysid
                                                              i_client   = sy-mandt
                                                              i_username = uname ).
          send_request->add_recipient( i_recipient = recipient ).
        send
          sent_to_all = send_request->send( i_with_error_screen = 'X' ).
          if sent_to_all = 'X'.
           message s022.
          endif.
        catch cx_bcs into bcs_exception.
         message e865 with bcs_exception->error_type.
      endtry.
    endform.                    "send
    *&      Form  USE_SUBMIT
    form use_submit changing contents_hex type solix_tab.
      data listobject type table of abaplist.
    get the list object by calling the list in another report
    F1 on submit gives more information
      submit balvsd03 exporting list to memory and return.
    import the list from memory and store it in table listobject
      call function 'LIST_FROM_MEMORY'
        tables
          listobject = listobject
        exceptions
          not_found  = 1
          others     = 2.
      if sy-subrc <> 0.
       message e105 with 'LIST_FROM_MEMORY'.
      endif.
    free memory
      call function 'LIST_FREE_MEMORY'
        tables
          listobject = listobject
        exceptions
          others     = 1.
      if sy-subrc <> 0.
       message e105 with 'LIST_FREE_MEMORY'.
      endif.
    it's always necessary to compress the table.
    SAPconnect will decompress it
      call function 'TABLE_COMPRESS'                            "#EC *
        tables
          in             = listobject
          out            = contents_hex
        exceptions
          compress_error = 1
          others         = 2.
      if sy-subrc <> 0.
       message e105 with 'TABLE_COMPRESS'.
      endif.
    endform.                               " USE_SUBMIT
    *&      Form  WRITE_A_LIST
    form write_a_list changing contents_hex type solix_tab.
      data listobject type table of abaplist.
      perform write_list.
    Save the list and store table listobject
      call function 'SAVE_LIST'
        exporting
          list_index         = sy-lsind
        tables
          listobject         = listobject
        exceptions
          list_index_invalid = 1.
      if sy-subrc = 1.
       message e105 with 'SAVE_LIST'.
      endif.
    It's always necessary to compress the table
    SAPconnect will decompress it
      call function 'TABLE_COMPRESS'                            "#EC *
        tables
          in             = listobject
          out            = contents_hex
        exceptions
          compress_error = 1
          others         = 2.
      if sy-subrc <> 0.
       message e105 with 'TABLE_COMPRESS'.
      endif.
    endform.                               " WRITE_A_LIST
    *&      Form  GET_LIST_FROM_SPOOL
    form get_list_from_spool changing contents_hex type solix_tab.
      data spool_number     type rspoid.
      data contents_bin     type soli_tab.
      data print_parameters type pri_params.
      data valid            type c.
    write a list into spool
      call function 'GET_PRINT_PARAMETERS'
        importing
          out_parameters         = print_parameters
          valid                  = valid
        exceptions
          archive_info_not_found = 1
          invalid_print_params   = 2
          invalid_archive_params = 3
          others                 = 4.
      if sy-subrc <> 0.
       message e105 with 'GET_PRINT_PARAMETERS'.
      elseif valid is initial.
        return.
      endif.
      new-page print on parameters print_parameters no dialog.
      perform write_list.
      new-page print off.
      spool_number = sy-spono.
    you can also send OTF documents from spool with this function
    module. The importing parameter real_type gives you the doc type
    that you have to give to the send interface. The parameter is not
    used here
      call function 'RSPO_RETURN_SPOOLJOB'
        exporting
          rqident              = spool_number
        tables
          buffer               = contents_bin
        exceptions
          no_such_job          = 1
          job_contains_no_data = 2
          selection_empty      = 3
          no_permission        = 4
          can_not_access       = 5
          read_error           = 6
          type_no_match        = 7
          others               = 8.
      if sy-subrc <> 0.
       message e105 with 'RSPO_RETURN_SPOOLJOB'.
      endif.
    convert to hex table
      call function 'SO_SOLITAB_TO_SOLIXTAB'
        exporting
          ip_solitab  = contents_bin
        importing
          ep_solixtab = contents_hex.
    endform.                               " GET_LIST_FROM_SPOOL
    *&      Form  WRITE_LIST
    form write_list.
      data lt_scarr type table of scarr.
      data carr type scarr.
      select * from scarr into table lt_scarr.
      format color = 1.
      uline at /1(46).
      write: / sy-vline,
             'CARRID',   10 sy-vline,
             'CARRNAME', 35 sy-vline,
             'CURRCODE', 46 sy-vline.
      format color = 2.
      uline at /1(46).
      loop at lt_scarr into carr.
        write: / sy-vline,
               carr-carrid,   10 sy-vline,
               carr-carrname, 35 sy-vline,
               carr-currcode, 46 sy-vline.
      endloop.
      uline at /1(46).
      new-line.
    endform.                               " WRITE_LIST
    Thanks,
    sagar

    hi Sagar
    'SO_NEW_DOCUMENT_ATT_SEND_API1' function module for that.
    Example::::
    Data Declaration
    data pdf like tline occurs 0.
    data : objbin  like solisti1   occurs 0 with header line.
    Data: docdata    like sodocchgi1,
          objpack    like sopcklsti1 occurs  1 with header line,
          objhead    like solisti1   occurs  1 with header line,
          objtxt     like solisti1   occurs 10 with header line,
           objbin     like solisti1   occurs 10 with header line,
          objhex     like solix      occurs 10 with header line,
          reclist    type table of SOMLRECI1   with header line.
    Data: listobject like abaplist   occurs  1 with header line.
    data : objhex2 like objhex occurs 0 with header line.
    Data: tab_lines  type i,
          doc_size   type i,
          att_type   like SOODK-OBJTP.
    data: ls_drao like drao occurs 0,
         i_data like drao-orblk occurs 0,
          ls_doc_file like dms_doc_file,
          ls_draw like draw.
    data: begin of i_data occurs 0,
          orbkl like drao-orbkl,
           orblk like drao-orblk,
          end of i_data.
    data: w_data like i_data,
         w_data2 type drao-orbkl,
          wa_drao type drao.
    DATA: t_error(1) type c.
    DATA: t_return like BAPIRET2.
    *ls_draw-mandt = '200'.
    ls_draw-dokar = 'GPO'.
    ls_draw-doknr = 'Z10'.
    ls_draw-dokvr = '00'.
    ls_draw-doktl = '000'.
    ls_draw-dttrg = 'SAP-SYSTEM'.
    ls_draw-dAPPL = 'DOC'.
    ls_doc_file-fileno = '1'.
    ls_doc_file-dttrg = 'SAP-SYSTEM'.
    *Debug the cv03n transaction to see how the FMs are used
    CALL FUNCTION 'CV120_DOC_CHECKOUT_TO_TABLE'
      EXPORTING
      PS_COUT_DEF       =
        ps_doc_file       =   ls_doc_file
        ps_draw           =   LS_DRAW
      tables
      PT_DRAZ           =
        ptx_content       =    ls_drao
      PTX_DRAOZ         =
    EXCEPTIONS
       ERROR             = 1
       OTHERS            = 2
    IF sy-subrc <> 0.
      MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    loop at ls_drao into wa_drao.
      move:  wa_drao-orblk to w_data-orblk.
      append w_data to i_data.
    endloop.
    OBJPACK-HEAD_START = 1.
    DESCRIBE TABLE i_data LINES TAB_LINES.
    CALL FUNCTION 'ZOUTPUT_X_TABLESIZE_CHG'
    EXPORTING
      IV_APPEND          = ' '
       IV_BYTE_MODE       = 'X'
      IV_STRING          =
      IV_XSTRING         =
    IMPORTING
      EV_SIZE            =
      EV_LINES           =
      EV_STRING          =
      EV_XSTRING         =
    TABLES
       IT_DATA            = i_data
       ET_DATA            = objhex
    EXCEPTIONS
       NOENTRIES          = 1
       OTHERS             = 2
    IF SY-SUBRC <> 0.
      MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    loop at objhex.
      move-corresponding objhex to objhex2.
      append objhex2.
    endloop.
    docdata-obj_name  = 'TEST_ALI'.
    docdata-obj_descr = 'Test including ALI/HTML Attachment'.
      Main Text
    objtxt = 'Test Document.'.
    append objtxt.
    objtxt = 'You will find an ALI/HTML attachment '.
    append objtxt.
    objtxt = 'Have a nice day.'.
    append objtxt.
      Write Packing List (Main)
    describe table objtxt lines tab_lines.
    read     table objtxt index tab_lines.
    docdata-doc_size = ( tab_lines - 1 ) * 255 + strlen( objtxt ).
    clear objpack-transf_bin.
    objpack-head_start = 1.
    objpack-head_num   = 0.
    objpack-body_start = 1.
    objpack-body_num   = tab_lines.
    objpack-doc_type   = 'TXT'.
    append objpack.
    Create Message Attachment
      Write Packing List (Attachment)
    att_type = 'PDF'.
    describe table objhex lines tab_lines.
    read     table objhex index tab_lines.
    objpack-doc_size = ( tab_lines ) * 255 ."+ strlen( i_data ).
    objpack-transf_bin = 'X'.
    objpack-head_start = 1.
    objpack-head_num   = 0.
    objpack-body_start = 1.
    objpack-body_num   = tab_lines.
    objpack-doc_type   = att_type.
    objpack-obj_name   = 'ATTACHMENT1'.
    objpack-obj_descr  = 'Attached Document1'.
    append objpack.
    Second attachment
    loop at objhex.
      move-corresponding objhex to objhex2.
      append objhex2.
    endloop.
    *att_type = 'DOC'.
    *describe table objhex lines tab_lines.
    *read     table objhex index tab_lines.
    *objpack-doc_size = ( tab_lines ) * 255 ."+ strlen( i_data ).
    *objpack-transf_bin = 'X'.
    *objpack-head_start = 1.
    *objpack-head_num   = 0.
    *objpack-body_start = 1.
    *objpack-body_num   = tab_lines.
    *objpack-doc_type   = att_type.
    *objpack-obj_name   = 'ATTACHMENT2'.
    *objpack-obj_descr  = 'Attached Document2'.
    *append objpack.
    Third attachment
    *loop at objhex.
    move-corresponding objhex to objhex2.
    append objhex2.
    *endloop.
    *att_type = 'PDF'.
    *describe table objhex lines tab_lines.
    *read     table objhex index tab_lines.
    *objpack-doc_size = ( tab_lines ) * 255 ."+ strlen( i_data ).
    *objpack-transf_bin = 'X'.
    *objpack-head_start = 1.
    *objpack-head_num   = 0.
    *objpack-body_start = 1.
    *objpack-body_num   = tab_lines.
    *objpack-doc_type   = att_type.
    *objpack-obj_name   = 'ATTACHMENT3'.
    *objpack-obj_descr  = 'Attached Document3'.
    *append objpack.
    Create receiver list
    data: reclist1 type sadrfd .
    reclist1-rec_fax = '650-467-2890'.
    reclist1-REC_STATE = 'US'.
    append reclist1.
    *read table reclist1 index 1.
    move reclist1(30) to reclist-receiver(30).
    move reclist1346(3) to reclist-receiver346(3).
    *reclist-receiver = reclist1."'US16503457900'.
    *move reclist1-rec_fax to reclist-receiver.
    *reclist-receiver = 'US16502796630'.  "'+1 (16502796999)'.
    reclist-REC_type = 'F'.
    *reclist-country = 'US'.
    *reclist-COM_TYPE = 'TELFAX'.
    *reclist-fax = 'US1650-279-6630'.
    append reclist.
    *reclist-receiver = sy-uname.                "<-- change internal user
    *reclist-rec_type = 'B'.
    *append reclist.
    Send Message
    CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
      EXPORTING
        document_data                     = docdata
         PUT_IN_OUTBOX                     = 'X'
         COMMIT_WORK                       = 'X'     "used from rel.6.10
      IMPORTING
        SENT_TO_ALL                        =
        NEW_OBJECT_ID                     =
      tables
        packing_list                      = objpack
        OBJECT_HEADER                     = objhead
        CONTENTS_BIN                      = objbin
        CONTENTS_TXT                      = objtxt
         CONTENTS_HEX                      = objhex
        OBJECT_PARA                        =
        OBJECT_PARB                        =
        receivers                         = reclist
       EXCEPTIONS
         TOO_MANY_RECEIVERS               = 1
         DOCUMENT_NOT_SENT                = 2
         DOCUMENT_TYPE_NOT_EXIST          = 3
         OPERATION_NO_AUTHORIZATION       = 4
         PARAMETER_ERROR                  = 5
         X_ERROR                           = 6
         ENQUEUE_ERROR                     = 7
         OTHERS                            = 8
    IF sy-subrc <> 0.
      message ID 'SO' TYPE 'S' NUMBER '023'
              with docdata-obj_name.
    ENDIF.
    **Please reward suitable points***
    With Regards
    Navin Khedikar

  • Urgent :- Sending output to SAP User's inbox as Excel Attachment.

    Hi,
    This is urgent requirement
    Requirement Description in breif :-
    1.I have a report and but when run in background, it should create an excel file and should be sent as attachment to sap inbox of the same user who is executing the report.
    2.I have tried all most all function modules. the limitations were some of the F.M are not supported in background mode (which the sap it self uses) And I could able to send data  to excel excel file only upto 255 chars per record. i.e these F.M's are allowing me to send a internal table but every record of 255 chars only.
    3.Which is not sufficient to send my ITAB contents. and contents after 255 are truncating.
    Sending output of report in Excel Format ,in Background

    Hi srinivas,
    check this thread
    Convert output display to Excel file and Email to a set of users
    Regards,
    Raj

  • READ PDF ATTACHMENT FROM SAP INBOX

    Hi all,
    can any one tell me the FM's used to read the pdf attachment from the sap inbox.
    Thanks& Regards,
    Arun.

    Hi Arun
    See this [PDF|https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/2c678dc3-0401-0010-3c80-8ef48f450491] of SCN
    Regards
    S@chin

  • Read Attachment from SAP inbox and Transfer to Application Server Folder

    Hi
      I have one requirement . I have to developed one background program to read the all the attachment in SAP inbox and transfer all this attachment to sap application server folder.
    Thanks and Regards
    Shyam

    Hi Rajendra ,
    please try this code snippet , here we call a selection screen that allows us to browse the file name .
    PARAMETER : p_file TYPE localfile OBLIGATORY .
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file .
      data: user_action type i, filename type filetable, result type i,
            fn type file_table.
    CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_OPEN_DIALOG
      EXPORTING
        WINDOW_TITLE            = 'SELECT FILE'
       DEFAULT_EXTENSION       =
       DEFAULT_FILENAME        =
       FILE_FILTER             =
       INITIAL_DIRECTORY       =
       MULTISELECTION          =
      CHANGING
        FILE_TABLE              = filename
        RC                      = result
        USER_ACTION             = user_action
      EXCEPTIONS
        FILE_OPEN_DIALOG_FAILED = 1
        CNTL_ERROR              = 2
        ERROR_NO_GUI            = 3
        NOT_SUPPORTED_BY_GUI    = 4
        others                  = 5
      if user_action = cl_gui_frontend_services=>action_ok.
        clear p_file.
        loop at filename into fn.
          p_file = fn-filename.
        endloop.
      endif.
    Hopefully it helps

  • Simple code to send ALV display as XLS attachment  to SAP inbox

    Hi All,
    Simple code to send ALV display as XLS attachment  to SAP inbox.
    Also i need to send only 200 records per attachement. So in this case i need send multiple attachment per mail
    Thanks,
    Lokesh

    The following code is used to send the internal table which u pass fo  the ALV display to be send as excel sheet attachment
    Internal table is it_attach[]
    ld_email               = po_email.
      ld_mtitle              = 'Email From Z377_EMAIL_XLS'.
      ld_format              = 'XLS'.
      ld_attdescription      = 'filename'.
      ld_attfilename         = 'Allot'.
      ld_sender_address      = ' '.
      ld_sender_address_type = ' '.
    * Fill the document data.
      w_doc_data-doc_size = 1.
    * Populate the subject/generic message attributes
      w_doc_data-obj_langu = sy-langu.
      w_doc_data-obj_name  = 'SAPRPT'.
      w_doc_data-obj_descr = ld_mtitle .
      w_doc_data-sensitivty = 'F'.
    * Fill the document data and get size of attachment
      CLEAR w_doc_data.
      READ TABLE it_attach INDEX w_cnt.
      w_doc_data-doc_size =
      ( w_cnt - 1 ) * 255 + STRLEN( it_attach ).
      w_doc_data-obj_langu  = sy-langu.
      w_doc_data-obj_name   = 'SAPRPT'.
      w_doc_data-obj_descr  = ld_mtitle.
      w_doc_data-sensitivty = 'F'.
      CLEAR t_attachment.
      REFRESH t_attachment.
      t_attachment[] = it_attach[].
    * Describe the body of the message
      CLEAR t_packing_list.
      REFRESH t_packing_list.
      t_packing_list-transf_bin = space.
      t_packing_list-head_start = 1.
      t_packing_list-head_num = 0.
      t_packing_list-body_start = 1.
      DESCRIBE TABLE li_content LINES t_packing_list-body_num.
      t_packing_list-doc_type = 'RAW'.
      APPEND t_packing_list.
    * Create attachment notification
      t_packing_list-transf_bin = 'X'.
      t_packing_list-head_start = 1.
      t_packing_list-head_num   = 1.
      t_packing_list-body_start = 1.
      DESCRIBE TABLE t_attachment LINES t_packing_list-body_num.
      t_packing_list-doc_type   =  ld_format.
      t_packing_list-obj_descr  =  ld_attdescription.
      t_packing_list-obj_name   =  ld_attfilename.
      t_packing_list-doc_size   =  t_packing_list-body_num * 255.
      APPEND t_packing_list.
    * Add the recipients email address
      CLEAR t_receivers.
      REFRESH t_receivers.
      t_receivers-receiver = ld_email.
      t_receivers-rec_type = 'U'.
      t_receivers-com_type = 'INT'.
      t_receivers-notif_del = 'X'.
      t_receivers-notif_ndel = 'X'.
      APPEND t_receivers.
      CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
      EXPORTING
      document_data              = w_doc_data
      put_in_outbox              = 'X'
      sender_address             = ld_sender_address
      sender_address_type        = ld_sender_address_type
      commit_work                = 'X'
    *IMPORTING
    *sent_to_all                = w_sent_all
      TABLES
      packing_list               = t_packing_list
      contents_bin               = t_attachment
      contents_txt               = li_content
      receivers                  = t_receivers
      EXCEPTIONS
      too_many_receivers         = 1
      document_not_sent          = 2
      document_type_not_exist    = 3
      operation_no_authorization = 4
      parameter_error            = 5
      x_error                    = 6
      enqueue_error              = 7
      OTHERS                     = 8.

  • Read Excel attachment from mail

    Hi,
    Will be happy to know the inputs for the below specific requirement,
    Step 1 : User will get an email into SAPinbox with an excel or text file as attachment.
    Step 2 : Then a background <b>(automatic)</b> program should read the mail including the attached file.
    Step 3 : Program should extract and data from excel file then execute some business process.
    Any inputs will be highly helpful.
    Regards
    Manohar

    Hi Manohar,
    The mail which comes into SAP Inbox with say .xls file, when the attachment is selected, SAP downloads that .xls file to your presentation server and the same is opened through EXCEL.
    If the path and filename is fixed, you can write a program which calls FM SO_OBJECT_UPLOAD, get the data, and do the processing of the same.
    Regards,
    Raj

  • Attachment in portal not getting displayed in SAP Inbox

    Hi All.
    While creating travel expense requests from Enterprise Portal, travelers create few attachments and then save the travel expense reports.
    A workflow then gets triggered and these travel expense reports reach SAP Inboxes of the checkers [in the finance department].
    The issue here is that these checkers do not have access to enterprise portal and they expect to see the attachments [that the traveler has created via the portal] via corresponding work items in their SAP Inboxes u2013 which currently is not happening!
    I checked the trip transaction that got created [in the backend / in SAP] and found the u2018attachment listu2019 menu option in GOS being disabled [may be because there is not even one attachment that has come to the backend!]
    What needs to be done so that the attachments can even be viewed from the backend / from SAP Inbox? Please suggest!
    Br,
    Hari

    Hi,
      You may have to check with the stylesheet, Check if the iVIews are using portal stylesheets from portal theme. If you want to use WD style sheets, The parameter for the web dynpro to use special theme "sap.useWebDynproStyleSheet" should be "true" (configuration adapter->webdynpro->sap.com->tcwddispwda) in visual admin. If you want to set this option for particular iViews only, then from the WD iView properties, set 'Supply Portal stylesheet' property to 'No'.
    Regards,
    Harini S

  • I can no longer open excel documents in my doc to go app. Error message simple reads can not open attachment. And the attachment is now a winmail.dat

    I can no longer open excel documents in my doc to go app. Error message simple reads can not open attachment. And the attachment is now a winmail.dat

    winmail.dat files usually mean the email has been sent in rich text format - you could either the person who sent it to send it in a different format e.g. plain text or HTML, or there are a few apps in the store that support it (search for winmail.date in the store).
    winmail.dat files : http://support.apple.com/kb/TS1506

  • How to read a mail from sap inbox thru abap code?

    how to read a mail from sap INBOX thru abap code? can anyone tell me the technical approach? I NEED TO READ A MAIL and then need to pass the parameters to a bapi.
    Message was edited by:
            shahid mohammed syed

    Hi SSM,
    Did you manage to have your program working? I also have same requirement. I tried standard FM and BAPI but I always encounter authorization error when I tried accessing other user's mail. Thanks.
    Regards,
    Ryan

  • Send email with excel attachment in outlook structure - SAP 6.0

    Hello experts..
    I need send a email with a excel attachment and use the signature in outlook to send.
    The attachment will be create in the process of send email program.
    Is it possible?
    How can I created and attach in the same process?
    How can I use the outlook strutucture to send a email?

    I  resolved my own problem using the BCS_EXAMPLE_7 program as sample.

  • Smartforms as OTF attachment in SAP inbox

    Hi,
    I need to create a smartform which is directly sent to the SAP inbox of the user as an OTF file.
    Can anyone provide me with the code for this.
    thanks and regards
    Aviroop

    Hi Aviroop
    Check this thread,
    smartform (otf) as pdf and sending as email-attachment
    cheers
    sameer

  • Alv result send mail to sap inbox internally

    Hi,
        How to send a e-mail alv results to the sap inbox internally. Please povide me meterial or suggest me, if anybody have an idea about this requirement. It is my short time requirement. Please help me.
    Thanks.
    Regards,
    prasad.

    hi,
      Thank you for ur reply.
    Now I am able to send email from local sap to sap inbox with an attachement as excel sheet, but the all the records would be having in the first row only.
    actually, I need to get each record in separate row , how to get it. please help me.
    really thank you very much for ur help.
    prasad.

  • Issue with Excel Attachement in BI 7.0

    Hi,
    I have developed a custom report to send an e-mail with excel attachment in BI 7.0. When we are trying to open the excel sheet attachment in the e-mail. I am getting a message warning message stating that<b> 'This file is not in a recognizable format'</b>. but if we click on ok button then everything looks fine i.e the data is displaying as expected.
    I have developed the same reports in SAP R/3 and SRM but I don't see any issues over there.
    Can any one help me on this issue.
    Thanks in advance,
    Venkat Bomma

    When the selection screen pops up choose the KEY only function on the TOOLS on the top right corner of the screen. Then you will be able to enter the values manually.
    Hope this helps.

Maybe you are looking for

  • Users on same mac using the same itunes library

    How can i allow another user on my mac access my library on their itunes, without copying all my tunes to shared folder, i.e, can change privileges to allow them access? cheers

  • How to post gr without purchase order fi-mm

    Dear All I need one requirement in integration fi-mm how to configure exces quantity against po quantity po quantity 100 gr 105 while posted gr system gettign error E 147(M8) ACCOUNT DETERMINATION FOR ENTRY 9000. I NEED CONFIGURATION HOW TO DO IT

  • Reminder app problem adding new entry.

    I updated my iPad to IOS 5. Testing the "reminder" app lets me easily add new reminders. After three tries all the buttons under "edit" disappeared. Is there any way to reset/reinstall the app or to get the buttons back. As I'm from Germany maybe the

  • Can I connect multiple bluetooth headsets to my iPod at the same time?

    Can I connect multiple bluetooth headsets to my iPod at the same time?

  • IPhone stopped showing up in itunes

    I recently updated itunes to the newest one and did some software updates on my computer. After doing these my iphone only is showing up as a camera, and does not come up in itunes. I reinstalled itunes but it still does not show up. Does anyone know