Application Development Blog Posts
Learn and share on deeper, cross technology development topics such as integration and connectivity, automation, cloud extensibility, developing at scale, and security.
cancel
Showing results for 
Search instead for 
Did you mean: 
Former Member

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 ldzierza

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.
19 Comments