Skip to content

/AWS1/IF_PPT=>SENDMESSAGES()

About SendMessages

Creates and sends a direct message.

Method Signature

METHODS /AWS1/IF_PPT~SENDMESSAGES
  IMPORTING
    !IV_APPLICATIONID TYPE /AWS1/PPT__STRING OPTIONAL
    !IO_MESSAGEREQUEST TYPE REF TO /AWS1/CL_PPTMESSAGEREQUEST OPTIONAL
  RETURNING
    VALUE(OO_OUTPUT) TYPE REF TO /aws1/cl_pptsendmessagesrsp
  RAISING
    /AWS1/CX_PPTBADREQUESTEX
    /AWS1/CX_PPTFORBIDDENEXCEPTION
    /AWS1/CX_PPTINTERNALSERVERER00
    /AWS1/CX_PPTMETHODNOTALLOWEDEX
    /AWS1/CX_PPTNOTFOUNDEXCEPTION
    /AWS1/CX_PPTPAYLOADTOOLARGEEX
    /AWS1/CX_PPTTOOMANYREQUESTSEX
    /AWS1/CX_PPTCLIENTEXC
    /AWS1/CX_PPTSERVEREXC
    /AWS1/CX_RT_TECHNICAL_GENERIC
    /AWS1/CX_RT_SERVICE_GENERIC.

IMPORTING

Required arguments:

iv_applicationid TYPE /AWS1/PPT__STRING /AWS1/PPT__STRING

The unique identifier for the application. This identifier is displayed as the Project ID on the Amazon Pinpoint console.

io_messagerequest TYPE REF TO /AWS1/CL_PPTMESSAGEREQUEST /AWS1/CL_PPTMESSAGEREQUEST

MessageRequest

RETURNING

oo_output TYPE REF TO /aws1/cl_pptsendmessagesrsp /AWS1/CL_PPTSENDMESSAGESRSP

Domain /AWS1/RT_ACCOUNT_ID
Primitive Type NUMC

Examples

Syntax Example

This is an example of the syntax for calling the method. It includes every possible argument and initializes every possible value. The data provided is not necessarily semantically accurate (for example the value "string" may be provided for something that is intended to be an instance ID, or in some cases two arguments may be mutually exclusive). The syntax shows the ABAP syntax for creating the various data structures.

