Skip to Content
Author's profile photo Praveer Kumar Sen

Let’s chat…

                                                                /wp-content/uploads/2015/08/scn_771986.jpg

Hi,

Everyday we are using lot’s of application to sharing our information (personal, professional..etc). But what about business information, our work information, process information, yes information, it could be any type of. let’s take an example, some time a end user has to inform another business user related to created document, then he makes call or mail to deliver the same.

Here i have made a simple program is a kind of chat program, where a user can see who all are logged in system and also send a message to them instantly and make a conversation without make any call or mail.

yes, for the privacy, the program is storing every chat information in customize table for later use.

In below steps, i have explain logic and steps.

    Initial Screen:

I made initial screen size same as other chat application.

                                                  chat.JPG

In above screen, two users are logged in. In this screen i have use CL_GUI_TIMER class and it’s check the online user information every second.(interval value set in class attributes), The login chat screen will only refresh, if any new user found or vise versa.

If any new user logged in or any user left the system. respective user information will add or remove from the above screen.

Means, the above screen will only provide the logged / online users or bookmarked users.

In login exit, a logic has been maintained to check the user is already using the chat program or not, or if any reason user’s SAPGUI crashed. the old login information will be deleted from customize table.

Exit Information: SUSR0001 [User exit after logon to SAP System].

attached code in ZXUSRU01.txt

Make the first chat:

To do chat with user, select the any user from above chat screen.

After select an user, a chat screen will open.

              chat screen.JPG

Selected user name will be the title of the screen, as display in above screen. (i have selected Rohan Sen).

To send message the selected user, enters the respective text in open text window.

              enter.JPG

After press ‘ENTER’ button. System will check for the selected user is logged-in or not  and chat screen is open or not.

If chat screen is not open for the selected user. A pop-message will open to selected user screen as below.

              popmsg.JPG

Used Function Module: TH_POPUP


Else message will be store in maintained table.


After executing the chat t-code, user will get initial screen (as above), but though user has received a message from user, then blue chat /wp-content/uploads/2015/08/chat_out_775842.pngicon will be displaying at the place of yellow chat icon, as below screen.


Suppose user is not online, then all received message will be store in maintained table and while login into the system, a pop-up message box will appear as below screen, which will have message sender and date information.

                    message receive.JPG

User can only send message to off-line users if they have bookmarked.

Message Received

When both users are using application and sharing information the view will be as below.

    chat start.jpg

It’s same like other chat screen, user enters will be at the right side of the chat screen and receiver enters will be at the left side. (as above).

with other necessary information like time and date.

Here if date is current date, then it will display as “today”.

One more tool has provided to see the earlier conversation.

          erlier conversation.JPG

By clicking the above button, the very next day available conversation will be display in chat screen as below.

            earlier load.JPG

If you see, the conversation details are more, so automatic a scroll bar will be appear (as above screen in red area), which is very thin and only display when user scroll the screen.

even only the current conversation will display in screen, mean scroll will always be on the bottom of chat screen.

Technical Information:

Though all solution is depends on HTML, CSS and java script, some additional installation requires from the SAPGUI, Local system side.

1. SAPGUI Installation, Please find below screen about SAPGUI.

              SAPGUI.JPG

    For more information, please go through with below discussion.

    https://scn.sap.com/thread/3782213

2. Java Script setting, internally SAP used IE in CL_GUI_HTML_VIEWER class, to make available java script functionality enable setting in IE.

    IE setting.JPG

    IE-Setting->Advance Tab


3. MIME setting

          Created a new folder inside SAP->PUBLIC->SAP_CHAT and imported jpg & png file from attached zip file.



All respective programs, include and class are in attached zip in below google drive link for further analysis.

SAP Communicator

Program Name : zcommunication

Class Name    : zcl_communication

Tables Name  : zcom_books (bookmark information)

                        zcom_run    (Communicator execution information)

                        zcommun    (Current Communication Information)

                        zcommun_his (Communicator history)

attached Nugget File in above link

.

File Name: NUGG_ZCOMM.nugg

Note: The application made in SAP Netweaver 740 Version.

New version link with some more advance option to make communication better way.

SAP Communicator 2.0 Part 1


SAP Communicator 2.0 Part 2


Thanks & Regards,

Praveer


