cancel
Showing results for 
Search instead for 
Did you mean: 

F.27(Statement should be emailed if customer master contains email address)

Former Member
0 Kudos

Hi All,

I am working for the tcode f.27. A standard form F140_ACC_STAT_01 is assigned to tcode. Here my requirement is i need to do some changes in the form and output should be in pdf format and statement should be emailed if customer master contains email address.

Can any body please help me how to send the email if the customer master contains email address.

Please reply.

Thanks,

Nagendra

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi Nagendra

change the customer email address on home and bussiness email field first and then make following changes to function module 'Z_CORR_PROCESS_00002310' or whatever name you  have got , this is working for us, let me know if y ou have any problem, You might have to tweak a code a bit , here we are decide whether to send customer statements to two email or not based on customer group selection

data: w_output_type(10)"Output type
   data: w_kunnr like i_kna1-kunnr.
   data: w_ktokd like i_kna1-ktokd.
   data: l_addressdtls type zaddressdtls.
   data: l_atype(1)" Address type
DATA: w_mailtxt TYPE finaa-namep VALUE 'ZCITY_STATEMENT_MAIL_BODY'.

*
* Variables are imported - set in ZFKORD10_STUD
*
* Import variable w_output_type from memory
*
   clear: w_output_type.

   IMPORT w_output_type FROM MEMORY ID 'ZOUTPUT_TYPE'.
*
   move 'B' to  l_atype.      "Business e-mail
*
   if w_output_type = 'EMAIL'. "Email option chosen
     c_finaa-nacha = 'I'.
     c_finaa-tdfaxuser = sy-uname.
      c_finaa-namep = w_mailtxt.
*
* Get the Relevant e-mail address
*
     move I_KNA1-KUNNR to w_kunnr.
     clear: l_addressdtls, c_finaa-intad.
     call function 'Z_GET_CUSTOMER_ADDRESS'
          EXPORTING
               kunnr                   = w_kunnr
               atype                   = l_atype  "B Business H Home
          IMPORTING
               addressdtls             = l_addressdtls
          EXCEPTIONS
               invalid_customer_number = 1
               no_customer_partner     = 2
               invalid_address_type    = 3
               others                  = 4.
     if sy-subrc eq 0.
       if l_atype = 'H'"Home e-mail address
         c_finaa-namep = w_mailtxt.
         c_finaa-intad = l_addressdtls-home_email.
       else.
         c_finaa-namep = w_mailtxt.
         c_finaa-intad = l_addressdtls-business_email.
       endif.
     endif.

     concatenate i_kna1-kunnr
                 'Account statement from City University'
                  into c_itcpo-tdtitle separated by space.

     c_itcpo-tdfaxuser = sy-uname.

     if ( c_finaa-intad is initial            " No email address
          and c_itcpo-tdpreview is initial ). " and not print preview

       c_finaa-nacha = '1'.        "Print output type
       c_itcpo-tdgetotf = 'X'.     "Do not print
       c_itcpo-tdpreview = space"No print preview
       c_itcpo-tdnoprev = 'X'.     "No print preview

     endif.

   endif.


if w_ktokd = 'stud'.


    move 'H' to  l_atype.      "Business e-mail

   if w_output_type = 'EMAIL'. "Email option chosen
     c_finaa-nacha = 'I'.
     c_finaa-tdfaxuser = sy-uname.
     c_finaa-namep = w_mailtxt.

  "Get the Relevant e-mail address

     move I_KNA1-KUNNR to w_kunnr.
     clear: l_addressdtls, c_finaa-intad.
     call function 'Z_GET_CUSTOMER_ADDRESS'
          EXPORTING
               kunnr                   = w_kunnr
               atype                   = l_atype  "B Business H Home
          IMPORTING
               addressdtls             = l_addressdtls
          EXCEPTIONS
               invalid_customer_number = 1
               no_customer_partner     = 2
               invalid_address_type    = 3
               others                  = 4.
     if sy-subrc eq 0.
       if l_atype = 'H'"Home e-mail address

         c_finaa-namep = w_mailtxt.
         c_finaa-intad = l_addressdtls-home_email.
       else.
         c_finaa-namep = w_mailtxt.
         c_finaa-intad = l_addressdtls-business_email.
       endif.
     endif.

     concatenate i_kna1-kunnr
                 'Account statement from City University'
                  into c_itcpo-tdtitle separated by space.

     c_itcpo-tdfaxuser = sy-uname.

     if ( c_finaa-intad is initial            " No email address
          and c_itcpo-tdpreview is initial ). " and not print preview

       c_finaa-nacha = '1'.        "Print output type
       c_itcpo-tdgetotf = 'X'.     "Do not print
       c_itcpo-tdpreview = space"No print preview
       c_itcpo-tdnoprev = 'X'.     "No print preview

     endif.
endif.
endif.

Former Member
0 Kudos

Hi,

Does anybody know how to attach documents(PDF, excel, .TXT ....) which are attached in FI documents using 'Services for Object' button, along with the Periodic Account statement PDF.

FYI I am able to setup the BTE 2310 and its working fine to send the Statement as an attachment.

Thanks for any help,

Regards,

Seema

former_member181995
Active Contributor
0 Kudos

I hammered my head for a week unfortunately ended up with no solution, however you can achieve this by small changes in RFKORI90 but I would suggest you to just copy this program into Z one and Assign this program into FBZP.

Take your choice how you would like to go?

Cheers

Former Member
0 Kudos

Hi Amit/divya,

Thanks for your inputs.

My issue is solved. i used the FM SO_document_send_api1 for mailing.

Thanks,

Nagendra

Former Member
0 Kudos

Wouldn't you require a SAP Access key to make modifications in the standard form - F140_ACC_STAT_01 ?

Here is a [Link|http://wiki.sdn.sap.com/wiki/display/Snippets/EmailfromSAP] you can refer to for sending the statement through email.