Skip to Content

Send a MMS when you create a Sales Order!

I wrote a Let ABAP speak! few days back where I coded the parameters of the selection screen such that they spoke their respective content to us. Later Ignacio commented on it and gave an awesome idea of sending a MMS whenever a sales order is created. So here it is: I happened to visit OpenWave Developer Network website few days back. So I knew something like this exists and it had always remained on back of my mind. So when Ignacio ignited that part of my brain, I exactly knew what I had to do to accomplish the task. I downloaded the API, the simulator etc from that site and started fiddling around with it. I went through few sample codes as well. One of the sample code clearly mentioned how to send a MMS(it was a servlet though). I am copying that servlet code verbatim here: Step 1 Catch the phone number from Querystring. String num = request.getParameter(“num”); Step 2 Add the number associated with VASP account in recipient array. recipients.add(new Recipient(Recipient.Type.TO, AddressType.NUMBER, userName)); Step 3 Create a text file as MMS content. String fileName =”/usr/local/java/tomcat/webapps/mmsDemo2/data.txt”; mmFiles.add(fileName); Step 4 Create a connection to a relay and call method sendMM() to compose a MMS and send it out. RelayConnection conn = RelayConnection.createSender(mmscUrl, userName, password); sendMM(conn, userName, mmFiles, recipients, num); Step 5 Create a SubmitRequest object in which we set the user phone number in MMS subject line so it is easily retrieved by SubmitRequest request = new SubmitRequest(); request.setVaspID(“my id”); request.addRecipients(recipients); request.setMessageClass(SubmitRequest.MessageClass.PERSONAL); request.setPriority(SubmitRequest.Priority.LOW); request.setDeliveryReport(false); request.setReadReply(false); request.setSubject(“num”+num); Step 6 Compose MMS content. String fileName = (String) mmFiles.get(0); MimeBodyPart part = new MimeBodyPart(); DataSource source = new FileDataSource(fileName); part.setDataHandler(new DataHandler(source)); File file = new File(fileName); part.setFileName(file.getName()); part.setHeader(“Content-ID”, “<” + file.getName() + “>”); request.setContent(part); Step 7 Use the connection object created earlier to send the request to the relay. Catch the response from MMSC and print it out via method printResponse(). response = conn.sendRequest(request); SubmitResponse submitResponse = (SubmitResponse) response; printResponse(submitResponse); Make sure you have a VSAP account before executing this code. You can get most of the information about the tools on that sitehere Now since this is a servlet code, we need to modify it little bit so that it becomes pure core java code and hence, callable(read as ‘without any complicatons’) from ABAP. Please read my previous Let ABAP speak! to know as how to call a java program from ABAP(David hates this way of doing it). So whenever you save a sales order next time, please make sure you call a ABAP program which in turn will call your java program which in turn would send a MMS.
You must be Logged on to comment or reply to a post.
  • Of course there is no real need to branch out to Java in order to send your MMS.  ABAP has a complete HTTP client implemention, so you can just use CL_HTTP_CLIENT to acomplish the same thing.
    • That’s true and being a ABAPer we’ll try to give it preference, but i think it’s one step furthur as we can do it from the legacy system too without coding for this from ABAP side.
      This can be applicable in such cases where one is using some legacy application for calling any transaction in SAP and getting the response in the form of MMS.

      Good job puru…….keep it up