G-YWWN0NYSS1 Send e-mail with subject line greater than 50 characters - TECHNICAL GYAN GURU Send e-mail with subject line greater than 50 characters - TECHNICAL GYAN GURU

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.

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.

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

    Common SAP ABAP Interview Questions and Answers

    Preparing for your first SAP ABAP interview can feel confusing. Many beginners know the syntax, but still struggle to answer practical questions asked by interviewers. In 2026, companies expect more…

    How to Debug SAP ABAP Programs Like a Pro

    Debugging is one of the most important skills for any SAP ABAP developer. Writing code is only half of the job. In real projects, most of your time is spent…

    Leave a Reply

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

    You Missed

    Common SAP ABAP Interview Questions and Answers

    • By Varad
    • March 5, 2026
    • 299 views
    Common SAP ABAP Interview Questions and Answers

    How to Debug SAP ABAP Programs Like a Pro

    • By Varad
    • March 4, 2026
    • 143 views
    How to Debug SAP ABAP Programs Like a Pro

    Can ChatGPT Help in Learning SAP ABAP

    • By Varad
    • March 3, 2026
    • 31 views
    Can ChatGPT Help in Learning SAP ABAP

    Can Automation Replace SAP ABAP Developers?

    • By Varad
    • February 28, 2026
    • 78 views
    Can Automation Replace SAP ABAP Developers?

    SAP Automation vs Manual Testing: Career Comparison

    • By Varad
    • February 27, 2026
    • 87 views
    SAP Automation vs Manual Testing: Career Comparison

    Tools Used For Sap Automation Testing in 2026

    • By Varad
    • February 26, 2026
    • 122 views
    Tools Used For Sap Automation Testing in 2026