Send e-mail with subject line greater than 50 characters

SAP email

Let’s get on Send e-mail with subject line greater than 50 characters. In some cases when we send email, according to the business prerequisite, the headline of the email can be more noteworthy than 50 characters. The capability module SO_NEW_DOCUMENT_ATT_SEND_API1, which is typically utilized in sending messages from SAP, has a restriction of email subject of greatest 50 characters.

📺 Recommended Video: SAP ABAP Full Course Roadmap 2026 | Basic to Advanced (HANA, CDS & OData)

Watch our comprehensive video guide below for step-by-step SAP ABAP concepts and practical demonstrations:

So in such cases we really want to search for a choice to send messages. We can call the class CL_BCS (Business Correspondence Administration) to finish this. Send e-mail with subject line greater than 50 characters.

Also Read | ABAP Email Subject

CL_BCS is a class that fills in as the connection point from BCS to the applications. The strategies for the class cater for the send capabilities.

ABAP for SAP HANA. ALV Report On SAP HANA – Opportunities And Challenges

Code Snippet:

TYPES: BEGIN OF t_mail_body.
INCLUDE TYPE solisti1.
TYPES: END OF t_mail_body.

CONSTANTS:
c_check TYPE char1 VALUE ‘X’,
c_mode TYPE char3 VALUE ‘INT’,
c_doc_type TYPE char3 VALUE ‘RAW’.

DATA : i_mail_body TYPE STANDARD TABLE OF t_mail_body,
k_doc_data TYPE sodocchgi1,
v_subject TYPE char255.
DATA:
lv_cnt TYPE i,
lv_sub TYPE string,
lv_receiver TYPE ad_smtpadr,
l_ref_send_request TYPE REF TO cl_bcs,
l_ref_document TYPE REF TO cl_document_bcs,
l_ref_sender TYPE REF TO cl_sapuser_bcs,
l_ref_recipient TYPE REF TO if_recipient_bcs,
l_ref_bcs_exception TYPE REF TO cx_bcs,
lv_sent_to_all TYPE os_boolean.

CLEAR: k_doc_data.

* Populate the email body in internal table i_mail_body[].

* Fill the document data.
DESCRIBE TABLE i_mail_body LINES lv_cnt.

k_doc_data-doc_size = ( lv_cnt – 1 ) * 255.

TRY.
* ——– create persistent send request ————————
l_ref_send_request = cl_bcs=>create_persistent( ).

* ——– create and set document ——————————-
* create document from internal table with text

l_ref_document= cl_document_bcs=>create_document(
i_type = c_doc_type
i_text = i_mail_body
i_length = k_doc_data-doc_size
i_subject = ‘ ‘ ).

* Subject of the email
lv_sub = ‘The following interface failed, Please check’. ” This can * be greater than 50 characters

CALL METHOD l_ref_send_request->set_message_subject
EXPORTING
ip_subject = lv_sub.

* add document to send request
CALL METHOD l_ref_send_request->set_document( l_ref_document ).

* ——— set sender ——————————————-
* note: this is necessary only if you want to set the sender
* different from actual user (SY-UNAME). Otherwise sender is
* set automatically with actual user.

l_ref_sender = cl_sapuser_bcs=>create( sy-uname ).

CALL METHOD l_ref_send_request->set_sender
EXPORTING
i_sender = l_ref_sender.

CLEAR lv_receiver.
* Get receiver from the config table

lv_receiver = ‘xxxxx@gmail.com’.

* ——— add recipient (e-mail address) ———————–
* create recipient – please replace e-mail address
l_ref_recipient = cl_cam_address_bcs=>create_internet_address(
lv_receiver ).

* add recipient with its respective attributes to send request
CALL METHOD l_ref_send_request->add_recipient
EXPORTING
i_recipient = l_ref_recipient
i_express = c_check.

* ———- send document —————————————
CALL METHOD l_ref_send_request->send(
EXPORTING
i_with_error_screen = c_check
RECEIVING
result = lv_sent_to_all ).

COMMIT WORK.

ENDTRY.

*Executing the standard mail sending program for immediate dispatch of mail
SUBMIT rsconn01 WITH mode = c_mode AND RETURN. ” Mode is INT’

If it’s not too much trouble, note: You can not see the email subject in SAP Exchange code SOST. In any case, in the real email inbox you will actually want to see the headline.

Benefits:

1) This has practically every one of the elements present in the normal FM SO_NEW_DOCUMENT_ATT_SEND_API1.

2) what’s more we can send email with the message lines more noteworthy than 50 characters.

YOU MAY LIKE THIS

A Comprehensive Guide to SAP ABAP Training Online

Core Data Services in ABAP for HANA

Setting Up an ABAP Environment in the Cloud

  • Related Posts

    AI-Code Creates More Testing Work: Adapting to Increased Demand |

    Learn about the impact of AI-generated code on QA teams and strategies for adapting to increased testing demands. | Bright-Minds Training Institute, Pune

    Bridging the Gap: How Automation Addresses Understaffing in QA Teams |

    Learn how automation is helping to address the understaffing crisis in quality assurance teams, improving efficiency and enhancing software products. Discover best practices for implementing automation and explore the future of QA automation at Bright-Minds.

    Leave a Reply

    Your email address will not be published. Required fields are marked *

    You Missed

    AI-Code Creates More Testing Work: Adapting to Increased Demand |

    • By Varad
    • October 24, 2026
    • 4 views
    AI-Code Creates More Testing Work: Adapting to Increased Demand |

    Bridging the Gap: How Automation Addresses Understaffing in QA Teams |

    • By Varad
    • October 23, 2026
    • 12 views
    Bridging the Gap: How Automation Addresses Understaffing in QA Teams |

    Selenium BiDi: A Game Changer for Browser Automation |

    • By Varad
    • October 22, 2026
    • 16 views
    Selenium BiDi: A Game Changer for Browser Automation |

    Catch Regressions First: The Power of Continuous Performance Baselines

    • By Varad
    • October 21, 2026
    • 28 views
    Catch Regressions First: The Power of Continuous Performance Baselines

    uman Oversight in AI Testing

    • By Varad
    • October 19, 2026
    • 21 views
    uman Oversight in AI Testing

    Harnessing Observability for Automated Regression Tests

    • By Varad
    • October 18, 2026
    • 29 views
    Harnessing Observability for Automated Regression Tests