Skip to Content
Author's profile photo Former Member

VF01 invoice to mail to multiple recipients

These are the requirements that I was given:

  • You may not use distribution lists, neither internal nor external.  This requirement extends from not wanting common users to have access to these functions.  How ever the user defines the multiple email addresses, then must be able to do so without significantly extending their roles.  A Z table and interface screens are acceptable but not preferred.  We would prefer to take advantage of the existing Vender Master address functionality.
  • If the email addresses are in SAP already (Vendor addresses already allow multiple email addresses to be entered, however only one can be printed in standard functionality), why do we have to have new configuration to have access to them?
  • Emails must be monitored through through standard SAP functionality, such as SOST or similar functions and therefore must be issued through SCOT configuration.
  • Less is more.  The less effort this takes, the better.

Knowns about our system (the preconditions for certainty that the described process will work):

  • SAP Version – ECC6 Support Stack 22
  • Also still working after Loading EHP6 on top of ECC6
  • IBM i-series DB2 Database
  • Invoices are created through a SmartForm
  • We have used note 718017 to get the invoice number into the Subject line of our invoice

Observations:

  • In the customer master, multiple emails addresses may be recorded for a single customer.
    • Only one can be the default address.  This one is the only address that un-augmented SAP allows the invoice to be sent to.
    • As addresses are no longer needed, they can be marked for deletion.  All others are available for use but not currently used.
    • These characteristics are easily found in table ADR6.
  • In debugging, we see that the following portion of the call stack is accessed:
    • SAPLSBCOMSUT    FUNCTION    SBCOMS_SEND_REQUEST_CREATE

    • SAPLSOA2    FUNCTION    SO_OBJECT_SEND

    • SAPLSTXBW    FUNCTION    SSFCONVERT_OTF_AND_MAIL

    • SAPLSTXBC    FORM    OTF_MAIL

    • SAPLSTXBC    FORM    OTF_RESOLVE

    • SAPLSTXBC    FORM    OTF_FINISH

    • SAPLSTXBC    FUNCTION    SSFCOMP_CLOSE

    • /1BCDWB/SAPLSF00000001    FUNCTION    /1BCDWB/SF00000001

    • RLB_INVOICE    FORM    PROCESSING

    • RLB_INVOICE    FORM    ENTRY

    • RSNAST00    FORM    PROGRAMM_AUFRUFEN

  • receivers is built in SBCOMS_SEND_REQUEST_CREATE
    • By nature it contains only the default address

Solving the problem:

  • Place an implicit enhancement at the beginning of FM sbcoms_send_request_create.
    • In this read the email title from objhead where objhead-line(12) = ‘TDTITLE=Inv:’.
    • objhead-line+13(9) is the invoice number in our case
  • In VBRK, the invoice number is connected to the Customer number
  • In KNA1, the customer number is connected to the address number
  • The sought addresses are in ADR6 and can therefore be appended to receivers

Things that you might want to think about further:

  • In another exit, you might export the address number, then import it in this exit.  The method I’m using is pretty hokey…

I will be glad to talk further to anyone about this solution.

Neal Wilhite

wilhiten@aol.com

Addendums:

Addendum 1 for Lech Dzierzawski

Code in FM sbcoms_send_request_create:

FUNCTION sbcoms_send_request_create.
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""$"$\SE:(1) Function Module SBCOMS_SEND_REQUEST_CREATE, Start                                                                                                 A
*$*$-Start: (1)---------------------------------------------------------------------------------$*$*
ENHANCEMENT 1  Z_SBCOMS_SEND_REQ_CRT_START.    "active version
*
include Z_SBCOMS_SEND_REQ_CRT_START.
*
ENDENHANCEMENT.
*$*$-End:   (1)---------------------------------------------------------------------------------$*$*
*"----------------------------------------------------------------------
*"*"Lokale Schnittstelle:
*"  IMPORTING
*"     VALUE(COPY_OBJECT) LIKE  SONV-FLAG DEFAULT SPACE
*"     VALUE(OUTBOX_FLAG) LIKE  SOUD-OUTFL DEFAULT 'S'
*"     VALUE(OWNER) LIKE  SOUD-USRNAM DEFAULT SPACE
*"     VALUE(ORIGINATOR) LIKE  SOOS1-RECEXTNAM OPTIONAL
*"     VALUE(ORIGINATOR_TYPE) LIKE  SOOS1-RECESC OPTIONAL
 ...

So, a begin implicit enhancement here.  I never put code directly into enhancements,  I always put the code in an include.

So the include Z_SBCOMS_SEND_REQ_CRT_START follows:

*&---------------------------------------------------------------------*
*&  Include           Z_SBCOMS_SEND_REQ_CRT_START
*&---------------------------------------------------------------------*
TABLES: adr6.
DATA: t_inv LIKE vbrk-vbeln,
      t_kunag LIKE vbrk-kunag,
      t_adrnr LIKE adr6-addrnumber.
