cancel
Showing results for 
Search instead for 
Did you mean: 

How to put name of a document from a cfolder into the body of an email?

Former Member
0 Kudos

We have implemented a generic object in cFolder for Transmittals using the cFolders Generic object functionality. Basically a transmittal is a document structure of documents stored in cFolders along with metadata information. In a single folder there can be multiple transmittals.

We have a requirement that upon creating a notification for a transmittal object , the document structure contained in the transmittal should be captured in the body of the notification email generated as a list of documents. This is for audit purposes where there is requirement to maintain an email record of which documents were sent along with time and date details.

We are trying to achieve through an enhancement point in the method SEND_NOTIFICATION_EMAIL of class CL_CFX_NOTIFICATION. The issue is that although we can identify the transmittal we cannot read the names of the documents contained in that transmittal in order to put them in the body of the email. We tried the various available function modules such as CFX_API_DOC_GEN_OBJECT_READ, CFX_API_DOC_VERSION_GETDETAIL, etc. Are there any additional function modules available to read the contents of generic objects or any other method to get this information?

Thanks,

Jeff

Accepted Solutions (0)

Answers (2)

Answers (2)

former_member208244
Active Participant
0 Kudos

Hi All,

I'm too late here but I had the same problem and solved it using standard new BADI implementation

/SAPPSSRM/BD_TENDERING_MAIL

Method: ~MAIL_TNDR_OPEN

There you have the option to change the content of the email using your own logic based on the inbound GUID parameter.

Best regards

Sebastian Garofalo

Former Member
0 Kudos

Hi Jeff

Try this form:

FORM get_doc_name  USING    value(v_doc_id)   TYPE sysuuid_c
                   CHANGING c_fol_id          TYPE sysuuid_c
                            c_version_id      TYPE sysuuid_c
                            c_doc_name        TYPE string
                            c_subrc           TYPE sysubrc.

  DATA: ls_fault  TYPE cfx_api_ts_fault,
        l_fault   TYPE cfx_api_t_faultstring,
        l_v1      TYPE symsgv,
        l_v2      TYPE symsgv.

  CLEAR:  c_fol_id, c_version_id, c_doc_name, c_subrc.

  IF v_doc_id IS INITIAL. ADD 4 TO c_subrc. RETURN. ENDIF.

  CALL FUNCTION 'CFX_API_DOC_GETDETAIL'
    EXPORTING
      i_doc_id             = v_doc_id
    IMPORTING
      e_folder_id          = c_fol_id
      es_fault             = ls_fault
      e_faultstring        = l_fault
      e_current_version_id = c_version_id.

  IF ls_fault IS NOT INITIAL OR l_fault IS NOT INITIAL.
    ADD 4 TO c_subrc. RETURN.
  ENDIF.


  CALL FUNCTION 'CFX_API_DOC_VERSION_GETDETAIL'
    EXPORTING
      i_doc_version_id = c_version_id
    IMPORTING
      es_fault         = ls_fault
      e_faultstring    = l_fault
      e_file_path      = c_doc_name.

  IF ls_fault IS NOT INITIAL OR l_fault IS NOT INITIAL.
    ADD 4 TO c_subrc. RETURN.
  ENDIF.


ENDFORM.                    " get_doc_name

Regards,

Fabrizio Gemma

Former Member
0 Kudos

Fabrizio,

Thank you so much.

I think I understand the code.

But one question: where would I call this form from, the send_notification_email method?

Thanks,

Jeff

Former Member
0 Kudos

Fabrizio,

Also, will this code work if there are multiple documents in the transmittal?

Thanks,

Jeff

Former Member
0 Kudos

Hi jeff,

this is just a smple code to get the name of the uploaded document corresponding to a single document id: you have to adapt the code to your needs.

To change the email content, in the method

SEND_NOTIFICATION_EMAIL

you have to change the content of the internal table

lt_mail_body

before the method

cl_cfx_email_util=>send_email

is called.

For example you can define your own custom email text (via transaction se61 or via smartform) containing the docuement name and replace completely the contentent of the email body.

Regards,

Fabrizio Gemma