About FM SO_NEW_DOCUMENT_ATT_SEND_API1

Dear All.
           Can anyone tell me why the Exception 2 =  Document Not Send
           will get triggered when using  FM
           SO_NEW_DOCUMENT_ATT_SEND_API1
          What parameters could be cause for that Error.
Thanks & Regards,
Satya.

Hi ,
I am also getting the same exception.and receiver mailid and receiver type both are correct then also i m getting that DOCUMENT_NOT_SENT = 2 exception.
If anyone can help me in this..
Thanks.
-Dipali.

Similar Messages

  • About using SO_NEW_DOCUMENT_ATT_SEND_API1 to send mail to external!

    hi
    i using the function to send mail from sap to external!
    the coding as follow: but i will get sy-subrc = 2:document could not be sent to any of the recipients
    if i want to send mail from SAP
    and how to solved it !
    thank you very much!
    *& Report  ZJOHN_STUDY1
    REPORT  ZJOHN_STUDY1.
    *REPORT  ZSSO_DOCUMENT_SEND_API1.
    DATA: OBJPACK LIKE SOPCKLSTI1 OCCURS  2 WITH HEADER LINE.
    DATA: OBJHEAD LIKE SOLISTI1   OCCURS  1 WITH HEADER LINE.
    DATA: OBJBIN  LIKE SOLISTI1   OCCURS 10 WITH HEADER LINE.
    DATA: OBJTXT  LIKE SOLISTI1   OCCURS 10 WITH HEADER LINE.
    DATA: RECLIST LIKE SOMLRECI1  OCCURS  5 WITH HEADER LINE.
    DATA: DOC_CHNG LIKE SODOCCHGI1.
    DATA: TAB_LINES LIKE SY-TABIX.
    * Creating the document to be sent
    DOC_CHNG-OBJ_NAME = 'OFFER'.
    DOC_CHNG-OBJ_DESCR = 'Auction of a Picasso jr'.
    OBJTXT = 'Reserve price : $250000'.
    APPEND OBJTXT.
    OBJTXT = 'A reproduction of the painting to be auctioned'.
    APPEND OBJTXT.
    OBJTXT = 'is enclosed as an attachment.'.
    APPEND OBJTXT.
    DESCRIBE TABLE OBJTXT LINES TAB_LINES.
    READ TABLE OBJTXT INDEX TAB_LINES.
    DOC_CHNG-DOC_SIZE = ( TAB_LINES - 1 ) * 255 + STRLEN( OBJTXT ).
    * Creating the entry for the compressed document
    CLEAR OBJPACK-TRANSF_BIN.
    OBJPACK-HEAD_START = 1.
    OBJPACK-HEAD_NUM   = 0.
    OBJPACK-BODY_START = 1.
    OBJPACK-BODY_NUM   = TAB_LINES.
    OBJPACK-DOC_TYPE   = 'RAW'.
    APPEND OBJPACK.
    * Creating the document attachment
    * (Assume the data in OBJBIN are given in BMP format)
    OBJBIN = ' \O/ '. APPEND OBJBIN.
    OBJBIN = '  |  '. APPEND OBJBIN.
    OBJBIN = ' / \ '. APPEND OBJBIN.
    DESCRIBE TABLE OBJBIN LINES TAB_LINES.
    OBJHEAD = 'picasso.bmp'. APPEND OBJHEAD.
    * Creating the entry for the compressed attachment
    OBJPACK-TRANSF_BIN = 'X'.
    OBJPACK-HEAD_START = 1.
    OBJPACK-HEAD_NUM   = 1.
    OBJPACK-BODY_START = 1.
    OBJPACK-BODY_NUM   = TAB_LINES.
    OBJPACK-DOC_TYPE   = 'BMP'.
    OBJPACK-OBJ_NAME   = 'ATTACHMENT'.
    OBJPACK-OBJ_DESCR = 'Reproduction object 138'.
    OBJPACK-DOC_SIZE   = TAB_LINES * 255.
    APPEND OBJPACK..
    * Entering names in the distribution list
    RECLIST-RECEIVER = "'test  @   test   . com". "is external mail
    RECLIST-REC_TYPE = 'U'.
    RECLIST-com_type = 'INT'.
    RECLIST-notif_del = 'X'.
    RECLIST-notif_ndel = 'X'.
    APPEND RECLIST.
    *RECLIST-RECEIVER = 'DLI-NEUREICH'.
    *RECLIST-REC_TYPE = 'P'.
    *APPEND RECLIST.
    *** Sending the document
    CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
      EXPORTING
        DOCUMENT_DATA              = DOC_CHNG
        PUT_IN_OUTBOX              = 'X'
        COMMIT_WORK                = 'X'
      TABLES
        PACKING_LIST               = OBJPACK
        OBJECT_HEADER              = OBJHEAD
        CONTENTS_BIN               = OBJBIN
        CONTENTS_TXT               = OBJTXT
        RECEIVERS                  = RECLIST
      EXCEPTIONS
        TOO_MANY_RECEIVERS         = 1
        DOCUMENT_NOT_SENT          = 2
        OPERATION_NO_AUTHORIZATION = 4
        OTHERS                     = 99.
    CASE SY-SUBRC.
      WHEN 0.
        WRITE: / 'Result of the send process:'.
        LOOP AT RECLIST.
          WRITE: / RECLIST-RECEIVER(48), ':'.
          IF RECLIST-RETRN_CODE = 0.
            WRITE 'sent successfully'.
          ELSE.
            WRITE 'not sent'.
          ENDIF.
        ENDLOOP.
      WHEN 1.
        WRITE: /
        'no authorization to send to the specified number of recipients!'.
      WHEN 2.
        WRITE: / 'document could not be sent to any of the recipients!'.
      WHEN 4.
        WRITE: / 'no authorization to send !'.
      WHEN OTHERS.
        WRITE: / 'error occurred during sending !'.
    ENDCASE.
    Code Formatted by: Alvaro Tejada Galindo on Jan 7, 2009 12:36 PM

    when sy-subrc = 0 for above f.m then write below coding...
    if sy-subrc = 0.
    SUBMIT RSCONN01 WITH MODE = 'INT'. ----> *to run scot t.code*
    endif.
    as below..
          CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
          EXPORTING
          document_data = doc_chng
          put_in_outbox = 'X'
          commit_work = 'X'
          TABLES
          packing_list = objpack
          contents_txt = objtxt[]
          contents_bin = so_ali[]
    *contents_hex = so_ali[]
          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 'Mail sent successfully' TYPE 'S'.
    *SUBMIT RSCONN01 WITH MODE = MODE.*
          ENDIF.
    Edited by: shan palani on Jan 7, 2009 4:10 PM
    Code Formatted by: Alvaro Tejada Galindo on Jan 7, 2009 12:36 PM

  • More than 255 bytes in SO_NEW_DOCUMENT_ATT_SEND_API1

    I know they are some posts about this topic already but I have read them all but I still don't have the solution. I hope someone could help me with this:
    The problem is this: I have an internal table and I make an excell file of it which is mailed (sapmail) to the user who started the program. I all works fine except for the problem of the 255 limit. This happens because SOLISTI1 has an 255 limit. The excell attachment is mailed but it breaks after 255 characters (the total characters is about 500).
    I know there are some solutions with TABLE_COMPRESS and TABLE_DECOMPRESS but I don't know on which moment you should compress or decompress which table! Below if my coding hope someone can help:
    REPORT ZDTAFNAME_K.
    tables: marc,
    lips,
    vbrp,
    mara,
    kna1,
    vbak,
    VBKD,
    vbrk,
    vbap,
    vbep,
    mvke,
    mbew.
    selection-screen: begin of block select with frame title text-f70.
    select-options art for marc-matnr.
    select-options abc for marc-abcin.
    select-options fak for vbrp-vbeln default '20406070'.
    Select-options dat for vbrp-erdat.
    selection-screen: end of block select.
    PARAMETERS: p_email TYPE somlreci1-receiver
    DEFAULT '31dtg'.
    data: rule(2) value '.,'.
    data: begin of itab occurs 0,
    deb like vbak-kunnr, "Debiteurennummer
    debnaam like kna1-name1, "Naam debiteur
    bestnr like vbkd-bstkd, "Bestelnr klant
    artnr like marc-matnr, "Artikelnr
    oms like lips-arktx, "Omschrijving
    type like mara-groes, "Type
    fab like lips-matkl, "Fabrikaat
    faktuurdat like vbrp-erdat, "Faktuurdatum
    faksrt like vbrk-fkart, "Faktuursoort
    faktuur like vbrp-vbeln, "Faktuurnr
    fakpos like vbrp-posnr, "Faktuurpositie
    fakaantal(11) type c , "Faktuuraantal
    fakeenh like vbrp-meins, "Faktuureenheid
    fakwaarde(11) type c , "Faktuurwaarde
    orddat like vbap-erdat, "Orderdatum
    ordsrt like vbak-auart, "Ordersoort
    verkoper like vbak-ernam, "Verkoper
    ordnr like lips-vgbel, "Ordernr
    ordnrpos like lips-vgpos, "Order positie
    artklant like vbap-kdmat, "Artikelnr klant
    ordaant(11) type c, "Order aantal
    ordeenh like vbap-meins, "Order eenheid
    ordwaarde(11) type c, "Nettowaarde orderpositie
    postype like vbap-pstyv, "Positietype
    gevlevdat like vbep-edatu, "Gevraagde leverdatum
    levdat like lips-erdat, "Werkelijke leverdatum
    levnr like lips-vbeln, "Leveringsnr
    levpos like lips-posnr, "Levering positie
    levaant(11) type c, "Leveringsaantal
    leveenh like lips-meins, "Leveringseenheid
    min(11) type c, "Bestelpunt
    max(11) type c, "Max vrd
    basiseenh like mara-meins, "Basiseenheid
    abc like marc-abcin, "ABC Classificatie
    artsoort like mara-mtart, "Artikelsoort
    vkstatus(2) type c, "Verkoopstatus
    ikstatus(2) type c, "Inkoopstatus
    minlev(11) type c, "Min levereenheid
    afrd(11) type c, "Afrondingswaarde
    vprs(11) type c, "VPRS
    vprseenh(11) type c, "VPRS eenheid
    end of itab.
    DATA: it_message TYPE STANDARD TABLE OF solisti1 INITIAL SIZE 0
    WITH HEADER LINE.
    DATA: it_attach TYPE STANDARD TABLE OF solisti1 INITIAL SIZE 0
    WITH HEADER LINE.
    DATA: t_packing_list LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE,
    t_contents LIKE solisti1 OCCURS 0 WITH HEADER LINE,
    t_receivers LIKE somlreci1 OCCURS 0 WITH HEADER LINE,
    t_attachment LIKE solisti1 OCCURS 0 WITH HEADER LINE,
    t_object_header LIKE solisti1 OCCURS 0 WITH HEADER LINE,
    w_cnt TYPE i,
    w_sent_all(1) TYPE c,
    w_doc_data LIKE sodocchgi1,
    gd_error TYPE sy-subrc,
    gd_reciever TYPE sy-subrc.
    *START_OF_SELECTION
    START-OF-SELECTION.
    Retrieve sample data from table ekpo
    PERFORM data_retrieval.
    Populate table with detaisl to be entered into .xls file
    PERFORM build_xls_data_table.
    *END-OF-SELECTION
    END-OF-SELECTION.
    Populate message body text
    perform populate_email_message_body.
    Send file by email as .xls speadsheet
    PERFORM send_file_as_email_attachment
    tables it_message
    it_attach
    using p_email
    'Example .xls documnet attachment'
    'XLS'
    'filename'
    changing gd_error
    gd_reciever.
    Instructs mail send program for SAPCONNECT to send email(rsconn01)
    PERFORM initiate_mail_execute_program.
    *& Form DATA_RETRIEVAL
    Retrieve data form EKPO table and populate itab it_ekko
    FORM data_retrieval.
    select * from vbrk client specified where
    mandt = sy-mandt and
    vbeln in fak and
    erdat in dat and
    fkart = 'F2'.
    select * from vbrp client specified where
    mandt = sy-mandt and
    vbeln = vbrk-vbeln and
    erdat in dat and
    matnr in art.
    select single * from marc client specified where
    mandt = sy-mandt and
    werks = 610 and
    matnr = vbrp-matnr and
    abcin in abc.
    if sy-subrc = 0.
    itab-levnr = vbrp-vgbel.
    itab-levpos = vbrp-vgpos.
    itab-faksrt = vbrk-fkart.
    select single * from mara client specified where
    mandt = sy-mandt and
    matnr = marc-matnr.
    if sy-subrc = 0.
    itab-type = mara-groes.
    itab-basiseenh = mara-meins.
    endif.
    select single * from mvke client specified where
    mandt = sy-mandt and
    matnr = marc-matnr.
    if sy-subrc = 0.
    itab-vkstatus = mvke-vmsta.
    itab-minlev = mvke-scmng.
    endif.
    select single * from mbew client specified where
    mandt = sy-mandt and
    matnr = marc-matnr and
    bwkey = 610.
    if sy-subrc = 0.
    itab-vprs = mbew-verpr.
    itab-vprseenh = mbew-peinh.
    endif.
    select single * from vbak client specified where
    mandt = sy-mandt and
    vbeln = vbrp-aubel.
    if sy-subrc = 0.
    itab-deb = vbak-kunnr.
    itab-ordsrt = vbak-auart.
    endif.
    select single * from vbap client specified where
    mandt = sy-mandt and
    vbeln = vbrp-aubel and
    posnr = vbrp-aupos.
    if sy-subrc = 0.
    itab-verkoper = vbap-ernam.
    itab-orddat = vbap-erdat.
    itab-artklant = vbap-kdmat.
    itab-ordaant := vbap-kwmeng.
    itab-ordeenh = vbap-meins.
    itab-ordwaarde := vbap-netwr.
    itab-postype = vbap-pstyv.
    endif.
    select single * from vbep client specified where
    mandt = sy-mandt and
    vbeln = vbap-vbeln and
    posnr = vbap-posnr and
    etenr = '0001'.
    if sy-subrc = 0.
    itab-gevlevdat = vbep-edatu.
    endif.
    select single * from vbkd client specified where
    mandt = sy-mandt and
    vbeln = vbak-vbeln.
    if sy-subrc = 0.
    itab-bestnr = vbkd-bstkd.
    endif.
    select single * from lips client specified where
    mandt = sy-mandt and
    vbeln = vbrp-vgbel and
    posnr = vbrp-vgpos.
    if sy-subrc = 0.
    itab-levdat = lips-erdat.
    itab-levaant = lips-lfimg.
    itab-leveenh = lips-meins.
    else.
    clear itab-levnr.
    clear itab-levpos.
    clear itab-levaant.
    clear itab-levdat.
    endif.
    select single * from kna1 client specified where
    mandt = sy-mandt and
    kunnr = vbak-kunnr.
    if sy-subrc = 0.
    itab-debnaam = kna1-name1.
    endif.
    itab-artnr = marc-matnr.
    itab-oms = vbrp-arktx.
    itab-fab = vbrp-matkl.
    itab-abc = marc-abcin.
    itab-artsoort = mara-mtart.
    itab-min = marc-minbe.
    itab-max = marc-mabst.
    itab-afrd = marc-bstrf.
    itab-ikstatus = marc-mmsta.
    itab-faktuur = vbrp-vbeln.
    itab-fakpos = vbrp-posnr.
    *UNPACK VBRP-FKIMG TO ITAB-FAKAANTAL.
    *shift itab-fakaantal right by 3 places.
    itab-fakaantal = vbrp-fkimg.
    translate itab-fakaantal using rule.
    itab-fakeenh = vbrp-meins.
    itab-faktuurdat = vbrp-erdat.
    *UNPACK VBRP-NETWR TO ITAB-FAKWAARDE.
    *shift itab-FAKWAARDE right by 2 places.
    itab-FAKWAARDE = vbrp-netwr.
    Translate van velden
    translate itab-fakwaarde using rule.
    translate itab-fakaantal using rule.
    translate itab-ordaant using rule.
    translate itab-ordwaarde using rule.
    translate itab-min using rule.
    translate itab-max using rule.
    translate itab-vkstatus using rule.
    translate itab-ikstatus using rule.
    itab-ordnr = vbrp-aubel.
    itab-ordnrpos = vbrp-aupos.
    append itab.
    endif.
    endselect. " Select * from vbrp.
    endselect.
    endform.
    *& Form BUILD_XLS_DATA_TABLE
    Build data table for .xls document
    FORM build_xls_data_table.
    CONSTANTS: con_cret TYPE x VALUE '0D', "OK for non Unicode
    con_tab TYPE x VALUE '09'. "OK for non Unicode
    *If you have Unicode check active in program attributes thnen you will
    *need to declare constants as follows
    *class cl_abap_char_utilities definition load.
    *constants:
    con_tab type c value cl_abap_char_utilities=>HORIZONTAL_TAB,
    con_cret type c value cl_abap_char_utilities=>CR_LF.
    CONCATENATE 'DEBNR' 'NAAM' 'BESTELNR'
    'ARTNR' 'OMSCHRIJVING' 'TYPE'
    'FABRIKAAT' 'FAKTUURDATUM' 'FAKSRT'
    'FAKTUURNR' 'FAK.POS.' 'FAK.AANTAL'
    'FAK.EENH' 'FAKTUUR WAARDE' 'ORDER DATUM'
    'ORDSRT' 'VERKOPER' 'ORDERNR.' 'ORDER.POS.'
    'ARTNR KLANT' 'ORDER AANTAL' 'ORDER EENH'
    'ORDERWAARDE' 'POS.TYPE' 'GEVRAAGDE LEVDAT'
    'WERKELIJKE LEVDAT' 'LEVERINGSNR' 'LEV.POS'
    'LEV.AANTAL' 'LEV.EENH' 'BESTELPUNT'
    'MAX VRD' 'BASISEENH' 'ABC' 'ARTSRT.'
    'VK.STATUS' 'IK.STATUS' 'MIN.LEVEENH.'
    'AFDRONDINGSWAARDE' 'VPRS' 'PER'
    INTO it_attach SEPARATED BY con_tab.
    CONCATENATE con_cret it_attach INTO it_attach.
    APPEND it_attach.
    LOOP AT ITAB.
    CONCATENATE itab-deb itab-debnaam itab-bestnr itab-artnr
    itab-oms itab-type itab-fab itab-faktuurdat
    itab-faksrt itab-faktuur itab-fakpos
    itab-fakaantal itab-fakeenh itab-fakwaarde
    itab-orddat itab-ordsrt itab-verkoper itab-ordnr
    itab-ordnrpos itab-artklant itab-ordaant
    itab-ordeenh itab-ordwaarde itab-postype
    itab-gevlevdat itab-levdat itab-levnr itab-levpos
    itab-levaant itab-leveenh itab-min itab-max
    itab-basiseenh itab-abc itab-artsoort itab-vkstatus
    itab-ikstatus itab-minlev itab-afrd itab-vprs
    itab-vprseenh
    INTO it_attach SEPARATED BY con_tab.
    CONCATENATE con_cret it_attach INTO it_attach.
    APPEND it_attach.
    ENDLOOP.
    ENDFORM. " BUILD_XLS_DATA_TABLE
    *& Form SEND_FILE_AS_EMAIL_ATTACHMENT
    Send email
    FORM send_file_as_email_attachment tables pit_message
    pit_attach
    using p_email
    p_mtitle
    p_format
    p_filename
    p_attdescription
    p_sender_address
    p_sender_addres_type
    changing p_error
    p_reciever.
    DATA: ld_error TYPE sy-subrc,
    ld_reciever TYPE sy-subrc,
    ld_mtitle LIKE sodocchgi1-obj_descr,
    ld_email LIKE somlreci1-receiver,
    ld_format TYPE so_obj_tp ,
    ld_attdescription TYPE so_obj_nam ,
    ld_attfilename TYPE so_obj_des ,
    ld_sender_address LIKE soextreci1-receiver,
    ld_sender_address_type LIKE soextreci1-adr_typ,
    ld_receiver LIKE sy-subrc.
    ld_email = p_email.
    ld_mtitle = p_mtitle.
    ld_format = p_format.
    ld_attdescription = p_attdescription.
    ld_attfilename = p_filename.
    ld_sender_address = p_sender_address.
    ld_sender_address_type = p_sender_addres_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[] = pit_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 it_message 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.
    MOVE: SY-UNAME TO t_RECEIVERs-RECEIVER,
    'X' TO t_RECEIVERs-EXPRESS,
    'B' TO t_RECEIVERs-REC_TYPE.
    APPEND t_RECEIVERs.
    CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_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 = it_message
    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.
    Populate zerror return code
    ld_error = sy-subrc.
    Populate zreceiver return code
    LOOP AT t_receivers.
    ld_receiver = t_receivers-retrn_code.
    ENDLOOP.
    ENDFORM.
    *& Form INITIATE_MAIL_EXECUTE_PROGRAM
    Instructs mail send program for SAPCONNECT to send email.
    FORM initiate_mail_execute_program.
    WAIT UP TO 2 SECONDS.
    SUBMIT rsconn01 WITH mode = 'INT'
    WITH output = 'X'
    AND RETURN.
    ENDFORM. " INITIATE_MAIL_EXECUTE_PROGRAM
    *& Form POPULATE_EMAIL_MESSAGE_BODY
    Populate message body text
    form populate_email_message_body.
    REFRESH it_message.
    it_message = 'Please find attached a list test ekpo records'.
    APPEND it_message.
    endform. " POPULATE_EMAIL_MESSAGE_BODY

    Thanks Kunal Ghosh for your replies. I did try to condense it but it was still more than 255 characters.
    I solved it by using chunks! I spend more than a week to solve this problem! The solution is so simple. Here's the new code for everybody who has the same problem:
    REPORT ZDTAFNAME_K_ART no standard page heading line-size 250.
    tables: marc,
            lips,
            vbrp,
            mara,
            kna1,
            vbak,
            VBKD,
            vbrk,
            vbap,
            vbep,
            mvke,
            mbew.
    selection-screen: begin of block select with frame title text-f70.
    select-options art for marc-matnr.
    select-options abc for marc-abcin.
    select-options fak for vbrp-vbeln.
    Select-options dat for vbrp-erdat.
    select-options fsoort for vbrk-fkart.
    select-options vest for marc-werks.
    selection-screen: end of block select.
    *parameters: p_email   type somlreci1-receiver
                                     DEFAULT '31dtg'.
    data: p_email like somlreci1-receiver.
    data: rule(2) value '.,'.
    data: begin of itab occurs 0,
         deb     like vbak-kunnr,  "Debiteurennummer
         debnaam like kna1-name1,  "Naam debiteur
          bestnr like vbkd-bstkd,  "Bestelnr klant
           artnr like marc-matnr,  "Artikelnr
             oms like lips-arktx,  "Omschrijving
            type like mara-groes,  "Type
             fab like lips-matkl,  "Fabrikaat
      faktuurdat like vbrp-erdat,  "Faktuurdatum
          faksrt like vbrk-fkart,  "Faktuursoort
         faktuur like vbrp-vbeln,  "Faktuurnr
          fakpos like vbrp-posnr,  "Faktuurpositie
       fakaantal(11) type c     ,  "Faktuuraantal
         fakeenh like vbrp-meins,  "Faktuureenheid
           fakwaarde(11) type c ,  "Faktuurwaarde
          orddat like vbap-erdat,  "Orderdatum
          ordsrt like vbak-auart,  "Ordersoort
        verkoper like vbak-ernam,  "Verkoper
           ordnr like lips-vgbel,  "Ordernr
        ordnrpos like lips-vgpos,  "Order positie
        artklant like vbap-kdmat,  "Artikelnr klant
              ordaant(11) type c,  "Order aantal
         ordeenh like vbap-meins,  "Order eenheid
             ordwaarde(11) type c, "Nettowaarde orderpositie
         postype like vbap-pstyv,  "Positietype
       gevlevdat like vbep-edatu,  "Gevraagde leverdatum
          levdat like lips-erdat,  "Werkelijke leverdatum
           levnr like lips-vbeln,  "Leveringsnr
          levpos like lips-posnr,  "Levering positie
         levaant(11) type c,       "Leveringsaantal
         leveenh like lips-meins,  "Leveringseenheid
             min(11) type c,  "Bestelpunt
             max(11) type c,  "Max vrd
       basiseenh like mara-meins,  "Basiseenheid
             abc like marc-abcin,  "ABC Classificatie
        artsoort like mara-mtart,  "Artikelsoort
        vkstatus(2) type c,        "Verkoopstatus
        ikstatus(2) type c,        "Inkoopstatus
          minlev(11) type c,       "Min levereenheid
            afrd(11) type c,       "Afrondingswaarde
            vprs(11) type c,       "VPRS
        vprseenh(11) type c,       "VPRS eenheid
      end of itab.
    DATA:   it_message TYPE STANDARD TABLE OF solisti1 INITIAL SIZE 0
                    WITH HEADER LINE.
    DATA:   it_attach TYPE STANDARD TABLE OF solisti1 INITIAL SIZE 0
                    WITH HEADER LINE.
    DATA:   t_packing_list LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE,
            t_contents LIKE solisti1 OCCURS 0 WITH HEADER LINE,
            t_receivers LIKE somlreci1 OCCURS 0 WITH HEADER LINE,
            t_attachment LIKE solisti1 OCCURS 0 WITH HEADER LINE,
            t_object_header LIKE solisti1 OCCURS 0 WITH HEADER LINE,
            w_cnt TYPE i,
            w_sent_all(1) TYPE c,
            w_doc_data LIKE sodocchgi1,
            gd_error    TYPE sy-subrc,
            gd_reciever TYPE sy-subrc.
    *START_OF_SELECTION
    START-OF-SELECTION.
      Retrieve sample data from table ekpo
      PERFORM data_retrieval.
      Populate table with detaisl to be entered into .xls file
      PERFORM build_xls_data_table.
    *END-OF-SELECTION
    END-OF-SELECTION.
    Populate message body text
      perform populate_email_message_body.
    Send file by email as .xls speadsheet
      PERFORM send_file_as_email_attachment
                              tables it_message
                              it_attach
                              using p_email
                              'Xls bestand afname per artikelsoort'
                                          'XLS'
                                          'filename'
                                 changing gd_error
                                          gd_reciever.
      Instructs mail send program for SAPCONNECT to send email(rsconn01)
      PERFORM initiate_mail_execute_program.
    *&      Form  DATA_RETRIEVAL
          Retrieve data form EKPO table and populate itab it_ekko
    FORM data_retrieval.
    select * from vbrk client specified where
             mandt = sy-mandt and
             vbeln in fak and
             erdat in dat and
             fkart in fsoort.
    select * from vbrp client specified where
             mandt = sy-mandt and
             vbeln = vbrk-vbeln and
             matnr in art.
      select single * from  marc client specified where
      mandt = sy-mandt and
      werks in vest and
      matnr = vbrp-matnr and
      abcin in abc.
      if sy-subrc = 0.
        itab-levnr = vbrp-vgbel.
        itab-levpos = vbrp-vgpos.
        itab-faksrt = vbrk-fkart.
        select single * from mara client specified where
                        mandt = sy-mandt and
                        matnr = marc-matnr.
        if sy-subrc = 0.
          itab-type = mara-groes.
          itab-basiseenh = mara-meins.
        endif.
        select single * from mvke client specified where
                        mandt = sy-mandt and
                        matnr = marc-matnr.
        if sy-subrc = 0.
          itab-vkstatus = mvke-vmsta.
          itab-minlev = mvke-scmng.
        endif.
        select single * from mbew client specified where
                        mandt = sy-mandt and
                        matnr = marc-matnr and
                        bwkey = 610.
        if sy-subrc = 0.
          itab-vprs = mbew-verpr.
          itab-vprseenh = mbew-peinh.
        endif.
        select single * from vbak client specified where
                        mandt = sy-mandt and
                        vbeln = vbrp-aubel.
        if sy-subrc = 0.
          itab-deb = vbak-kunnr.
          itab-ordsrt = vbak-auart.
        endif.
        select single * from vbap client specified where
                        mandt = sy-mandt and
                        vbeln = vbrp-aubel and
                        posnr = vbrp-aupos.
        if sy-subrc = 0.
          itab-verkoper = vbap-ernam.
          itab-orddat = vbap-erdat.
          itab-artklant = vbap-kdmat.
          itab-ordaant := vbap-kwmeng.
          itab-ordeenh = vbap-meins.
          itab-ordwaarde := vbap-netwr.
          itab-postype = vbap-pstyv.
        endif.
        select single * from vbep client specified where
                        mandt = sy-mandt and
                        vbeln = vbap-vbeln and
                        posnr = vbap-posnr and
                        etenr = '0001'.
        if sy-subrc = 0.
          itab-gevlevdat = vbep-edatu.
        endif.
        select single * from vbkd client specified where
                        mandt = sy-mandt and
                        vbeln = vbak-vbeln.
        if sy-subrc = 0.
          itab-bestnr = vbkd-bstkd.
        endif.
        select single * from lips client specified where
                        mandt = sy-mandt and
                        vbeln = vbrp-vgbel and
                        posnr = vbrp-vgpos.
        if sy-subrc = 0.
          itab-levdat = lips-erdat.
          itab-levaant = lips-lfimg.
          itab-leveenh = lips-meins.
        else.
          clear itab-levnr.
          clear itab-levpos.
          clear itab-levaant.
          clear itab-levdat.
        endif.
        select single * from kna1 client specified where
                        mandt = sy-mandt and
                        kunnr = vbak-kunnr.
        if sy-subrc = 0.
          itab-debnaam = kna1-name1.
        endif.
        itab-artnr = marc-matnr.
        itab-oms = vbrp-arktx.
        itab-fab = vbrp-matkl.
        itab-abc = marc-abcin.
        itab-artsoort = mara-mtart.
        itab-min = marc-minbe.
        itab-max = marc-mabst.
        itab-afrd = marc-bstrf.
        itab-ikstatus = marc-mmsta.
        itab-faktuur = vbrp-vbeln.
        itab-fakpos = vbrp-posnr.
    *UNPACK VBRP-FKIMG TO ITAB-FAKAANTAL.
    *shift itab-fakaantal right by 3 places.
    itab-fakaantal = vbrp-fkimg.
    translate itab-fakaantal using rule.
        itab-fakeenh = vbrp-meins.
        itab-faktuurdat = vbrp-erdat.
    *UNPACK VBRP-NETWR TO ITAB-FAKWAARDE.
    *shift itab-FAKWAARDE right by 2 places.
    itab-FAKWAARDE = vbrp-netwr.
    Translate van velden
    translate itab-fakwaarde using rule.
    translate itab-fakaantal using rule.
    translate itab-ordaant using rule.
    translate itab-ordwaarde using rule.
    translate itab-min using rule.
    translate itab-max using rule.
    translate itab-vkstatus using rule.
    translate itab-ikstatus using rule.
    translate itab-VPRS using rule.
    translate itab-vprseenh using rule.
    translate itab-levaant using rule.
    translate itab-minlev using rule.
    translate itab-afrd using rule.
        itab-ordnr = vbrp-aubel.
        itab-ordnrpos = vbrp-aupos.
    append itab.
    clear itab.
    endif.
    endselect. " Select * from vbrp.
    endselect. " Select * from vbrk.
    endform.
    *&      Form  BUILD_XLS_DATA_TABLE
          Build data table for .xls document
    FORM build_xls_data_table.
      CONSTANTS: con_cret TYPE x VALUE '0D',  "OK for non Unicode
                 con_tab TYPE x VALUE '09'.   "OK for non Unicode
    *If you have Unicode check active in program attributes thnen you will
    *need to declare constants as follows
    *class cl_abap_char_utilities definition load.
    *constants:
       con_tab  type c value cl_abap_char_utilities=>HORIZONTAL_TAB,
       con_cret type c value cl_abap_char_utilities=>CR_LF.
    <b>
      CONCATENATE 'DEBNR' 'NAAM' 'BESTELNR'
                  'ARTNR' 'OMSCHRIJVING' 'TYPE'
                 'FABRIKAAT' 'FAKTUURDATUM' 'FAKSRT'
                  'FAKTUURNR' 'FAK.POS.' 'FAK.AANTAL'
                  'FAK.EENH' 'FAKTUUR WAARDE' 'ORDER DATUM'
                  'ORDSRT' 'VERKOPER' 'ORDERNR.' 'ORDER.POS.'
                  'ARTNR KLANT' 'ORDER AANTAL'
                  INTO it_attach SEPARATED BY con_tab.
    CONCATENATE con_cret it_attach INTO it_attach.
       APPEND  it_attach.
    CONCATENATE   con_tab 'ORDER EENH' 'ORDERWAARDE'
                  'POS.TYPE' 'GEVRAAGDE LEVDAT'
                  'WERKELIJKE LEVDAT' 'LEVERINGSNR' 'LEV.POS'
                  'LEV.AANTAL' 'LEV.EENH' 'BESTELPUNT'
                  'MAX VRD' 'BASISEENH' 'ABC' 'ARTSRT.'
                  'VK.STATUS' 'IK.STATUS' 'MIN.LEVEENH.'
                  'AFDRONDINGSWAARDE' 'VPRS' 'PER'
             INTO it_attach SEPARATED BY con_tab.
      APPEND  it_attach.
      LOOP AT ITAB.
        CONCATENATE itab-deb itab-debnaam itab-bestnr itab-artnr
                    itab-oms itab-type itab-fab itab-faktuurdat
                    itab-faksrt itab-faktuur itab-fakpos
                    itab-fakaantal itab-fakeenh itab-fakwaarde
                    itab-orddat itab-ordsrt itab-verkoper itab-ordnr
                    itab-ordnrpos itab-artklant itab-ordaant
                    INTO it_attach SEPARATED BY con_tab.
                    CONCATENATE Con_cret it_attach  INTO it_attach.
                    APPEND  it_attach.
    CONCATENATE     con_tab itab-ordeenh itab-ordwaarde itab-postype
                    itab-gevlevdat itab-levdat itab-levnr itab-levpos
                    itab-levaant itab-leveenh itab-min itab-max
                    itab-basiseenh itab-abc itab-artsoort itab-vkstatus
                    itab-ikstatus itab-minlev itab-afrd itab-vprs
                    itab-vprseenh
                    INTO it_attach SEPARATED BY con_tab.
        APPEND  it_attach.
      ENDLOOP.</b>
    ENDFORM.                    " BUILD_XLS_DATA_TABLE
    *&      Form  SEND_FILE_AS_EMAIL_ATTACHMENT
          Send email
    FORM send_file_as_email_attachment tables pit_message
                                              pit_attach
                                        using p_email
                                              p_mtitle
                                              p_format
                                              p_filename
                                              p_attdescription
                                              p_sender_address
                                              p_sender_addres_type
                                     changing p_error
                                              p_reciever.
      DATA: ld_error    TYPE sy-subrc,
            ld_reciever TYPE sy-subrc,
            ld_mtitle LIKE sodocchgi1-obj_descr,
            ld_email LIKE  somlreci1-receiver,
            ld_format TYPE  so_obj_tp ,
            ld_attdescription TYPE  so_obj_nam ,
            ld_attfilename TYPE  so_obj_des ,
            ld_sender_address LIKE  soextreci1-receiver,
            ld_sender_address_type LIKE  soextreci1-adr_typ,
            ld_receiver LIKE  sy-subrc.
      ld_email   = p_email.
      ld_mtitle = p_mtitle.
      ld_format              = p_format.
      ld_attdescription      = p_attdescription.
      ld_attfilename         = p_filename.
      ld_sender_address      = p_sender_address.
      ld_sender_address_type = p_sender_addres_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[] = pit_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 it_message 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.
      MOVE: SY-UNAME TO t_RECEIVERs-RECEIVER,
            'X'      TO t_RECEIVERs-EXPRESS,
            'B'      TO t_RECEIVERs-REC_TYPE.
      APPEND t_RECEIVERs.
      CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_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               = it_message
                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.
    Populate zerror return code
      ld_error = sy-subrc.
    Populate zreceiver return code
      LOOP AT t_receivers.
        ld_receiver = t_receivers-retrn_code.
      ENDLOOP.
    ENDFORM.
    *&      Form  INITIATE_MAIL_EXECUTE_PROGRAM
          Instructs mail send program for SAPCONNECT to send email.
    FORM initiate_mail_execute_program.
      WAIT UP TO 2 SECONDS.
      SUBMIT rsconn01 WITH mode = 'INT'
                    WITH output = 'X'
                    AND RETURN.
    ENDFORM.                    " INITIATE_MAIL_EXECUTE_PROGRAM
    *&      Form  POPULATE_EMAIL_MESSAGE_BODY
           Populate message body text
    form populate_email_message_body.
      REFRESH it_message.
      it_message = 'Deze mail is automatisch gemaakt door transactie ZAKA'.
      APPEND it_message.
    endform.                    " POPULATE_EMAIL_MESSAGE_BODY

  • FM SO_NEW_DOCUMENT_ATT_SEND_API1

    Hi All
    I am using the FM SO_NEW_DOCUMENT_ATT_SEND_API1 in the BAdI ECM_UPDATE (Method CHANGE_BEFORE_UPDATE )
    commit work inside the FM SO_NEW_DOCUMENT_ATT_SEND_API1 is causing the dump
    I am getting the followin dump
    Short text
        Invalid COMMIT WORK in a COMMIT WORK or ROLLBACK WORK.
    What happened?
        Error in the ABAP Application Program
        The current ABAP program "SAPLSOI1" had to be terminated because it has
        come across a statement that unfortunately cannot be executed.
    What can you do?
        Note down which actions and inputs caused the error.
        To process the problem further, contact you SAP system
        administrator.
        Using Transaction ST22 for ABAP Dump Analysis, you can look
        at and manage termination messages, and you can also
        keep them for a long time.
    Error analysis
        The call of a COMMIT WORK in a FORM, that will not be executed until
        the commit or rollback point of the caller using the variant
        PERFORM ... ON COMMIT or PERFORM ... ON ROLLBACK is not permitted.
    Does any have idea about this.
    Thanks
    Bhasker

    Looks like there is a commit work being issued even before the transaction is completed, that is why the dump.
    Try to call the function in a UPDATE TASK Mode.
    If that doesn't work, you will have to find a different BADI for your purpose.
    Regards,
    Ravi

  • Problem about mail attachment

    Hi all:
        I use FM 'SO_NEW_DOCUMENT_ATT_SEND_API1' to create a html attachment,it contains some Chinese words.
        The issue is after I export the attachment from Business Workplace ,I found the Chinese words is disordered. I mean the exported file do not contain any Chinese words.
        Is there anybody can help me to sole the problem?
        Regards

    Thanks for your reply,I think I don't explain it clearlly.
    In SAP GUI,the attachment shows the Chinese word correctlly,but in PC-UI ,it has the problem.
    I suppose the problem is about the codepage,but I've no idea how to solve it.

  • SO_NEW_DOCUMENT_ATT_SEND_API1 Mail body

    Dear all,
    I have read all the posts about sending mails, i need a help on this.
    SO_NEW_DOCUMENT_ATT_SEND_API1' this is the FM iam using to send mails and it is working fine, but the Mail body is not in proper format.
    eg if im having 4 records
    1 BP NOT CREATED
    2 ADDRESS NOT FOUND
    3 BP DOESNOT EXIST
    4 BP CREATED SUCCESSFULLY
    The mai body displays results like
    BP NOT CREATED
    ADDRESS NOT FOUND  BP DOESNOT EXIST BP CREATED SUCCESSFULLY
    but i want it one by one.
    For this Im passing the below parameters
    *-- Populate packing list for body text
          CLEAR ls_packing-transf_bin.
          ls_packing-transf_bin = 'X'.
          ls_packing-head_start =  1.
          ls_packing-head_num =    0.
          ls_packing-body_start =  1.
          ls_packing-body_num =    lv_tab_lines.              " no.of records in our case 4
          ls_packing-doc_type = 'RAW'.
          ls_packing-doc_size = lv_tab_lines * 255.
          APPEND ls_packing TO lt_packing.
    plz let me know where im going wrong..
    Regards,
    Pawan

    Thanks Clemens Solved by using,
    newline TYPE c VALUE cl_abap_char_utilities=>newline.
    Regards,
    Pawan

  • SO_NEW_DOCUMENT_ATT_SEND_API1 multiple receivers

    I have searched the forum and found several examples and threads about function module SO_NEW_DOCUMENT_ATT_SEND_API1.
    I have used it before but am now having a specific problem and cannot find a solution.
    The RECEIVERS table is being populated with multiple addresses. The intent is to send one single email to all the recipients listed. Instead, the email is being sent once per recipient.
    The code below shows two addresses. It should send one email with a TO: and CC: address. Instead it sends it twice (with TO: and CC: populated in each email). "test1" and "test2" are incomplete email addresses for this example.
    I assumed it was a simple coding error on my part. Anyone see it? This is on an ECC 6.0 system.
      CLEAR it_mailtxt-line.
      it_mailtxt-line = 'testing email with multiple recipients.'.
      APPEND it_mailtxt.
      DESCRIBE TABLE it_mailtxt LINES mailtxt_size.
      it_doc_att-obj_descr =  'Test email'.
      it_doc_att-sensitivty = 'F'.
      it_doc_att-doc_size = mailtxt_size * 255.
      CLEAR it_mailpack-transf_bin.
      it_mailpack-head_start = 1.
      it_mailpack-head_num = 0.
      it_mailpack-body_start = 1.
      it_mailpack-body_num = mailtxt_size.
      it_mailpack-doc_type = 'RAW'.
      APPEND it_mailpack.
      REFRESH it_reclist.
      CLEAR it_reclist.
      it_reclist-receiver = 'test1'.
      it_reclist-express = 'X'.
      it_reclist-rec_type = 'U'.
      it_reclist-com_type   = 'INT'.
      APPEND it_reclist.
      CLEAR it_reclist.
      it_reclist-copy   = 'X'.
      it_reclist-receiver = 'test2'.
      it_reclist-express = 'X'.
      it_reclist-rec_type = 'U'.
      it_reclist-com_type   = 'INT'.
      APPEND it_reclist.
      CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
        EXPORTING
          document_data                      = it_doc_att
          COMMIT_WORK                        = 'X'
        TABLES
          packing_list                       = it_mailpack
          object_header                   = it_mailhead
          contents_txt                      = it_mailtxt
          receivers                          = it_reclist
        EXCEPTIONS
          too_many_receivers                 = 1
          document_not_sent                  = 2
          document_type_not_exist            = 3
          operation_no_authorizationfiltered = 4
          parameter_error                    = 5
          x_error                            = 6
          enqueue_error                      = 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.

    Hi,
    you should create a distribution list via SBWP > Distribution List.
    Then check the function module documentation in order to find how to fill the RECEIVERS[ ] table parameter with the created distribution list.
    Regards,
    Andrea

  • Attachment issue with mail    SO_NEW_DOCUMENT_ATT_SEND_API1

    Hi Guys,
    I used the Standard function 'SO_NEW_DOCUMENT_ATT_SEND_API1 for sending the mail to lotus notes server.but it is delivering the mail as an inline attachment instead of notepad attachment .pl guide me how to get the proper output .
    My code is
    CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
        EXPORTING
          document_data              = ls_docdata
          put_in_outbox              = c_value_x                                                      " X
          commit_work                = c_value_x                                                     " X
        TABLES
          packing_list               = lt_objpack
          contents_txt               = lt_objtxt
          receivers                  = lt_rec_list
        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.
    Regards,
    Raja

    <a href="http://sapfans.com/forums/viewtopic.php?t=182990&highlight=mailtifpdf">In this thread of SAPFans,</a> you will find a sample code. It uses an older version of the FM, because I had to change the sender, but you will find there the commented call to the FM you want to use.
    I wish it will be helpful,
    Vic
    Edition: please, don't bump the linked, although you can find it useful (or not).
    I will not provide further help about it, because it's an old piece of crap code I've never touched from those days, and I'm not more involved in mail sending.
    Thanks in advance,
    Vic

  • Could you pls give the details about the Unicode conversion during Upgrade

    Hi,
    Can anyone give details about the Unicode conversion during SAP Upgradation fro 4.6C to ECC6.
    Waiting for quick response
    Best Regards,
    Padhy

    Hi,
    These are the few points i gathered during my upgradation project.
    Before starting any upgradation project, it is necessary to take up the back-up of the existing systems. As we are going to upgrade the entire system, we will be changing so many things and if something happens, without back-up, we will be in a trouble.
    So it is advised to keep a back-up of the existing system.
    Say for example we have the existing system E4B which is of Version 4.6C. Now we want to upgrade it to Version 4.7. Let us see how we can do it.
    Version upgrades not only means that we need to run the new Version CD over the existing Version System but only involves some other thing.
    Version Upgrade involves the following Steps.
    Say we want to upgrade for Version 4.7 from Version 4.6, which is in the System E4B. Now we created one more system called as E1B in which the upgradation for Version 4.7 can be done.
    • First copy the entire E4B system into the E1B System which is created for Version 4.7.
    • Apply the Version 4.7 CD provided by SAP over the E1B System.
    • Now check whether all the functionalities that was in E4B system works fine with E1B system also.
    Thus the Version Upgrade involves two steps.
    1. SAP Upgradation with the help of the CD
    2. Manual Upgradation.
    1. SAP Upgradation with the help of the CD
    This is nothing but after taking the copy of the existing system into a new system, the upgradation CD from SAP is applied over the new system.
    2. Manual Upgradation.
    This Manual Upgradation involves
    2.1 Upgradation of Standard Objects
    2.1.1 SPAU Objects
    2.1.2 SPDD Objects
    2.2 Upgradation of Custom Objects.
    Upgradation of Custom Objects can be placed under the following three categories.
    Unicode Compliance
    Retrofit
    Upgrade
    Please Find below some of the common Unicode Errors and their solutions
    1. Error:
    In case of Translate Error; ‘Dangerous use of Translate in Multilingual system.’
    Correction:
    To correct the Error occurring on TRANSLATE statement – use this additional statement before the Translate statement.
    SET LOCALE LANGUAGE sy-langu.
    This statement defines the Text Environment of all the programs & internal sessions in the language specified in the LANGUAGE KEY, which in this case is “sy-langu”, i.e. the log on language of the user.
    2. Error:
    In case of Open Dataset Error; ‘Encoding Addition must be included.’
    Correction:
    This Error occurs only when the MODE is TEXT.
    To correct the Error occurring on OPEN DATASET statement – use this statement instead.
    OPEN DATASET dataset_name FOR access IN TEXT MODE ENCODING DEFAULT.
    Where: dataset_name – NAME OF THE DATASET.
    Access – INPUT or OUTPUT or APPENDING or UPDATE.
    DEFAULT - Corresponds to UTF-8 in UNICODE systems &
    NON_UNICODE in NON-UNICODE systems.
    3. Error:
    In case of the usage of the Obsolete FM UPLOAD/DOWNLOAD or WS_UPLOAD/DOWNLOAD; ‘Function module UPLOAD is flagged as obsolete.’
    Correction:
    The FM GUI_DOWNLOAD/UPLOAD is used.
    The variations to be made in the parameters of the FM:
    1. Filename – It must be of STRING type.
    2. Filetype – “DAT” is not used any longer, instead “ASC” is used.
    3. Field Separator – The default value “SPACE” is used, incase for a TAB separated file “X” can be used.
    4. Error:
    In case of CURRENCY/UNIT Addition Error; ‘Use addition CURRENCY/UNIT when outputting.’
    Correction:
    The CURRENCY addition specifies the currency-dependant decimal places for the output of the data objects of type i or p. To obtain the currency-key, the field CURRKEY of the table TCURX is used. The system determines the number of the decimal places from the field CURRDEC of the selected CURRKEY.
    To correct this error follow the following method:
    WRITE: /3 'TOTAL',' ', TOTAL.
    WRITE: /3 ‘TOTAL’,’ ‘, TOTAL CURRENCY ‘2’. --- Where ‘2’is the Currency Key for Getting 2 decimal places.
    5. Error:
    In case of TYPE X Error; ‘Variable must be of C, N, D, T or STRING type.’
    Correction:
    We need to change all the Type X (Hexadecimal) variables to Type C with their values unchanged.
    So the method to be followed is:-
    1. Load the definition of the class CL_ABAP_CONV_IN_CE or CL_ABAP_CHAR_UTILITIES.
    2. Declare the variable as Type C, and use the method UCCP(‘XXXX’) of the class CL_ABAP_CONV_IN_CE where XXXX represents the 8-bit Hexadecimal value and incase the variable holds a Hex value for a Horizontal Tab , then the Attribute “HORIZONTAL_TAB” of the class CL_ABAP_CHAR_UTILITIES can be used directly instead of using the method UCCP.
    E.g.:
    i) *DATA: TAB TYPE X VALUE 09, “Tab character
    CLASS: CL_ABAP_CHAR_UTILITIES DEFINITION LOAD.
    DATA TAB TYPE C VALUE CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB.
    ii) * DATA: CHAR TYPE X VALUE 160.
    CLASS: CL_ABAP_CONV_IN_CE DEFINITION LOAD.
    DATA CHAR TYPE C.
    CHAR = CL_ABAP_CONV_IN_CE=>UCCP(‘00AO’).
    (Here ‘00A0’ is the Hexadecimal equivalent of the decimal 160).
    3. Incase the TYPE X Variable has a length more than 1, then an internal table must be created for the variable.
    E.g.:
    CLASS: CL_ABAP_CONV_IN_CE DEFINITION LOAD.
    DATA : LF(2) TYPE X VALUE 'F5CD'.
    DATA : BEGIN OF LF,
    A1 TYPE C,
    A2 TYPE C,
    END OF LF.
    LF-A1 = CL_ABAP_CONV_IN_CE=>UCCP('00F5').
    LF-A2 = CL_ABAP_CONV_IN_CE=>UCCP('00CD').
    6. Error:
    In case of the Character “-“Error; ‘The Character “-“can’t appear in names in Unicode Programs.’
    Correction:
    The Character “-“(Hyphen) appearing in Variable names is replaced by the character “_” (Under Score) for Unicode/Upgrade Compliance.
    E.g.:
    *wk-belnr LIKE bkpf-belnr,
    *wk-xblnr LIKE bkpf-xblnr,
    *wk-date LIKE sy-datum,
    *wk-wrbtr LIKE bseg-wrbtr,
    *wk-name1 LIKE lfa1-name1,
    *wk-voucher(8) TYPE c.
    wk_belnr LIKE bkpf-belnr,
    wk_xblnr LIKE bkpf-xblnr,
    wk_date LIKE sy-datum,
    wk_wrbtr LIKE bseg-wrbtr,
    wk_name1 LIKE lfa1-name1,
    wk_voucher(8) TYPE c.
    7. Error:
    In case of The SUBMIT-TO-SAP-SPOOL Error; ‘you should not use the statement SUBMIT-TO-SAP-SPOOL without the WITHOUT SPOOL DYNPRO addition. ‘
    Correction:
    1. Declare variables of type PRI_PARAMS, ARC_PARAMS, and a variable of TYPE C which would be used as a VALID FLAG.
    2. Call the FM GET_PRINT_PARAMETERS:
    CALL FUNCTION 'GET_PRINT_PARAMETERS'
    EXPORTING
    ARCHIVE_MODE = '3'
    DESTINATION = P_DEST
    IMMEDIATELY = 'X'
    IMPORTING
    OUT_ARCHIVE_PARAMETERS = archive_parameters
    OUT_PARAMETERS = print_parameters
    VALID = valid_flag
    EXCEPTIONS
    INVALID_PRINT_PARAMS = 2
    OTHERS = 4
    3. Use the SUBMIT-TO-SAP-SPOOL statement.
    E.g.:
    •     submit zrppt500
    •     using selection-set 'AUTO3'
    •     with res_no eq lo_rsnum
    •     with sreserv in preserv
    •     to sap-spool destination p_dest
    •     immediately 'X'. "print immediate
    DATA: print_parameters type pri_params,
    archive_parameters type arc_params,
    valid_flag(1) type c.
    CALL FUNCTION 'GET_PRINT_PARAMETERS'
    EXPORTING
    ARCHIVE_MODE = '3'
    DESTINATION = P_DEST
    IMMEDIATELY = 'X'
    IMPORTING
    OUT_ARCHIVE_PARAMETERS = archive_parameters
    OUT_PARAMETERS = print_parameters
    VALID = valid_flag
    EXCEPTIONS
    INVALID_PRINT_PARAMS = 2
    OTHERS = 4
    Submit zrppt500
    Using selection-set 'AUTO3'
    With res_no eq lo_rsnum
    with sreserv in preserv
    to sap-spool
    SPOOL PARAMETERS PRINT_PARAMETERS
    ARCHIVE PARAMETERS ARCHIVE_PARAMETERS
    WITHOUT SPOOL DYNPRO.
    8. Error:
    In case of Message Error; ‘Number of WITH fields and number of Place Holders are not same ‘.
    Correction:
    Split the statement after WITH into the same number as the place holder for that Message ID.
    E.g.:
    1. * MESSAGE E045.
    MESSAGE E045 WITH '' ''.
    2. in program ZIPI0801
    •     Start of change for ECC6
    •     message e398(00) with 'Could not find access sequence'
    •     'for condition type:'
    •     p_ptype.
    message e398(00) with 'Could not find '
    'access sequence'
    'for condition type:'
    p_ptype.
    •     End of change made for ECC6
    9. Error:
    In case of Move between 2 different Structures; ‘The structures are not mutually convertible in a Unicode program.’
    Correction:
    Make both the Data Types compatible and then assign the contents.
    E.g.:
    The statement –“move retainage_text to temp_text.” Gives an error, where RETAINAGE_TEXT is an internal table and TEMP_TEXT is a string of length 200.
    A Feasible solution for this is to specify from which position to which position of the string, the fields of RETAINAGE_TEXT should be assigned.
    TEMP_TEXT+0(1) = RETAINAGE_TEXT-DQ1.
    TEMP_TEXT+1(1) = RETAINAGE_TEXT-HEX.
    TEMP_TEXT+2(20) = RETAINAGE_TEXT-FILLER1.
    TEMP_TEXT+22(15) = RETAINAGE_TEXT-AMT_DUE.
    TEMP_TEXT+37(8) = RETAINAGE_TEXT-TEXT.
    TEMP_TEXT+45(10) = RETAINAGE_TEXT-DUE_DATE.
    TEMP_TEXT+55(1) = RETAINAGE_TEXT-DQ2.
    10. Error:
    In case of ‘no description found’; ‘add a GUI title’.
    Correction:
    In this type of error gui title is generally missing so add a GUI title to the module pool.
    11. Error:
    In case of ‘writing internal or transparent table’
    Correction:
    Write individual fields.
    E.g.:
    WRITE: / EXT. --> EXT should be a character type field
    WRITE: / EXT-ZZSTATE, EXT-LINE_NO, EXT-LINE_TXT, EXT-AMT, EXT-ZZSKUQTY.
    12. Error:
    In case of ‘combination reference table/field S541-UMMENGE does not exist’
    Correction:
    Was due to error in reference table S541. TABLE S541 has errors
    1)”Foreign key S541- ZZMARKET (ZZMARKET AND KATR2 point to different domains)”
    2)”Foreign key S541-ZZACQUIGRP (ZZACQUIGRP AND KATR8 point to different domains)”
    Changed the domain of ZZMARKET (from ZMKCODE to ATTR2)
    And that of ZMKCODE (from ZACCODE to ATTR8)
    13. Error:
    In case of ‘KEY does not exist’
    Correction:
    The reference table for field KBETR was KNOV earlier changed it to RV61A as KNOV was in turn referring to RV61A.
    14. Error:
    Incase of ‘WRITE’ statement, ‘Literals that take more than one line is not permitted in Unicode systems.’
    Correction: To correct this error, we need to align the spaces accordingly so that the statement doesn’t go beyond the line.
    15. Error:
    Incase of Data statement, ‘The data type ZWFHTML can be enhanced in any way. After a structure enhancement, this assignment or parameter might be syntactically incorrect………..’
    Correction: To correct this error, instead of “like” in the Data statement, use “type”.
    16. Error:
    Incase of DESCRIBE statement, ‘DESCRIBE can be used only with IN BYTE... Or IN CHARACTER mode in Unicode systems.’
    Correction: To correct this error, use additional text, IN BYTE MODE / IN CHARACTER MODE along with this statement.
    CHARACTER MODE is added when the data object is of flat/ character type.
    BYTE MODE is added when the data object is a deep structure.
    Syntax: DESCRIBE FIELD data_obj : LENGTH blen IN BYTE MODE,
    LENGTH clen IN CHARACTER MODE.
    Where blen and clen must be of type I.
    17. Error:
    Incase of DO-LOOP Error,’ In Do loop range addition needed‘
    Correction:
    An internal tables is declared and the two fields (VARYING field and NEXT field) were
    Included inside the internal table
    E.g.: In program SAPMZP02
    DO 11 TIMES
    •     VARYING STATION_STATE FROM STATION1 NEXT STATION2. “ECC6
    CASE SYST-INDEX.
    WHEN ‘1’
    STATION_STATE = STATION1.
    WHEN ‘2’
    STATION_STATE = STATION2.
    WHEN ‘3’
    STATION_STATE = STATION3.
    WHEN ‘4’
    STATION_STATE = STATION4.
    WHEN ‘5’
    STATION_STATE = STATION5.
    WHEN ‘6’
    STATION_STATE = STATION6.
    WHEN ‘7’
    STATION_STATE = STATION7.
    WHEN ‘8’
    STATION_STATE = STATION8.
    WHEN ‘9’
    STATION_STATE = STATION9.
    WHEN ‘10’
    STATION_STATE = STATION10.
    WHEN ‘11’
    STATION_STATE = STATION11.
    18. Error:
    Incase of the parameter QUEUE-ID Error,’ QUEUE-ID’ is neither a parameter nor a select option in program rsbdcbtc.’
    Correction:
    The parameter in program rsbdcbtc is QUEUE_ID and so is changed in this program
    E.g.: In program Z_CARRIER_EDI_INTERFACE
    •     submit rsbdcbtc with queue-id = apqi-qid and return. "ECC6
    •     The parameter name changed by replacing '-' with '_' as in program rsbdcbtc "ECC6
    Submit rsbdcbtc with queue_id = apqi-qid and return. "ECC6
    19. Error:
    Incase of EPC Error,’ Field symbol <TOT_FLD> is not assigned to a field ‘.
    Correction:
    This error couldn't be rectified as the error occurs in a Standard SAP include- LSVIMF29.
    The OS Note - 1036943 needs to be applied.
    Error:
    OPEN DATASET P_FILE FOR OUTPUT IN TEXT MODE.
    Correct:
    OPEN DATASET P_FILE FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
    Error:
    Constants : c_tab type x value '09' .
    Correct:
    Constants : c_tab type abap_char1 value cl_abap_char_utilities=>horizontal_tab .
    Error:
    Data : begin of output_options occurs 0 . Include structure ssfcompop.
    Data : end of output_options .
    Correct:
    Data : output_options type standard table of ssfcompop with header line .
    Error:
    PARAMETERS : NAST TYPE NAST .
    Correct:
    PARAMETERS : NAST TYPE NAST NO-DISPLAY .
    Replace WS_DOWNLOAD and WS_UPLOAD by
    GUI_UPLOAD and GUI_DOWNLOAD and check the import and export parameter types , do the changes accordingly. Because FILENAME paramater type is different because of this it will give dump.
    For issue during Issue using SO_NEW_DOCUMENT_ATT_SEND_API1 Function module, the solution is After this FM we should put COMMIT WORK.
    Issue:
    Moving data from one structure to another structure if those two structures are not compatible
    Solution:
    we should use move-corresponding or field by filed we need to move it.
    If database structures are different in 4.6c and ECC6.0,
    Then we should go with append structure concept.
    While testing the report if it gives dump at Select query level or any database or view level,then just goto that table or view and goto the data base utility(se14) adjust the database. But make sure that selected radio button in se14 transaction should be activate and adjust database
    Also Check this link.
    http://help.sap.com/saphelp_nw04/helpdata/en/62/3f2cadb35311d5993800508b6b8b11/frameset.htm
    Reward points if helpful.
    Regards,
    Ramya

  • About Alert

    Hi All
    I have done JDBC to Proxy scenario i.e. Oracle to BI
    I am picking up a data from Oracle and sending to BI tables.
    The thing is when i execute the scenario i can see a success message in XI Moni, means the data got picked up from oracle. Now i can also see a Success message into BI side in Moni to confirm the data is successfully posted into BI tables.
    Now, if i dont want to see in BI Moni about the success then what other options are available by which i can confirm myself that the data is successfully posted into BI tables.
    Thanks
    Dheeraj Kumar

    HI Aamir,
    I am also facing the same problem.
    I used a function module in proxy( BI ) to update data into BI tables.
    I want to give a success mail.
    For this I used 'SO_NEW_DOCUMENT_ATT_SEND_API1' function module.
    But when I am sending data from oracle , this function module is not triggering.
    But when I am directly test this function module in BI( In the Proxy ), then it triggers and mail is gone.
    Kindly help me.
    Regards,
    Narendra

  • About PDF file

    Dear All,
                 IN HR I am able to get the payslip into PDF file, I am able to create PDF file but Unable to know where it is stored , it is displaying the messgae that PDF of 4320 bytes are created. in 4.7 version.
                Now my concern is how to find that PDF file and how to send it as mail
    if SO_NEW_DOCUMENT_ATT_SEND_ALI1 fM is to be used for mailing then can anyone please explain me about the parameters to be passed.
    Thanks in Advance,
    Regards,
    Satya.

    Thanks for your Swift Response ...
    C I am pasting the other kind of code which I have developed
    But it is saying File cannot be sent.
    Mr.Sreenivas thank you very much for the code you have given but the thing is I need to work on Payslip which is not Smartform.
    So I request you to please let me know where to specify PDF and mail details.
    I am pasting that code please check it.
    REPORT  ZHR_PAYSLIP_PDF                         .
    TABLES: PERNR,
            PCL1,
            PCL2,
            PA0105.
    INFOTYPES : 0105.
    *INTERNATIONAL INCLUDE
    INCLUDE RPC2CD09.  "Cluster CD data definition
    INCLUDE RPC2CA00.  "Cluster CA Data-Definition
    INCLUDE RPPPXD00.  "Data Definition buffer PCL1/PCL2 Buffer
    INCLUDE RPPPXD10.  "Common part buffer PCL1/PCL2
    INCLUDE RPPPXM00.  "Buffer Handling routine
    *COUNTRY SPECIFIC INCLUDE
    INCLUDE PC2RXIN0.  "Cluster IN data definition
    INCLUDE RPC2RX09.
    *INCLUDE RPC2R1X9.
    DATA:   SEQNR LIKE PC261-SEQNR,
            it_rgdir  LIKE pc261 OCCURS 0 WITH HEADER LINE,
            PAYSLIP LIKE BAPI7004_PAYSLIP OCCURS 0 WITH HEADER
                                         LINE,
            RETURN LIKE  BAPIRETURN1.
    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    like somlreci1  occurs  1 with header line,
           listobject like abaplist   occurs  1 with header line,
           tab_lines  type i,
           doc_size   type i,
           att_type   like SOODK-OBJTP.
    START-OF-SELECTION .
    GET PERNR.
        PERFORM GET_IT0105_DATA.
        PERFORM GET_PAYROLL_DATA.
        PERFORM PAYSLIP_DATA.
    form GET_PAYROLL_DATA .
       CALL FUNCTION 'CU_READ_RGDIR'
        EXPORTING
          persnr          = pernr-pernr
        TABLES
          in_rgdir        = it_rgdir
        EXCEPTIONS
          no_record_found = 1
          OTHERS          = 2.
       IF sy-subrc = 0 .
        SORT IT_RGDIR BY SEQNR.
        LOOP AT it_rgdir WHERE fpbeg BETWEEN pnpbegda AND pnpendda .
          IF ( it_rgdir-fpper = it_rgdir-inper
              AND    IT_RGDIR-SRTZA = 'A' ).
                SEQNR = IT_RGDIR-SEQNR.
          ENDIF .                        " end of Strza
       ENDLOOP.
      ENDIF.
    endform.     
    form PAYSLIP_DATA .
    DATA:
        FUNAME      TYPE SYREPID,
        LINES       TYPE I,
        P_FORM      LIKE PC408 OCCURS 0 WITH HEADER LINE,
        P_INFO      LIKE PC407.
    DATA : PACKING_LIST LIKE  SOPCKLSTI1.
    init
      CLEAR:   P_FORM, P_INFO, PAYSLIP, FUNAME.
      REFRESH: P_FORM, PAYSLIP.
    determine name of function module
    depending on CE or non CE
      CALL FUNCTION 'HRO1_GET_FUNAME'
        EXPORTING
          pernr           = PERNR-PERNR
       IMPORTING
         FUNAME           = funame.
    get raw version of payslip
      CALL FUNCTION funame
           EXPORTING
                EMPLOYEE_NUMBER = PERNR-PERNR
                SEQUENCE_NUMBER = SEQNR
                PAYSLIP_VARIANT = 'AMP3'
           IMPORTING
                P_INFO          = P_INFO
                RETURN          = RETURN
           TABLES
                P_FORM          = P_FORM.
    any errors occured
      CHECK RETURN IS INITIAL.
      DESCRIBE TABLE P_FORM LINES LINES.
      IF LINES LE 0.
       PERFORM FILL_RETURN USING 'I' '3G' 824 RETURN.
       ERROR MESSAGE.
        EXIT.
      ENDIF.
      CALL FUNCTION 'CONVERT_PAYSLIP_TO_SAPSCRIPT'
           EXPORTING
                P_INFO     = p_info
           TABLES
                payslip    = payslip
                p_form     = p_form
           EXCEPTIONS
                EMPTY_FORM = 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.
    Way for Mailing ***************************
         OBJPACK-HEAD_START = 1.
         OBJBIN = '  |  '. APPEND OBJBIN.
         OBJPACK-HEAD_START = 1.
    submit SHOWCOLO exporting list to memory and return.
    CALL FUNCTION 'LIST_FROM_MEMORY'
          TABLES
            listobject       = listobject
          EXCEPTIONS
            OTHERS           = 1
        IF sy-subrc <> 0.
          message ID '61' TYPE 'E' NUMBER '731'
          with 'LIST_FROM_MEMORY'.
        ENDIF.
        PACKING_LIST = OBJPACK.
        docdata-obj_name  = 'TEST_ALI'.
        docdata-obj_descr = 'Test including ALI/HTML Attachment'.
    CALL FUNCTION 'TABLE_COMPRESS'
        IMPORTING
         COMPRESSED_SIZE       =
          TABLES
             IN                    = listobject
             OUT                   = objbin
          EXCEPTIONS
             OTHERS                = 1
        if sy-subrc <> 0.
          message ID '61' TYPE 'E' NUMBER '731'
          with 'TABLE_COMPRESS'.
        endif.
      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   = 'OTF'.
        append objpack.
        att_type = 'OTF'.
    describe table objbin lines tab_lines.
    read     table objbin index tab_lines.
    objpack-doc_size = ( tab_lines - 1 ) * 255 + strlen( objbin ).
        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   = 'ATTACHMENT'.
        objpack-obj_descr  = 'Attached Document'.
        append objpack.
    reclist-receiver = '[email protected]'.
    reclist-rec_type = 'U'.
    reclist-com_type = 'INT'.
    append reclist.
        CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
        EXPORTING
          document_data                     = docdata
          PUT_IN_OUTBOX                     = 'X'
      IMPORTING
        SENT_TO_ALL                        =
        NEW_OBJECT_ID                     =
        tables
          packing_list                      = objpack
          OBJECT_HEADER                     = objhead
          CONTENTS_BIN                      = objbin
          CONTENTS_TXT                      = objtxt
          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.
    I am getting the message that mail cannot be sent don't know why???
    Regards,
    Satya.

  • Reg: SO_NEW_DOCUMENT_ATT_SEND_API1

    Hi Friends,
       I am trying to send a mail from an executable program to an internet email id. I am using the function module SO_NEW_DOCUMENT_ATT_SEND_API1. The function doesnt raise any exception. The sent_to_all flag is set after execution. But the mail is not being sent. What could be wrong? If i use sapuser and rectype as 'B' the mail is delivered to the SAP Inbox. rectype 'U' is not working.
    If it is a config issue in SCOT how to find the issue and how to solve it?
    Thanks in advance
    Nathan.

    Hi
    I think it is due to the problem of RFC connectivity. Ask your basis person for proper connectivity
    These are the FM for sending external email :-
    SO_DOCUMENT_SEND_API1 
    SAPoffice: Send new document with attachments via RFC 
    SO_NEW_DOCUMENT_ATT_SEND_API1
    (In 4.6C only, You can go to SE37 and click the documentation on how to use it. A sample program is provided there.)
    SAPoffice: Send new document with attachments via RFC 
    Note : If you are using FM SO_NEW_DOCUMENT_ATT_SEND_API1 then Export Parameter DOCUMENT_DATA-OBJ_DESCR contains the Subject. 
    SO_NEW_DOCUMENT_SEND_API1 
    SAPoffice: Send new document 
    <b><u>Check this link it will solve ur issue</u></b>http://help.sap.com/saphelp_nw2004s/helpdata/en/55/a8b538891b11d2a25a00a0c943858e/content.htm
    <b><u>Check this sample coding</u></b>
    *& Report  ZMATURITYREPORT                                             *
    *&   Title - Maturity   report                                         *
    *&           ABAP/4 Consultant                                         *
    *& Name- Pavan Praveen Valluri Created on 26/07/2007                   *
    *& FI Consultant- Amit Mistry                                          *
    *& Module - FI                                                         *
    REPORT  ZMATURITYREPORT.
    tables: bseg.
    * SELECTION SCREEN---------------------------------------------------  *
    parameters: p_email type somlreci1-receiver default
    '@outlook.com'.
    * Data: p_email(25) type c value '[email protected]'.
    * END OF SELECTION SCREEN -------------------------------------------  *
    *----------DATA DECLARATION--------------------------------------------*
    data: it_message type standard table of solisti1 initial size 0
    with header line.
    data: it_message1 type standard table of solisti1 initial size 0
    with header line.
    data: it_message2(10) type N.
    data: it_message3 type standard table of solisti1 initial size 0
    with header line.
    data: it_message4 type standard table of solisti1 initial size 0
    with header line.
    data: it_attach type standard table of solisti1 initial size 0
    with header line.
    data: text(150).
    data: t_packing_list like sopcklsti1 occurs 0 with header line,
          t_contents like solisti1 occurs 0 with header line,
          t_receivers like somlreci1 occurs 0 with header line,
          t_attachment like solisti1 occurs 0 with header line,
          t_object_header like solisti1 occurs 0 with header line,
          w_cnt type i,
          w_sent_all(1) type c,
          w_doc_data like sodocchgi1,
          gd_error type sy-subrc,
          gd_reciever type sy-subrc.
    start-of-selection.
    data: lv_date type sy-datum.
    data: lv_date1 type sy-datum.
    data: lv_formatdate(10) type c.
    data: lv_formatdate1(10) type c.
    data: var1(4) type c,
    var2(2) type c,
    var3(2) type c.
    data: begin of int_bseg occurs 0,
        BELNR LIKE BSEG-BELNR,
        ZUONR LIKE BSEG-ZUONR,
        GJAHR LIKE BSEG-GJAHR,
        DMBTR LIKE BSEG-DMBTR,
        HKONT LIKE BSEG-HKONT,
    end of int_bseg.
    data: begin of int_SKAT occurs 0,
        TXT50 LIKE SKAT-TXT50,
        SAKNR LIKE SKAT-SAKNR,
        KTOPL LIKE SKAT-KTOPL,
    end of int_SKAT.
    data: begin of int_bkpf occurs 0,
          BELNR LIKE BKPF-BELNR,
          BUKRS LIKE BKPF-BUKRS,
          GJAHR LIKE BKPF-GJAHR,
          BUDAT  LIKE BKPF-BUDAT,
    end of int_BKPF.
    data: 2days_out type sy-datum.
    2days_out = sy-datum + 2.
    data: var4(4) type c,
    var5(2) type c,
    var6(2) type c.
    *-------- END OF DATA DECLARATION--------------------------------------*
    *--- CONCATENATING AND ARRANGING DATE ---------------------------------*
    lv_date = 2days_out.
    var1 = lv_date+(4).
    var2 = lv_date+4(2).
    var3 = lv_date+6(2).
    concatenate var3 var2 var1 into lv_formatdate separated by '.'.
    *--- END OF CONCATENATING AND ARRANGING DATE  -------------------------*
    *-------------------------SELECTION FOR BSEG---------------------------*
    select zuonr belnr bukrs GJAHR DMBTR HKONT from bseg into
    corresponding fields of  table int_bseg
    where bukrs = 'company code' and
          ZUONR = lv_formatdate.
    *--------------END OF SSELECTION FOR BSEG---------------------------   *
    *-------------------------SELECTION FOR BKPF---------------------------*
    select  BUDAT BUKRS BELNR GJAHR  from BKPF into
    corresponding fields of table int_BKPF
    where bukrs = 'company code'.
    append int_BKPF.
    *------------------END OF SELECTION FOR BKPF---------------------------*
    *-------------------------SELECTION FOR SKAT---------------------------*
    select SAKNR TXT50 from SKAT into
    corresponding fields of  table int_SKAT
    where KTOPL = 'company code'.
    *and      SAKNR = INT_BSEG-HKONT.
    APPEND INT_SKAT.
    *--------------END OF SSELECTION FOR SKAT---------------------------   *
    *-----------------POPULATING EMAIL SUBJECT ----------------------------*
    perform populate_email_message_body.
      perform send_file_as_email_attachment
      tables it_message
      it_attach
      using p_email
      'Maturity after 2 days'
      'XLS'
      'filename'
      changing gd_error
      gd_reciever.
    * Instructs mail send program for SAPCONNECT to send email(rsconn01)
      perform initiate_mail_execute_program.
    *endif.
    end-of-selection.
    *------------END OF POPULATING EMAIL SUBJECT --------------------------*
    *& Form SEND_FILE_AS_EMAIL_ATTACHMENT
    * Send email
    form send_file_as_email_attachment tables pit_message
    pit_attach
    using p_email
    p_mtitle
    p_format
    p_filename
    p_attdescription
    p_sender_address
    p_sender_addres_type
    changing p_error
    p_reciever.
      data: ld_error type sy-subrc,
      ld_reciever type sy-subrc,
      ld_mtitle like sodocchgi1-obj_descr,
      ld_email like somlreci1-receiver,
      ld_format type so_obj_tp ,
      ld_attdescription type so_obj_nam ,
      ld_attfilename type so_obj_des ,
      ld_sender_address like soextreci1-receiver,
      ld_sender_address_type like soextreci1-adr_typ,
      ld_receiver like sy-subrc.
      ld_email = p_email.
      ld_mtitle = p_mtitle.
      ld_format = p_format.
      ld_attdescription = p_attdescription.
      ld_attfilename = p_filename.
      ld_sender_address = p_sender_address.
      ld_sender_address_type = p_sender_addres_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[] = pit_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 it_message lines t_packing_list-body_num.
      t_packing_list-doc_type = 'RAW'.
      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
          object_header              = t_object_header
          packing_list               = t_packing_list
          contents_bin               = t_attachment
          contents_txt               = it_message
          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.
    * Populate zerror return code
      ld_error = sy-subrc.
    * Populate zreceiver return code
      loop at t_receivers.
        ld_receiver = t_receivers-retrn_code.
      endloop.
    endform.                    "send_file_as_email_attachment
    *& Form INITIATE_MAIL_EXECUTE_PROGRAM
    * Instructs mail send program for SAPCONNECT to send email.
    form initiate_mail_execute_program.
      wait up to 2 seconds.
      if gd_error eq 0.
        submit rsconn01 with mode = 'INT'
                      with output = 'X'
                      and return.
      endif.
    endform.                    " INITIATE_MAIL_EXECUTE_PROGRAM
    *& Form POPULATE_EMAIL_MESSAGE_BODY
    * Populate message body text
    form populate_email_message_body.
      refresh it_message.
      refresh it_message1.
      refresh it_message3.
       refresh it_message4.
    *--------------- LOOP FOR BSEG -----------------------------------------
      loop at int_BSEG.
    read table int_bKPF WITH KEY BELNR = INT_BSEG-BELNR
            GJAHR = INT_BSEG-GJAHR.
    read table int_SKAT WITH KEY SAKNR = INT_BSEG-HKONT.
    *---CHANGING DATE FORMAT FOR BKPF---------------------------------------
    lv_date1 = int_bkpf-budat.
      var4 = lv_date1+(4).
      var5 = lv_date1+4(2).
      var6 = lv_date1+6(2).
    concatenate var6 var5 var4 into lv_formatdate1 separated by '.'.
    *---END OF CHANGING DATE FORMAT FOR BKPF-------------------------
    it_message =  int_bseg-belnr.
    it_message1 =  lv_formatdate1.
    it_message2 = int_bseg-dmbtr.
    it_message3 = int_bseg-hkont.
    IT_MESSAGE4 = INT_SKAT-TXT50.
    SHIFT IT_MESSAGE2 LEFT DELETING LEADING '0'.
    *-------------POPULATING EMAIL BODY WITH DATA -------------------------
    concatenate 'Maturity After 2Days' 'for'  'G/L account-' it_message3
    '--' IT_MESSAGE4  ',' 'Amount-' it_message2
        into it_message separated by space.
    append it_message.
    append it_message1.
    append it_message3.
      clear it_message.
      clear it_message1.
      clear it_message2.
      clear it_message3.
    endloop.
    *------------END OF LOOP FOR BSEG --------------------------------------
    endform. " POPULATE_EMAIL_MESSAGE_BODY
    Check this link for other details about sending mail
    http://help.sap.com/saphelp_nw04/helpdata/en/38/71f865c2c9a94ab1dce95792187c16/content.htm
    http://help.sap.com/saphelp_sm32/helpdata/en/49/fa6b41419f031de10000000a155106/content.htm
    Reward all helpfull answers
    REgards
    Pavan

  • Adobe Bridge in Photoshop - How to install Bridge and camera raw? And what is it all about?

    Hi everyone! I am actually in love with this adobe photoshop. I used PSCS2 before, but later on upgraded to CS4. But I feel tired in upgrading to CS5.
    One time, I found a tutorial in youtube about camera raw, and would really want to use it. But I was wondering how to install the camera raw. I believe camera raw is a plugin? so I downloaded the plugin here, installed it in my PS. I downloaded a file Camera Raw.8bi and paste it on my C drive - C:\Program Files\Adobe\Photoshop CS4\Plug-ins\File Formats.
    I now am very confused, how will I open it? I do not have adobe bridge!  After I installed the camera raw, I opened my PS. I clicked the file>then browse in bridge. I had an error, it's "error 2 photoshop11 undefined". Which is what I thought, I might have done something wrong with installing it.
    My question is, do you still need adobe bridge installed in order to use camera raw?
    If yes, how does it work? How am I suppose to open camera raw?
    If no, how am I going to open camera raw without bridge?
    And also, where will I download adobe bridge? I cannot find one here for CS4, only adobe bridge for CS5. I am wondering, is it okay to install adobe bridge CS5 and use it with my PS CS4?
    I badly need help!

    WebDAV (Web-based Distributed Authoring and Versioning) is a set of extensions to HTTP/1.1.
    The main difference from FTP as far as I can see is that it allows you to edit documents on a remote web server.
    WebDAV was used by the Apple server - MobileMe but is not generally supported by hosting services.
    Using WebDAV you can mount a directory locally. This was how iDisk worked on your Mac and you could drag files onto it to upload them to the remote directory.
    With WebDAV, a number of users can share a directory which is why its used in local networks but presents security problems when using a remote server.
    If you are into file sharing rather than publishing, Dropbox or its new rival SugarSync are more appropriate.

  • A few days ago i bought the macbook pro in a Providence. In late Summer i will come back to my Country - Ukraine. I would like to know about a tax for my laptop. Can i return tax? Through the TAX FREE or return in airport? What should i do?

    A few days ago i bought the macbook pro in a Providence. In late Summer i will come back to my Country - Ukraine. I would like to know about a tax for my
    laptop. Can i return tax? Through the TAX FREE or return in airport? What should i do?

    You need to talk with the tax authorities in the countries to which you traveled and that of your home country. We are all end-users liek you and not Apple agents.

  • I am trying to use itunes, it will not open at all, have uninstalled and downloaded new software and 64bit for windows. i have an old ipod nano from about 5 years ago. anything i can do, even to view my purchases and watch/listen to music etc?

    ok i have a advent roma laptop with window 7. my itunes used to work fine, completely. every time i plugged in my ipod it was ok. recently my ipod was not working so i never bothered with itunes, however i have movies/tv prog that i purchased and would like to view them. i have an ipod nano from about 5 years ago, the problem with thet is, it switches on, but the circular control panel does nothing, all you can do is lock and unlock it - nothing else.
    i tried to download new version of itunes, then uninstalled my origonal version, incase it was corrupted etc, i then again tried to down load new version and also version that is windows 64bit. still when i select the downlaod to open as son as it is finnished nothing happens. and now my desktop shortcut has dissapeared. before when it was there, id double click it, nothing, right click to open it, nothing.
    im not the best technically minded but i just dont see what im doing wrong here, please help

    Perhaps it would be helpful for you to view the page source code of this page
    http://www.alanwork.com/
    As you can see, the submenu code links are immediately below the top level code, and are
    wrapped in their own  <UL> </UL> tag pairs.
    Hope that helps

