Quantcast
Channel: SCN : Document List - ABAP Development
Viewing all articles
Browse latest Browse all 935

Multiple Node Creation for SMS(HTTP) in SCOT(T-code) and Using same in code dynamically

$
0
0

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 :

scot.jpg

NOTE : Above is classic Node maintaince , as I am more comfortable in that ... 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.create node 1.jpg

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

 

create node 2.jpg

create node 4.jpg

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.

 

create node 6.jpg

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 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_SERVICEwhich 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.

sost1.jpg

put /h before you Execute your message.

Put the Breakepoin in Function Module : SX_URL_CREATE

sost2.jpg

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.

 


Viewing all articles
Browse latest Browse all 935

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>