DATA(lo_result) = lo_client->sendmessages(
  io_messagerequest = new /aws1/cl_pptmessagerequest(
    io_messageconfiguration = new /aws1/cl_pptdirectmessageconf(
      io_admmessage = new /aws1/cl_pptadmmessage(
        it_data = VALUE /aws1/cl_pptmapof__string_w=>tt_mapof__string(
          (
            VALUE /aws1/cl_pptmapof__string_w=>ts_mapof__string_maprow(
              key = |string|
              value = new /aws1/cl_pptmapof__string_w( |string| )
            )
          )
        )
        it_substitutions = VALUE /aws1/cl_pptlistof__string_w=>tt_mapoflistof__string(
          (
            VALUE /aws1/cl_pptlistof__string_w=>ts_mapoflistof__string_maprow(
              value = VALUE /aws1/cl_pptlistof__string_w=>tt_listof__string(
                ( new /aws1/cl_pptlistof__string_w( |string| ) )
              )
              key = |string|
            )
          )
        )
        iv_action = |string|
        iv_body = |string|
        iv_consolidationkey = |string|
        iv_expiresafter = |string|
        iv_iconreference = |string|
        iv_imageiconurl = |string|
        iv_imageurl = |string|
        iv_md5 = |string|
        iv_rawcontent = |string|
        iv_silentpush = ABAP_TRUE
        iv_smallimageiconurl = |string|
        iv_sound = |string|
        iv_title = |string|
        iv_url = |string|
      )
      io_apnsmessage = new /aws1/cl_pptapnsmessage(
        it_data = VALUE /aws1/cl_pptmapof__string_w=>tt_mapof__string(
          (
            VALUE /aws1/cl_pptmapof__string_w=>ts_mapof__string_maprow(
              key = |string|
              value = new /aws1/cl_pptmapof__string_w( |string| )
            )
          )
        )
        it_substitutions = VALUE /aws1/cl_pptlistof__string_w=>tt_mapoflistof__string(
          (
            VALUE /aws1/cl_pptlistof__string_w=>ts_mapoflistof__string_maprow(
              value = VALUE /aws1/cl_pptlistof__string_w=>tt_listof__string(
                ( new /aws1/cl_pptlistof__string_w( |string| ) )
              )
              key = |string|
            )
          )
        )
        iv_action = |string|
        iv_apnspushtype = |string|
        iv_badge = 123
        iv_body = |string|
        iv_category = |string|
        iv_collapseid = |string|
        iv_mediaurl = |string|
        iv_preferredauthntctnmethod = |string|
        iv_priority = |string|
        iv_rawcontent = |string|
        iv_silentpush = ABAP_TRUE
        iv_sound = |string|
        iv_threadid = |string|
        iv_timetolive = 123
        iv_title = |string|
        iv_url = |string|
      )
      io_baidumessage = new /aws1/cl_pptbaidumessage(
        it_data = VALUE /aws1/cl_pptmapof__string_w=>tt_mapof__string(
          (
            VALUE /aws1/cl_pptmapof__string_w=>ts_mapof__string_maprow(
              key = |string|
              value = new /aws1/cl_pptmapof__string_w( |string| )
            )
          )
        )
        it_substitutions = VALUE /aws1/cl_pptlistof__string_w=>tt_mapoflistof__string(
          (
            VALUE /aws1/cl_pptlistof__string_w=>ts_mapoflistof__string_maprow(
              value = VALUE /aws1/cl_pptlistof__string_w=>tt_listof__string(
                ( new /aws1/cl_pptlistof__string_w( |string| ) )
              )
              key = |string|
            )
          )
        )
        iv_action = |string|
        iv_body = |string|
        iv_iconreference = |string|
        iv_imageiconurl = |string|
        iv_imageurl = |string|
        iv_rawcontent = |string|
        iv_silentpush = ABAP_TRUE
        iv_smallimageiconurl = |string|
        iv_sound = |string|
        iv_timetolive = 123
        iv_title = |string|
        iv_url = |string|
      )
      io_defaultmessage = new /aws1/cl_pptdefaultmessage(
        it_substitutions = VALUE /aws1/cl_pptlistof__string_w=>tt_mapoflistof__string(
          (
            VALUE /aws1/cl_pptlistof__string_w=>ts_mapoflistof__string_maprow(
              value = VALUE /aws1/cl_pptlistof__string_w=>tt_listof__string(
                ( new /aws1/cl_pptlistof__string_w( |string| ) )
              )
              key = |string|
            )
          )
        )
        iv_body = |string|
      )
      io_defaultpushnotifmessage = new /aws1/cl_pptdefpushnotifmsg(
        it_data = VALUE /aws1/cl_pptmapof__string_w=>tt_mapof__string(
          (
            VALUE /aws1/cl_pptmapof__string_w=>ts_mapof__string_maprow(
              key = |string|
              value = new /aws1/cl_pptmapof__string_w( |string| )
            )
          )
        )
        it_substitutions = VALUE /aws1/cl_pptlistof__string_w=>tt_mapoflistof__string(
          (
            VALUE /aws1/cl_pptlistof__string_w=>ts_mapoflistof__string_maprow(
              value = VALUE /aws1/cl_pptlistof__string_w=>tt_listof__string(
                ( new /aws1/cl_pptlistof__string_w( |string| ) )
              )
              key = |string|
            )
          )
        )
        iv_action = |string|
        iv_body = |string|
        iv_silentpush = ABAP_TRUE
        iv_title = |string|
        iv_url = |string|
      )
      io_emailmessage = new /aws1/cl_pptemailmessage(
        io_rawemail = new /aws1/cl_pptrawemail( '5347567362473873563239796247513D' )
        io_simpleemail = new /aws1/cl_pptsimpleemail(
          io_htmlpart = new /aws1/cl_pptsimpleemailpart(
            iv_charset = |string|
            iv_data = |string|
          )
          io_subject = new /aws1/cl_pptsimpleemailpart(
            iv_charset = |string|
            iv_data = |string|
          )
          io_textpart = new /aws1/cl_pptsimpleemailpart(
            iv_charset = |string|
            iv_data = |string|
          )
          it_headers = VALUE /aws1/cl_pptmessageheader=>tt_listofmessageheader(
            (
              new /aws1/cl_pptmessageheader(
                iv_name = |string|
                iv_value = |string|
              )
            )
          )
        )
        it_replytoaddresses = VALUE /aws1/cl_pptlistof__string_w=>tt_listof__string(
          ( new /aws1/cl_pptlistof__string_w( |string| ) )
        )
        it_substitutions = VALUE /aws1/cl_pptlistof__string_w=>tt_mapoflistof__string(
          (
            VALUE /aws1/cl_pptlistof__string_w=>ts_mapoflistof__string_maprow(
              value = VALUE /aws1/cl_pptlistof__string_w=>tt_listof__string(
                ( new /aws1/cl_pptlistof__string_w( |string| ) )
              )
              key = |string|
            )
          )
        )
        iv_body = |string|
        iv_feedbackforwardingaddress = |string|
        iv_fromaddress = |string|
      )
      io_gcmmessage = new /aws1/cl_pptgcmmessage(
        it_data = VALUE /aws1/cl_pptmapof__string_w=>tt_mapof__string(
          (
            VALUE /aws1/cl_pptmapof__string_w=>ts_mapof__string_maprow(
              key = |string|
              value = new /aws1/cl_pptmapof__string_w( |string| )
            )
          )
        )
        it_substitutions = VALUE /aws1/cl_pptlistof__string_w=>tt_mapoflistof__string(
          (
            VALUE /aws1/cl_pptlistof__string_w=>ts_mapoflistof__string_maprow(
              value = VALUE /aws1/cl_pptlistof__string_w=>tt_listof__string(
                ( new /aws1/cl_pptlistof__string_w( |string| ) )
              )
              key = |string|
            )
          )
        )
        iv_action = |string|
        iv_body = |string|
        iv_collapsekey = |string|
        iv_iconreference = |string|
        iv_imageiconurl = |string|
        iv_imageurl = |string|
        iv_preferredauthntctnmethod = |string|
        iv_priority = |string|
        iv_rawcontent = |string|
        iv_restrictedpackagename = |string|
        iv_silentpush = ABAP_TRUE
        iv_smallimageiconurl = |string|
        iv_sound = |string|
        iv_timetolive = 123
        iv_title = |string|
        iv_url = |string|
      )
      io_smsmessage = new /aws1/cl_pptsmsmessage(
        it_substitutions = VALUE /aws1/cl_pptlistof__string_w=>tt_mapoflistof__string(
          (
            VALUE /aws1/cl_pptlistof__string_w=>ts_mapoflistof__string_maprow(
              value = VALUE /aws1/cl_pptlistof__string_w=>tt_listof__string(
                ( new /aws1/cl_pptlistof__string_w( |string| ) )
              )
              key = |string|
            )
          )
        )
        iv_body = |string|
        iv_entityid = |string|
        iv_keyword = |string|
        iv_mediaurl = |string|
        iv_messagetype = |string|
        iv_originationnumber = |string|
        iv_senderid = |string|
        iv_templateid = |string|
      )
      io_voicemessage = new /aws1/cl_pptvoicemessage(
        it_substitutions = VALUE /aws1/cl_pptlistof__string_w=>tt_mapoflistof__string(
          (
            VALUE /aws1/cl_pptlistof__string_w=>ts_mapoflistof__string_maprow(
              value = VALUE /aws1/cl_pptlistof__string_w=>tt_listof__string(
                ( new /aws1/cl_pptlistof__string_w( |string| ) )
              )
              key = |string|
            )
          )
        )
        iv_body = |string|
        iv_languagecode = |string|
        iv_originationnumber = |string|
        iv_voiceid = |string|
      )
    )
    io_templateconfiguration = new /aws1/cl_ppttemplateconf(
      io_emailtemplate = new /aws1/cl_ppttemplate(
        iv_name = |string|
        iv_version = |string|
      )
      io_inapptemplate = new /aws1/cl_ppttemplate(
        iv_name = |string|
        iv_version = |string|
      )
      io_pushtemplate = new /aws1/cl_ppttemplate(
        iv_name = |string|
        iv_version = |string|
      )
      io_smstemplate = new /aws1/cl_ppttemplate(
        iv_name = |string|
        iv_version = |string|
      )
      io_voicetemplate = new /aws1/cl_ppttemplate(
        iv_name = |string|
        iv_version = |string|
      )
    )
    it_addresses = VALUE /aws1/cl_pptaddressconf=>tt_mapofaddressconfiguration(
      (
        VALUE /aws1/cl_pptaddressconf=>ts_mapofaddressconf_maprow(
          key = |string|
          value = new /aws1/cl_pptaddressconf(
            it_context = VALUE /aws1/cl_pptmapof__string_w=>tt_mapof__string(
              (
                VALUE /aws1/cl_pptmapof__string_w=>ts_mapof__string_maprow(
                  key = |string|
                  value = new /aws1/cl_pptmapof__string_w( |string| )
                )
              )
            )
            it_substitutions = VALUE /aws1/cl_pptlistof__string_w=>tt_mapoflistof__string(
              (
                VALUE /aws1/cl_pptlistof__string_w=>ts_mapoflistof__string_maprow(
                  value = VALUE /aws1/cl_pptlistof__string_w=>tt_listof__string(
                    ( new /aws1/cl_pptlistof__string_w( |string| ) )
                  )
                  key = |string|
                )
              )
            )
            iv_bodyoverride = |string|
            iv_channeltype = |string|
            iv_rawcontent = |string|
            iv_titleoverride = |string|
          )
        )
      )
    )
    it_context = VALUE /aws1/cl_pptmapof__string_w=>tt_mapof__string(
      (
        VALUE /aws1/cl_pptmapof__string_w=>ts_mapof__string_maprow(
          key = |string|
          value = new /aws1/cl_pptmapof__string_w( |string| )
        )
      )
    )
    it_endpoints = VALUE /aws1/cl_pptendpointsendconf=>tt_mapofendpointsendconf(
      (
        VALUE /aws1/cl_pptendpointsendconf=>ts_mapofendptsendconf_maprow(
          value = new /aws1/cl_pptendpointsendconf(
            it_context = VALUE /aws1/cl_pptmapof__string_w=>tt_mapof__string(
              (
                VALUE /aws1/cl_pptmapof__string_w=>ts_mapof__string_maprow(
                  key = |string|
                  value = new /aws1/cl_pptmapof__string_w( |string| )
                )
              )
            )
            it_substitutions = VALUE /aws1/cl_pptlistof__string_w=>tt_mapoflistof__string(
              (
                VALUE /aws1/cl_pptlistof__string_w=>ts_mapoflistof__string_maprow(
                  value = VALUE /aws1/cl_pptlistof__string_w=>tt_listof__string(
                    ( new /aws1/cl_pptlistof__string_w( |string| ) )
                  )
                  key = |string|
                )
              )
            )
            iv_bodyoverride = |string|
            iv_rawcontent = |string|
            iv_titleoverride = |string|
          )
          key = |string|
        )
      )
    )
    iv_traceid = |string|
  )
  iv_applicationid = |string|
).

