Skip to Content
Technical Articles
Author's profile photo swapna rath

Control the Maximum attachment size limit for an email sent from SAP

Hello Everyone!


If you want to increase the size of the outgoing emails from SAP or if they are stuck in the queue with a red status and error saying :


Cannot process message; maximum size exceeded

This clearly indicates that email and the attachment in it  is too big to get it sent over



We can try compressing the email or changing the size of attachment .

Parameters related to the size of email and its attachment are customizable.

The customizing table is called SXPARAMS – SAPconnect: Parameter Table.

Its maintenance is available t-code SOST -> Utilities -> General Parameters or via SM30 -> SXPARAMS.



Few parameters related to size of email and its components:

Parameter                                             Parameter value


MAXLEN_BODYPART_SMTP               0 … 999999999999   size for a document

MAXLEN_BODYPART_ALI_SMTP        0 … 999999999999   lists of the type ALI

MAXLEN_BODYPART_OTF_SMTP      0 … 999999999999   SAPscript documents

MAXLEN_MIME_MESSAGE_SMTP      0 … 999999999999   MIME MIME attachments

Again  we need to maintain one more parameter of SCOT. It is related to size of email.

MAXLEN_BODYPART_EXT_SMTP      size for an attachment, default value: 10485760


Apart from that we can also restrict the attachment size by handling in the code.

So as soon as we click on attachment button of the email in the attachment event(EH_ONATTACH_BTN) of GS_CM component

Sample Code:

DATA:   lr_upload     TYPE REF TO cl_thtmlb_fileupload.

IF htmlb_event->server_event EQ ‘attach’.

* check if uploadfile is filled
lr_upload = get_upload( ).
IF lr_upload->file_content IS NOT INITIAL.

* check attachment size
IF lr_upload->file_length > 9000000. “size of the attachment as per the requirement
lv_msgsrv = cl_bsp_wd_message_service=>get_instance( ).
lv_msgsrv->add_message( iv_msg_type   = ‘E’
iv_msg_id     = ‘XXXXX’
iv_msg_number = ‘000’ ).
rv_error = ‘X’.



Please let me know your thoughts, doubts in the comment section below, and if you enjoyed, please like and share.

Happy blogging and sharing everyone!

Assigned Tags

      1 Comment
      You must be Logged on to comment or reply to a post.
      Author's profile photo Wshok Babu
      Wshok Babu

      Where can we write the code. Could you please brief explanation.