<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Function Module not working as required in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-not-working-as-required/m-p/2190588#M466985</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Gabriel,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Am trying to do this as well...Also trying to run the fm as a background task.. hoping either should work..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;Preethi&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 30 Apr 2007 14:43:01 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-04-30T14:43:01Z</dc:date>
    <item>
      <title>Function Module not working as required</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-not-working-as-required/m-p/2190582#M466979</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am currently using a function module HR_FBN_GENERATE_SEND_EMAIL which sends mail to external sources from a standard SAP screen.&lt;/P&gt;&lt;P&gt;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).&lt;/P&gt;&lt;P&gt;Could anyone throw some light on a solution to this issue.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;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?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Will def shell out loads of points to solutions that help...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;Preethi...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Apr 2007 14:26:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-not-working-as-required/m-p/2190582#M466979</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-04-30T14:26:19Z</dc:date>
    </item>
    <item>
      <title>Re: Function Module not working as required</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-not-working-as-required/m-p/2190583#M466980</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;u can alternatively use &amp;lt;b&amp;gt;SO_DOCUMENT_SEND_API1&amp;lt;/b&amp;gt; functon module to send out the mails.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Apr 2007 14:28:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-not-working-as-required/m-p/2190583#M466980</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-04-30T14:28:47Z</dc:date>
    </item>
    <item>
      <title>Re: Function Module not working as required</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-not-working-as-required/m-p/2190584#M466981</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Preethi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Did you try to put that code on a FM separatetly? I mean, make the standard FM inside a Z FM and call the function from your PAI code, may work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To send the mails on specified date, try to use the Z FM with a job. Create a zprogram that calls the ZFM, then create the job!!!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;Dont forget to reward&lt;/P&gt;&lt;P&gt;Gabriel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Apr 2007 14:31:15 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-not-working-as-required/m-p/2190584#M466981</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-04-30T14:31:15Z</dc:date>
    </item>
    <item>
      <title>Re: Function Module not working as required</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-not-working-as-required/m-p/2190585#M466982</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI,&lt;/P&gt;&lt;P&gt;Here is the code to send the mail from ABAP&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;*&amp;amp;---------------------------------------------------------------------*
*&amp;amp; Report  ZSENDEMAIL                                                  *
*&amp;amp;                                                                     *
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp; Example of sending external email via SAPCONNECT                    *
*&amp;amp;                                                                     *
*&amp;amp;---------------------------------------------------------------------*
REPORT  zsendemail                    .

PARAMETERS: psubject(40) type c default  'Hello',
            p_email(40)   type c default 'test@sapdev.co.uk' .

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.


*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  POPULATE_MESSAGE_TABLE
*&amp;amp;---------------------------------------------------------------------*
*       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


*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  SEND_EMAIL_MESSAGE
*&amp;amp;---------------------------------------------------------------------*
*       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