Assigned Tags

      32 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Praveen Kumar
      Praveen Kumar

      HI Praveen,

      very well  .

      but i didn't find clear picture of codes in SAP Communicator.

      any other place where i can find the detail codes for the same.

      Thanks.

      Author's profile photo Praveer Kumar Sen
      Praveer Kumar Sen
      Blog Post Author

      Hi Praveen,

      You will get the all code file in a attachment.(ZIP file) in SAP Communicator.

      Regards,

      Praveer.

      Author's profile photo Former Member
      Former Member

      Hi,

      It is better if you create Nugget file for the same.So that we just import that .nugg file and start using it.

      Thanks

      KH

      Author's profile photo Praveer Kumar Sen
      Praveer Kumar Sen
      Blog Post Author

      Hi Katrice,

      I have attached the Nugget file in given link.

      regards,

      Praveer

      Author's profile photo Praveen Kumar
      Praveen Kumar

      Hi Praveen,

      error in

      zcl_communication

      The statement 'PROTECTED SECTION.' is unexpected.

      thanks

      .
      Author's profile photo Former Member
      Former Member

      hi ,

      can you help in sap hana..............?

      Author's profile photo Chetan Bhole
      Chetan Bhole

      Hi Praveer

      where is the attachment

      for program code.

      Author's profile photo Praveer Kumar Sen
      Praveer Kumar Sen
      Blog Post Author

      it's in Google drive.

      Link : "SAP Communicator".

      Regards,

      Praveer.

      Author's profile photo Tee Gee
      Tee Gee

      Hi Praveen,

      The nugget file creates only the program Zcommunication, can you please provide the nugget with the class,method and tables.

      Author's profile photo Praveer Kumar Sen
      Praveer Kumar Sen
      Blog Post Author

      Sure, i will check and update into the file.

      Regards,

      Praveer.

      Author's profile photo Tee Gee
      Tee Gee

      Sorry for the typo with your name.

      Its Praveer.

      Author's profile photo Raphael Pacheco
      Raphael Pacheco

      Hi Praveen,

      You have already submitted this your creation to the Idea Place? It would be interesting that you send your ideas there. 🙂


      Warm regards,


      Raphael Pacheco.

      Author's profile photo Praveer Kumar Sen
      Praveer Kumar Sen
      Blog Post Author

      Thanks Raphael, i will make this place there...

      Author's profile photo Raphael Pacheco
      Raphael Pacheco

      Here the link: Idea Place: Enterprise Home 🙂

      Author's profile photo Former Member
      Former Member

      Hi Praveen,


      Great Job !...


      The nugget file creates only the program Zcommunication and ZCL class,

      Could you please provide the nugget with the class,method and tables !.



      I have one question :


      Suppose, in DEV, one ID is using by many people ,, that time how it works ?



      Thanks in Advance.

      Author's profile photo Praveer Kumar Sen
      Praveer Kumar Sen
      Blog Post Author

      Hi Mahen,

      I assume, in PRD one user one user id.

      but for the safe side in this program, suppose a user is using this  t-code and in same time other user logged with same id and try to execute the t-code, he will receive an error message like 'Chat system is already executing'.

      I have checked this in SUSR0001 enhancement point.

      I will provide the code for the same..and update the nugget file.

      Regards,

      Praveer.

      Author's profile photo Former Member
      Former Member

      Hi Praveer,

      Can we do it based on TERMINAL ?

      My thought is, instead of giving it to USERS,

      SAP TEAM, CAN CHAT EASILY.

      Thanks in advance.

      Author's profile photo Praveer Kumar Sen
      Praveer Kumar Sen
      Blog Post Author

      Yes you can, you have to change the logic based on COMPUTERNAME or IP Address of user system.

      You can use

      CL_GUI_FRONTEND_SERVICES->GET_IP_ADDRESS

      CL_GUI_FRONTEND_SERVICES->GET_COMPUTER_NAME methods to get the information.

      or through terminal information

      User TERMINAL_ID_GET FM.

      and based on that, you can change the logic.

      Regards,

      Praveer.

      Author's profile photo Praveer Kumar Sen
      Praveer Kumar Sen
      Blog Post Author

      Hi All,

      I have attached the respective class nugget file and user exit SUSR0001 (User exit after logon to SAP System) codes.

      Regards,

      Praveer.

      Author's profile photo Former Member
      Former Member

      Hi,

      Pls attach the latest nugget file here with all tables used in program because when i try to activate the class ZCL_COMMUNICATION, i'm getting below error.

      .

      Capture.JPG

      Capture1.JPG

      Any how i can able to activate the class and program.But when i try to execute the program : ZCOMMUNICATION, it is showing blank screen.Do i need to add any table entries?

      Capture.JPG

      Thanks

      KH

      Author's profile photo Praveer Kumar Sen
      Praveer Kumar Sen
      Blog Post Author

      Hi Katrice,

      zcommun  table information in zcommun  folder in SAP Communicator link. check the SAP Communication zip file.

      even i have given the all image files, upload those into SAP->PUBLIC->SAP_CHAT MIME folder.

      for better display you have to update current patch level of SAPGUI.

      regards,

      Praveer.

      Author's profile photo Former Member
      Former Member

      Hi,

      The opponent is not able to get the message.Do i need to change any settings?

      Thanks

      KH

      Author's profile photo Praveer Kumar Sen
      Praveer Kumar Sen
      Blog Post Author

      No, through the timer logic, 1st and 2nd screen will handle the all chat sequence for the opponent.

      Create a number range named 'ZCOMMU' with year check.

      use ZCOMM_ID domain for the number range, refer COMID field from zcommun table.

      Regards,

      Praveer.

      Author's profile photo Former Member
      Former Member

      Hi,

      The opponent is not able to get the message.Do i need to change any settings?

      Thanks

      KH

      Author's profile photo Tee Gee
      Tee Gee

      The partner is not getting the messages.

      are there any settings ?

      Author's profile photo Praveer Kumar Sen
      Praveer Kumar Sen
      Blog Post Author

      Have you created Number range?

      There is no extra setting, all logic works through timer logic, where ZCOMMUN will contains the send item information, once the opponent execute the t-code the same information will shift to ZCOMMUN_HIS table and clear from the ZCOMMUN table.

      Regards,

      Praveer.

      Author's profile photo Former Member
      Former Member

      Hi, you forgot to mention about number range object.

      Thanks

      KH

      Author's profile photo Tanmay Verma
      Tanmay Verma

      Hi Praveer,

      Really a great application. I also had thought to build similar application using the FM TH_POPUP but didn't had idea about the other classes used in this application.

      This is a really helpful document for others trying to achieve something similar.

      Regards,

      Tanmay.

      Author's profile photo Praveer Kumar Sen
      Praveer Kumar Sen
      Blog Post Author

      Thanks Tanmay.

      Author's profile photo pankaj dewangan
      pankaj dewangan

      NIce initiative

      Author's profile photo Kripa Rangachari
      Kripa Rangachari

      Its Interesting 🙂

      Cheers,

      Kripa Rangachari.

      Author's profile photo Saifur Rahman
      Saifur Rahman

      Hi Praveer.

       

      I need your help

      How to create a new folder inside SAP->PUBLIC->SAP_CHAT and imported jpg & png file from attached zip file.