This is an example of reading all possible response values

lo_result = lo_result.
IF lo_result IS NOT INITIAL.
  lo_messageresponse = lo_result->get_messageresponse( ).
  IF lo_messageresponse IS NOT INITIAL.
    lv___string = lo_messageresponse->get_applicationid( ).
    LOOP AT lo_messageresponse->get_endpointresult( ) into ls_row.
      lv_key = ls_row-key.
      lo_value = ls_row-value.
      IF lo_value IS NOT INITIAL.
        lv___string = lo_value->get_address( ).
        lv_deliverystatus = lo_value->get_deliverystatus( ).
        lv___string = lo_value->get_messageid( ).
        lv___integer = lo_value->get_statuscode( ).
        lv___string = lo_value->get_statusmessage( ).
        lv___string = lo_value->get_updatedtoken( ).
      ENDIF.
    ENDLOOP.
    lv___string = lo_messageresponse->get_requestid( ).
    LOOP AT lo_messageresponse->get_result( ) into ls_row_1.
      lv_key = ls_row_1-key.
      lo_value_1 = ls_row_1-value.
      IF lo_value_1 IS NOT INITIAL.
        lv_deliverystatus = lo_value_1->get_deliverystatus( ).
        lv___string = lo_value_1->get_messageid( ).
        lv___integer = lo_value_1->get_statuscode( ).
        lv___string = lo_value_1->get_statusmessage( ).
        lv___string = lo_value_1->get_updatedtoken( ).
      ENDIF.
    ENDLOOP.
  ENDIF.
ENDIF.