Application Development Blog Posts
Learn and share on deeper, cross technology development topics such as integration and connectivity, automation, cloud extensibility, developing at scale, and security.
cancel
Showing results for 
Search instead for 
Did you mean: 
dhruv_mehta
Active Contributor

Hi All ,

This is the document showing how to create Two Nodes for SMS in Transaction SCOT. handle them technically using code.(Which node you want to select while Sending SMS)

Scenario : In Our Company we have multiple formats of business. So for every format we have different Third party vendor for SMS hence different webservice. So we Firstly coded "HARDCODED WEBSERVICE" in our code. which led us to bad performance and we also can not track SMSs from SOST we need to get reports from third party.

So finally i debugged and checked that as per our requirment we can assign specified node from SCOT in our code.

We are using System : CRM 7.0 Ehp2.

Steps :

Go to Transaction SCOT :

NOTE : Above is classic Node maintaince , as I am more comfortable in that :wink: ... if above screen is not coming while you access SCOT go

to utilities and Select Classic Node Maintaince.

Step 2 : Create one Node under PAG(SMS Type)

Note : all configuration for SMS in SPRO or so will not be discussed here.

Press on Create button on top left corner. Make sure you have selected PAG type.

here you can give your variables as RECIPIENT Address and Message Text.

Next : Step of creating node is giving Password to authenticate your provider and select maximum length as per your company requirment. For SMS you can select 255 bytes.

Next : Specify which text your provider returns in the status message (HTTP response) to indicate that you have error or success( I have not changed what SAP has suggested me )

Step 3 : Create address area While Creating NODE.

Here's the deal : Generally what I have seen is people giving '*' here only! but here give different address area for different nodes.

For our convience  we gave the same name as NODE :  so I have given 'SM1*'.

above is the most important TIP and step.

Next : give Maximum waiting time as per your company requirment ( in my case ihave gave 2 minutes)

Next : Check Node is ready to use.

Bingo :grin: you have created a node Now same way create another node or just copy 1st node and change the URL of webservice.

Now we are done with the SCOT configuration.

Lets go with the Abap Part. How to develope and how to debug.

CODE :

    LR_DOCUMENT = CL_DOCUMENT_BCS=>CREATE_DOCUMENT(
               I_TYPE    = 'RAW'
               I_TEXT    = LV_BODY  " Mail body
               I_SUBJECT = ' ' ).
  IF SY-SUBRC <> 0.
    RAISE SMS_CAN_NOT_BE_CREATED.
  ENDIF.



* Add the document to send request
  CALL METHOD LR_SEND_REQUEST->SET_DOCUMENT( LR_DOCUMENT ).
  IF SY-SUBRC <> 0.
    RAISE SMS_CAN_NOT_BE_SENT.
  ENDIF.


* Sender addess
  LR_SENDER = CL_SAPUSER_BCS=>CREATE( SY-UNAME ).
  CALL METHOD LR_SEND_REQUEST->SET_SENDER
    EXPORTING
      I_SENDER = LR_SENDER.
  IF SY-SUBRC <> 0.
    RAISE SMS_CAN_NOT_BE_SENT.
  ENDIF.


* Recipient address
*  lr_recipient = cl_cam_address_bcs=>create_sms_address( iv_phone_no ).

  TRY.
      CALL METHOD CL_CAM_ADDRESS_BCS=>CREATE_SMS_ADDRESS
        EXPORTING
          I_SERVICE = IV_SERVICE_NODE
          I_NUMBER  = IV_PHONE_NO
        RECEIVING
          RESULT    = LR_RECIPIENT.
    CATCH CX_ADDRESS_BCS .
  ENDTRY.

  IF SY-SUBRC <> 0.
    RAISE SMS_CAN_NOT_BE_SENT.
  ENDIF.
* Add recipient address to send request


  CALL METHOD LR_SEND_REQUEST->ADD_RECIPIENT
    EXPORTING
      I_RECIPIENT = LR_RECIPIENT
      I_EXPRESS   = 'X'.

  IF SY-SUBRC <> 0.
    RAISE SMS_CAN_NOT_BE_SENT.
  ENDIF.

  CALL METHOD LR_SEND_REQUEST->SEND(
    EXPORTING
      I_WITH_ERROR_SCREEN = 'X'
    RECEIVING
      RESULT              = E_FLAG ).

  IF SY-SUBRC <> 0.
    RAISE SMS_CAN_NOT_BE_SENT.
  ENDIF.


  COMMIT WORK.

Now in above code see the calling of method : CL_CAM_ADDRESS_BCS=>CREATE_SMS_ADDRESS

give your Node name in parameter I_SERVICE which you have created in SCOT : i.e. (SM1 and so on).

Now Debug Part how your URL will get created by your Variables (I.e Recipent number and Message Text).

When you trigger The SMS it will go to SOST.

put /h before you Execute your message.

Put the Breakepoin in Function Module : SX_URL_CREATE

as you can see the code SAP is replacing the variables. Debug the code and Bingo you are done with SCOT confing ( Make sure for different node give differernt address area and in code give I_SERVICE paramaeter)

Thanks all for reading this.

5 Comments