Skip to Content
author's profile photo Former Member
Former Member

How to send the screen data to a mail id in web dynpro abap?

Hi all,

I've developed a web dynpro screen with some input fields and drop down. Once user filling all the data in the screen need to press send button, so that mail

will goes to specified person. I m unable to do this. how to capture data from screen and how to send it to specified mail id?

can anybody explain plz?

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • Posted on Apr 24, 2012 at 12:20 PM

    You need to follow the below steps,

    1. Get all the information from the Screen(view) using get_attributes method for the context element.

    2. Pass this information you want to the below function module to a send mail,

    Search SDN for more about this function module.

    call function 'SO_NEW_DOCUMENT_SEND_API1'

    exporting

    document_data = maildata

    document_type = 'RAW'

    put_in_outbox = 'X'

    tables

    object_header = mailtxt

    object_content = mailtxt

    receivers = mailrec

    exceptions

    too_many_receivers = 1

    document_not_sent = 2

    document_type_not_exist = 3

    operation_no_authorization = 4

    parameter_error = 5

    x_error = 6

    enqueue_error = 7

    others = 8.

    if sy-subrc <> 0.

    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

    * WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

    endif.

    Rgds,

    debe.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Apr 24, 2012 at 01:36 PM

    Hi Ramana,

    The screen input fields are bound to context node attributes. Use the wizard to read the context node attributes.

    Then use the following code to send the mail:

    ****Data Declarations

    DATA: send_request TYPE REF TO cl_bcs.

    DATA: document TYPE REF TO cl_document_bcs.

    DATA: recipient TYPE REF TO if_recipient_bcs.

    DATA: sender TYPE REF TO if_recipient_bcs.

    DATA: sent_to_all TYPE os_boolean.

    DATA: bcs_exception TYPE REF TO cx_bcs.

    DATA: text TYPE bcsy_text.

    *****The variable text is the internal table with the contents of the mail.

    *****Append data that needs to be send as string like

    APPEND 'Hello world!' TO text.

    TRY.

    send_request = cl_bcs=>create_persistent( ).

    document = cl_document_bcs=>create_document(

    i_type = 'RAW'
    i_text = text
    i_subject = 'Subject of the Mail').

    CALL METHOD send_request->set_document( document ).

    ****Set the sender of the mail

    sender = cl_cam_address_bcs=>create_internet_address( 'xyz@abc.com' ).

    CALL METHOD send_request->set_sender
    EXPORTING
    i_sender = sender.

    ****Set the recepient of the mail. Repeat the next two steps to add more than one recepient

    recipient = cl_cam_address_bcs=>create_internet_address( 'abc@xyz.com' ).

    CALL METHOD send_request->add_recipient
    EXPORTING
    i_recipient = recipient
    i_express = 'X'.

    ****This method needs to be called otherwise mail will wait in SCOT transaction

    CALL METHOD send_request->set_send_immediately
    EXPORTING
    i_send_immediately = 'X'.

    ****Send the mail

    CALL METHOD send_request->send(
    EXPORTING
    i_with_error_screen = 'X'
    RECEIVING
    result = sent_to_all ).

    CATCH cx_bcs INTO bcs_exception.

    ENDTRY.

    Regards,

    Sayan

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.