HR_FBN_GENERATE_SEND_EMAIL

hi,
I am working on scripts to send mail with PDF as an attachment,
while surfing the net I found the FM HR_FBN_GENERATE_SEND_EMAIL to send the mail.
if any one know whether I can use this FM
could you help how to pass data to the FM.
CALL FUNCTION 'HR_FBN_GENERATE_SEND_EMAIL'
    EXPORTING
      subject                     = 'MAIL'
      sender                      = 'PRASANTH.K'
      recipient                   = w_email
     FLAG_COMMIT                 = 'X'
     FLAG_SEND_IMMEDIATELY       = 'X'
    tables
      email_text                  = it_tline
*   EXCEPTIONS
*     FAILED                      = 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.
Am i populating in the right way
the structure of it_tline is TLINE
regards

Structure of  email_text is "  DATA  l_tab_soli       TYPE soli_tab."
FYI
Re: Sender's mail id in FM  "SO_NEW_DOCUMENT_SEND_API1" ..
^Saquib

Similar Messages

  • Function Module not working as required

    Hi,
    I am currently using a function module HR_FBN_GENERATE_SEND_EMAIL which sends mail to external sources from a standard SAP screen.
    The fm seems to be working fine if its run from within a report program, but isnt executing when is run from within a PAI module.(code same in both).
    Could anyone throw some light on a solution to this issue.
    Also,this module doesnt seem to allow sending of mails on a specified date. How can i incorporate that or alternatively is there an existing fn module which will send mails out on a specified date with specified content?
    Will def shell out loads of points to solutions that help...
    Cheers,
    Preethi...

    HI,
    Here is the code to send the mail from ABAP
    *& Report  ZSENDEMAIL                                                  *
    *& Example of sending external email via SAPCONNECT                    *
    REPORT  zsendemail                    .
    PARAMETERS: psubject(40) type c default  'Hello',
                p_email(40)   type c default '[email protected]' .
    data:   it_packing_list like sopcklsti1 occurs 0 with header line,
            it_contents like solisti1 occurs 0 with header line,
            it_receivers like somlreci1 occurs 0 with header line,
            it_attachment like solisti1 occurs 0 with header line,
            gd_cnt type i,
            gd_sent_all(1) type c,
            gd_doc_data like sodocchgi1,
            gd_error type sy-subrc.
    data:   it_message type standard table of SOLISTI1 initial size 0
                    with header line.
    *START-OF-SELECTION.
    START-OF-SELECTION.
    Perform populate_message_table.
    *Send email message, although is not sent from SAP until mail send
    *program has been executed(rsconn01)
    PERFORM send_email_message.
    *Instructs mail send program for SAPCONNECT to send email(rsconn01)
    perform initiate_mail_execute_program.
    *&      Form  POPULATE_MESSAGE_TABLE
    *       Adds text to email text table
    form populate_message_table.
      Append 'Email line 1' to it_message.
      Append 'Email line 2' to it_message.
      Append 'Email line 3' to it_message.
      Append 'Email line 4' to it_message.
    endform.                    " POPULATE_MESSAGE_TABLE
    *&      Form  SEND_EMAIL_MESSAGE
    *       Send email message
    form send_email_message.
    * Fill the document data.
      gd_doc_data-doc_size = 1.
    * Populate the subject/generic message attributes
      gd_doc_data-obj_langu = sy-langu.
      gd_doc_data-obj_name  = 'SAPRPT'.
      gd_doc_data-obj_descr = psubject.
      gd_doc_data-sensitivty = 'F'.
    * Describe the body of the message
      clear it_packing_list.
      refresh it_packing_list.
      it_packing_list-transf_bin = space.
      it_packing_list-head_start = 1.
      it_packing_list-head_num = 0.
      it_packing_list-body_start = 1.
      describe table it_message lines it_packing_list-body_num.
      it_packing_list-doc_type = 'RAW'.
      append it_packing_list.
    * Add the recipients email address
      clear it_receivers.
      refresh it_receivers.
      it_receivers-receiver = p_email.
      it_receivers-rec_type = 'U'.
      it_receivers-com_type = 'INT'.
      it_receivers-notif_del = 'X'.
      it_receivers-notif_ndel = 'X'.
      append it_receivers.
    * Call the FM to post the message to SAPMAIL
      call function 'SO_NEW_DOCUMENT_ATT_SEND_API1'
           exporting
                document_data              = gd_doc_data
                put_in_outbox              = 'X'
           importing
                sent_to_all                = gd_sent_all
           tables
                packing_list               = it_packing_list
                contents_txt               = it_message
                receivers                  = it_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.
    * Store function module return code
      gd_error = sy-subrc.
    * Get it_receivers return code
      loop at it_receivers.
      endloop.
    endform.                    " SEND_EMAIL_MESSAGE
    *&      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
    If you look at the function module, you will get the field to pass the date also
    Regards
    Sudheer

  • Send an e-mail to Outlook when a PO is released

    Hello colleagues,
    We need to send an e-mail to some responsible outlook address when a PO is full released, just for information. We don´t want to use workflow for approval. Please, could you tell me how can i customize it?
    thank you in advance.
    Best regards,
    JR.

    This is not possible with standard configuration. You have to create Z report with help of abaper which will trigger mail to the responsible peoples.
    Logic would be
    1.Create Z table which will stores Plant and responsible user name and thier e-mail id
    2.Create Z-program which will take input as creation date and PO number also Plant and others as per your requirement
    3.Goto table CDHDR and input is doc oobject - EINKBELEG ,T-code : ME29N and ME28 ,Date : today date
       get the document number,object value and pass CDPOS table get all the values and store it in internal tabel. Loop internal table if the FNAME = FRGKE and VALUE_NEW = R then get the OBJECTID which is nothing but PO number . Passing this no in EKPO table get the plant no . For this plant whatever e-mail ids are there ,send mail saying that these Po are released .
    To send e-mail you have to use standard function module ISA_AUC_EMAIL_NOTIFY or HR_FBN_GENERATE_SEND_EMAIL or check with abaper

  • WDA to send a Mail

    Hi Gurus!
    I have created a WDA which sends a Mail.
    I have created a Text Edit UI element (to retrieve the body of the mail) and context element type string bound to it.
    This text will be retrieved on the variable read from the context element type string.
    I send the mail with the FM 'HR_FBN_GENERATE_SEND_EMAIL'.
    My problem is after split the variable on a internal table, the entries of the table have length of 255 char, and the lines splitted of the text has more length, then this lines are cut.
    This is my code:
      data i_text type table of string.
      data lo_el_context type ref to if_wd_context_element.
      data ls_context type wd_this->element_context.
      data lv_text_mail like ls_context-text_mail.
      data lv_asunto_mail like ls_context-asunto_mail.
    get element via lead selection
      lo_el_context = wd_context->get_element(  ).
    get single attribute
      lo_el_context->get_attribute(
        exporting
          name =  `ASUNTO_MAIL`
        importing
          value = lv_asunto_mail ).
    get single attribute
      lo_el_context->get_attribute(
        exporting
          name =  `TEXT_MAIL`
        importing
          value = lv_text_mail ).
    split lv_text_mail at cl_abap_char_utilities=>newline into table i_text.
    call function 'HR_FBN_GENERATE_SEND_EMAIL'
      exporting
        subject                     = lv_asunto_mail
        sender                      = '[email protected]'
        recipient                   = '[email protected]'
      tables
        email_text                  = i_text
    Somebody knows how I can solve this problem, please?
    Thakns and regards,
    Manuel Míguez.

    FAQ, please search before posting, also refrain from assigning a priority higher than normal.
    Thread locked.
    Thomas

  • SD billling document email id change

    Dear frnds,
    I have a requirement to change the email id in XD02. The partner functions in the sales area data has the reqd. partner functions. But pls let me know how do i change the email id here. If i click the partner function row the system asks for the creation of a new customer.
    Points assure to all replies..
    Madan.

    hi,
    instead of that functional module , you can use the following functional module and can change the senders address..
    But before using this,you have to convert the senders address into UPPER CASE ,then only this works
          CALL FUNCTION 'HR_FBN_GENERATE_SEND_EMAIL'
            EXPORTING
              subject                     = p_subject
              sender                      = p_sender
              recipient                   =  p_recipient
                 FLAG_COMMIT                 = 'X'
                 FLAG_SEND_IMMEDIATELY       = 'X'
            TABLES
              email_text                  = p_t_mailtxt[]
           EXCEPTIONS
             failed                      = 1
             OTHERS                      = 2
    Hope this is useful.
    Thanks
    Santosh.

  • WD abap Error - Two internal tables are neither compatible nor convertible

    Hi,
    I am trying to use a standard Function Module - HR_FBN_GENERATE_SEND_EMAIL in a Webdynpro ABAP Application to send email to a standard mailbox. I am getting this error. Did anyone come across this error?
    The following error text was processed in the development system: Two internal tables are neither compatible nor convertible.
    The error occurred on the application server Development and in the work process 2.
    The termination type was: RABAX_STATE
    The ABAP call stack was:
    Function: HR_FBN_GENERATE_SEND_EMAIL of program SAPLHRFBN00GENERAL
    Method: EXECUTE_HR_FBN_GENERATE_SEND_E of program /1BCWDY/42NDMCF1FS45LZXWDXDY==CP
    Method: IF_COMPONENTCONTROLLER~EXECUTE_HR_FBN_GENERATE_SEND_E of program /1BCWDY/42NDMCF1FS45LZXWDXDY==CP
    Method: ONACTIONLOADEMAILFORM of program /1BCWDY/42NDMCF1FS45LZXWDXDY==CP
    Method: IF_WDR_VIEW~WD_INVOKE_EVENT_HANDLER of program /1BCWDY/42NDMCF1FS45LZXWDXDY==CP
    Method: INVOKE_EVENTHANDLER of program CL_WDR_VIEW========CP
    Method: IF_WDR_ACTION~FIRE of program CL_WDR_ACTION=================CP
    Method: DO_HANDLE_ACTION_EVENT of program CL_WDR_WINDOW_PHASE_MODEL=====CP
    Method: PROCESS_REQUEST of program CL_WDR_WINDOW_PHASE_MODEL=====CP
    Method: PROCESS_REQUEST of program CL_WDR_WINDOW=================CP
    Any help will be appreciated.
    Thanks
    RM
    Edited by: R M on Sep 14, 2008 2:54 PM

    Open an OSS ticket, this is probably a programming error which requires a note to fix it.
    CHeers,
    RIch Heilman

  • Automatic sap mail to mrp controller

    Hai friends
    After MRP run automaticaly mail trigger to mrp controller .
    For this requirement ,what are the settings needed ?

    Hy,
    For trigering automatic SAP mail to MRP controller you have to go with User Exit,
    User Exit for MRP is
    User Exit is  M61X0001
    Function Module EXIT_SAPLM61C_001 and
    Include ZXM61U02
    In above Include you have to apply funbction module which triggers the automatic mail
    Some of the Function module relevent to sending mail are,
    /SPE/TPOP_SMTP_SETTINGS_READ
    BAPI_BUPA_SEARCH
    BAPI_BUPA_SEARCH_2
    BKK_ACCNT_STAT_GET_EMAIL
    BUPA_PARTNER_CONTACT_SEARCH
    CRM_IC_EMAIL_LINK
    EXIT_SAPLBPFC_001
    EXIT_SAPLEL35_003
    EXIT_SAPLFCIM_280
    EXIT_SAPLJGWWW_004
    EXIT_SAPLMLSX_010
    EXIT_SAPLMLSX_011
    EXIT_SAPLVED4_004
    EXIT_SAPMJGWWWIU1_016
    EXIT_SAPMJGWWWIU1_017
    FTR_MIR_EXECUTE_MESSAGEMAIL
    HR_EFI_BC_POLL_MAILBOX
    HR_EFI_XI_POLL_MAILBOX
    HR_FBN_GENERATE_SEND_EMAIL
    HRIQ_STUDENT_EMAIL_GET
    HRWPC_RQ_MAIL_TO_MANAGER
    QFOA_MAIL_REJECTED_RESULTS
    QFOA_MAIL_SENDING
    QFOA_UD_LONGTEXT_SENDING
    WFDBP_GET_GROUPWARE_EMAIL
    WFDS_GET_GROUPWARE_EMAIL
    I don't know the total function but I am trying my best and share the knowledge upto my best level.
    For completing the total function you have to take help of both Abaper and basis person.
    We have also set automatic mail function not for MRP but for DMS.
    Regards,
    Dhaval
    Edited by: Dhaval on Jun 24, 2008 11:19 AM

Maybe you are looking for