CLEAR receivers.
*  REFRESH receivers.
MOVE sy-datum  TO receivers-rcdat .
MOVE sy-uzeit  TO receivers-rctim.
MOVE '1'       TO receivers-sndpri.
MOVE 'X'       TO receivers-sndex.
MOVE 'U-'      TO receivers-recnam.
MOVE 'U'       TO receivers-recesc.
MOVE 'INT'     TO receivers-sndart.
MOVE '5'       TO receivers-sortclass.
LOOP AT objhead.
  IF objhead-line(12) = 'TDTITLE=Inv:'.
    MOVE objhead-line+13(9) TO t_inv.
    CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
      EXPORTING
        input         = t_inv
      IMPORTING
        OUTPUT        = t_inv .
    SELECT SINGLE kunag INTO t_kunag FROM vbrk
      WHERE vbeln = t_inv.
    IF sy-subrc IS INITIAL.
      SELECT SINGLE adrnr INTO t_adrnr FROM kna1
        WHERE kunnr = t_kunag.
      IF sy-subrc IS INITIAL.
        SELECT * FROM adr6 INTO adr6
          WHERE addrnumber = t_adrnr
            AND flgdefault = ' '
            AND flg_nouse  = ' '.
          receivers-recextnam = adr6-SMTP_ADDR.
          APPEND receivers.
        ENDSELECT.
      ENDIF.
    ENDIF.
  ENDIF.
ENDLOOP.

Assigned tags

      19 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Madhu Vadlamani
      Madhu Vadlamani

      Hi Neal,

      Thanks for your valuable document.lets me try and tell you if need any help.

      Regards,

      Madhu.

      Author's profile photo Lech Dzierzawski
      Lech Dzierzawski

      Hi,

      can you attach an example of code for of FM sbcoms_send_request_create?

      thx

      Author's profile photo Former Member
      Former Member
      Blog Post Author

      I've included it in an edit to the bottom of the document!

      Neal

      Author's profile photo Lech Dzierzawski
      Lech Dzierzawski

      great 🙂

      thank you.

      it's working only for smartforms, not for sapscript?

      Author's profile photo Former Member
      Former Member
      Blog Post Author

      In a second pass, it appears to work for both, but I can't guarantee that it will work for all configurations.

      Author's profile photo Lech Dzierzawski
      Lech Dzierzawski

      and can i use it for send fax to many receivers?

      if yes, what i must change?

      Author's profile photo Former Member
      Former Member
      Blog Post Author

      I'm afraid that I can't be sure about multi faxing,  Our testing facilities for that are highly limited.

      Author's profile photo SAP SD S G S
      SAP SD S G S

      Hi Neil,

      Thanks for sharing a the document. I found it really useful for reference.

      Warm Regards,

      Sharan

      Author's profile photo NARRA LINGESH
      NARRA LINGESH

      Hi Neil,

      Thanks for sharing..it is really informative.

      Regards,

      Lingesh N

      Author's profile photo Former Member
      Former Member
      Blog Post Author

      Lingesh,

      Let me know if you need anything added to make it clearer or more useful.

      Neal

      Author's profile photo Former Member
      Former Member

      Hi Neal,

           How to send mail to multiple recipients for ME28 Tcode.

      Regards,

      Noufal

      Author's profile photo Former Member
      Former Member

      Hello Neal,

      Thanks for the nice document

      Is there any specific medium output medium to achieve this functionality .i created a output type(ZD0S) WITH MEDIUM 5,Access sequence 0004 but my breakpoint is not triggering in the FM you mention i.e' sbcoms_send_request_create.'Now mail is triggering for only the defult id.Please guide if u have some idea .


      Thanks In advance

      Sam

      Author's profile photo Maheshkumar gattu
      Maheshkumar gattu

      how do i get document number, i am not getting any values in objhead-line+13(9) .

      Please help me.

      Author's profile photo Former Member
      Former Member

      Just so all will know.  I have changed companies, which closed my SCN account.  Therefore, I don't see comments on this thread anymore.  Please feel free to email me if you have any questions.

      Neal

      Author's profile photo Lech Dzierzawski
      Lech Dzierzawski

      Hi

      You can contact with SCN helpdesk and ask them to assign yours account with yours private email address. After that you can still use your old SCN account.

      Author's profile photo Former Member
      Former Member

      I still can't logon.  The account was disabled by the owning company.  I don't think that SCN can do anything about that.

      Author's profile photo Former Member
      Former Member

      Hi Neal, I tried but the debugger is not stopping there. Can you let me know If I am missing something there.

      Author's profile photo Former Member
      Former Member

      Hi Neal, As Sam mentioned above, the debugger is not stopping there 🙁

      Author's profile photo Ronald Knienieder
      Ronald Knienieder

      Great! Thanks