Maybe you are looking for

  • A CRY OF Help..To All Java Programmer

    Iam desperate please help....I Have to finish this code until tommorrow...i have done some and its running but it doesnt show the right computation... Prob: Mail order house sells 5 different product..prod1-$2.98, prod2-$4.50, prod3- $9.98, prod4- $4

  • How can you upgrade appserver that is used by Java AVK for Enterprise

    Here is a question that I some times get from users: Question: I wanted to check what was involved in replacing the Appserver that is bundled with AVK1.4.1? I looked at the contents of the AVK bundle and noticed that it has an appserver directory. So

  • How to pass the User Group for a SQ00 Transaction iView

    Hello, To start off, I am relatively new to SAP technology in general.  I may be missing something obvious. I am trying to create an SAP Transaction iView in our EP Portal that will call the SQ00 transaction (start query) and run a particular query a

  • Sales order going to dump when we enter product in the transcation

    Hello Gurus, I am facing a problem in the sales order, when i enter a product in the transcation(TA) it going to dump........It is showing the message like this........., What happened?......     Error in the ABAP Application Program     The current

  • Application Server 8 won't start on Solaris 10

    I used the JES installer installed the application server ... no errors but when I try to start the app server I get this # ./asadmin start-domain domain1 Starting Domain domain1, please wait. Log redirected to /var/opt/SUNWappserver/domains/domain1/