cancel
Showing results for 
Search instead for 
Did you mean: 

how to send notification using cl_bcs class & methods?

Former Member
0 Kudos

I am do these process,The notification is not sent. give me idea about thaht.

*&---------------------------------------------------------------------*

*& Report  Z_SEND_NOTIFICATION1

*&

*&---------------------------------------------------------------------*

*&

*&

*&---------------------------------------------------------------------*



REPORT  z_send_notification1.



DATA: send_request  TYPE REF TO cl_bcs,

      document      TYPE REF TO cl_document_bcs,

      receiver      TYPE REF TO cl_cam_address_bcs,

      sender        TYPE REF TO cl_sapuser_bcs.

DATA: status TYPE os_boolean.



*********************************************************** Create presistent

TRY.

    CALL METHOD cl_bcs=>create_persistent

      RECEIVING

        result = send_request.

  CATCH cx_send_req_bcs .

ENDTRY.



********************************************************* Create TEXT

DATA : i_txt TYPE  bcsy_text,

       w_txt TYPE  soli.

w_txt-line = 'hello'.





TRY.

    CALL METHOD cl_document_bcs=>create_from_text

      EXPORTING

        i_text         = i_txt

        i_documenttype = 'RAW'

        i_subject      = space

        i_importance   = '0'

        i_sensitivity  = 'F'

      RECEIVING

        result         = document.

  CATCH cx_document_bcs .

ENDTRY.

***************************************************** Add attachement

DATA : att_type TYPE so_obj_tp ,

       att_sub  TYPE so_obj_des.



att_type = 'HTT'.

att_sub  = 'hello'.

TRY.

    CALL METHOD document->add_attachment

      EXPORTING

        i_attachment_type     = att_type

        i_attachment_subject  = att_sub

*       i_attachment_size

*       I_ATTACHMENT_LANGUAGE = SPACE

*       I_ATT_CONTENT_TEXT    =

*       I_ATT_CONTENT_HEX     =

*       I_ATTACHMENT_HEADER   =

      .

  CATCH cx_document_bcs .

ENDTRY.





******************************************************** Set Document

TRY.

    CALL METHOD send_request->set_document

      EXPORTING

        i_document = document.

  CATCH cx_send_req_bcs .

ENDTRY.

receiver = cl_cam_address_bcs=>create_internet_address('thrimurthulu.abbu3@gmail.com').

**************************************************** Add reciptent

DATA : recipient TYPE REF TO if_recipient_bcs.

TRY.

    CALL METHOD send_request->add_recipient

      EXPORTING

        i_recipient  = recipient

*       I_EXPRESS    =

*       I_COPY       =

*       I_BLIND_COPY =

*       I_NO_FORWARD =

      .

  CATCH cx_send_req_bcs.

ENDTRY.

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

***************************************************** Set sender

TRY.

    CALL METHOD send_request->set_sender

      EXPORTING

        i_sender = sender.

  CATCH cx_send_req_bcs .

ENDTRY.

****************************************************** Send

TRY.

    CALL METHOD send_request->send

* EXPORTING

*   I_WITH_ERROR_SCREEN = SPACE

    RECEIVING

        result              = status

        .

  CATCH cx_send_req_bcs .

ENDTRY.

if sy-subrc eq 0.

  write 'Success'.

endif.

The notification is not sent. Please help me.

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member182426
Active Contributor
0 Kudos