*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  INITIATE_MAIL_EXECUTE_PROGRAM
*&amp;amp;---------------------------------------------------------------------*
*       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&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you look at the function module, you will get the field to pass the date also&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt; Sudheer&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Apr 2007 14:31:33 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-not-working-as-required/m-p/2190585#M466982</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-04-30T14:31:33Z</dc:date>
    </item>
    <item>
      <title>Re: Function Module not working as required</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-not-working-as-required/m-p/2190586#M466983</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&amp;gt;&amp;gt;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).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;this might be due to a conflict in the COMMIT WORK between the PAI &amp;amp; function call.. you can make the function call as a BACKGROUND TASK in your PAI to separate the two workporcesses..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;~Suresh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Apr 2007 14:31:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-not-working-as-required/m-p/2190586#M466983</guid>
      <dc:creator>suresh_datti</dc:creator>
      <dc:date>2007-04-30T14:31:44Z</dc:date>
    </item>
    <item>
      <title>Re: Function Module not working as required</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-not-working-as-required/m-p/2190587#M466984</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Suresh,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How do I go about achieving this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regds&lt;/P&gt;&lt;P&gt;Preethi&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Apr 2007 14:42:00 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-not-working-as-required/m-p/2190587#M466984</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-04-30T14:42:00Z</dc:date>
    </item>
    <item>
      <title>Re: Function Module not working as required</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-not-working-as-required/m-p/2190588#M466985</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Gabriel,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Am trying to do this as well...Also trying to run the fm as a background task.. hoping either should work..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;Preethi&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Apr 2007 14:43:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-not-working-as-required/m-p/2190588#M466985</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-04-30T14:43:01Z</dc:date>
    </item>
    <item>
      <title>Re: Function Module not working as required</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-not-working-as-required/m-p/2190589#M466986</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;in your PAI replace the function call as&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CALL FUNCTION HR_FBN_GENERATE_SEND_EMAIL  IN BACKGROUND TASK.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;you can leave the rest of the imp/exp tables parameters as is..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;~Suresh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Apr 2007 14:46:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-not-working-as-required/m-p/2190589#M466986</guid>
      <dc:creator>suresh_datti</dc:creator>
      <dc:date>2007-04-30T14:46:30Z</dc:date>
    </item>
    <item>
      <title>Re: Function Module not working as required</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-not-working-as-required/m-p/2190590#M466987</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Still not working :(. Anything other suggested approaches? This is bizzare..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;P&gt;Preethi&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Apr 2007 14:52:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-not-working-as-required/m-p/2190590#M466987</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-04-30T14:52:45Z</dc:date>
    </item>
    <item>
      <title>Re: Function Module not working as required</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-not-working-as-required/m-p/2190591#M466988</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;may not be the best approach.. since you mentioned, the function call worked fine in a report.. try if you can use SUBMIT &amp;lt;report&amp;gt; and RETURN in your PAI.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;~Suresh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Apr 2007 15:04:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-not-working-as-required/m-p/2190591#M466988</guid>
      <dc:creator>suresh_datti</dc:creator>
      <dc:date>2007-04-30T15:04:25Z</dc:date>
    </item>
    <item>
      <title>Re: Function Module not working as required</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-not-working-as-required/m-p/2190592#M466989</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi there, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It has been touched on before but have you tried using a differenet function module like 'SO_NEW_DOCUMENT_ATT_SEND_API1' to send data within the email body and 'SO_DOCUMENT_SEND_API1' to send data as an attachment. Examples of which can be found on &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.sapdevelopment.co.uk/reporting/email/emailhome.htm" target="test_blank"&gt;http://www.sapdevelopment.co.uk/reporting/email/emailhome.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps &lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Mart&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Apr 2007 15:31:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-not-working-as-required/m-p/2190592#M466989</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-04-30T15:31:56Z</dc:date>
    </item>
    <item>
      <title>Re: Function Module not working as required</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-not-working-as-required/m-p/2190593#M466990</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The module works perfectly when called from a preport prog but doesnt execute in the PAI ??!! &lt;/P&gt;&lt;P&gt;Am still working on it...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Apr 2007 16:11:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-not-working-as-required/m-p/2190593#M466990</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-04-30T16:11:48Z</dc:date>
    </item>
    <item>
      <title>Re: Function Module not working as required</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-not-working-as-required/m-p/2190594#M466991</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I've adopted an approach wherein i call the func mod in a report. But i'm still confused about how and why a function module that doesnt work in the PAI works perfectly in a report prog. Is there a background issue?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is theoretical i guess...so any help will def be rewarded for sure&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Apr 2007 16:52:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-not-working-as-required/m-p/2190594#M466991</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-04-30T16:52:56Z</dc:date>
    </item>
    <item>
      <title>Re: Function Module not working as required</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-not-working-as-required/m-p/2190595#M466992</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try this.  It will work in PAI.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  CALL FUNCTION 'SO_DOCUMENT_SEND_API1'&lt;/P&gt;&lt;P&gt;       &amp;lt;b&amp;gt;STARTING NEW TASK 'task'&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;       EXPORTING&lt;/P&gt;&lt;P&gt;       -&lt;/P&gt;&lt;HR originaltext="-----" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Keshav&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Aug 2007 00:23:14 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-not-working-as-required/m-p/2190595#M466992</guid>
      <dc:creator>former_member410382</dc:creator>
      <dc:date>2007-08-23T00:23:14Z</dc:date>
    </item>
  </channel>
</rss>

