Skip to Content


Playing With ActiveX in ABAP


Introduction:

In this document i will show you how to access your webcam in ABAP CFW via ActiveX controls and I will give you idea how to play with ActiveX .

Requirement:

Access Webcam/media player or any thing in ABAP via ActiveX .

I’d seen some issue How to CALL WEBCAM in SAP and decided to write a document.


Issue:

customer wants everything on ABAP screen not 3rd party eg. – 1) On security gate they want capture visitors photo but only ABAP screen

                                                                                                                                2) In Weighment system access/read COM port data but via ABAP only

                                                                                                                                3) RDP server get connected client IP

some times just for playing with ABAP means media player and other .


Solution:


1) You can create your own ActiveX control in VB6.0 , VB.net / C# – ActiveX – Wikipedia, the free encyclopedia

or download free available ActiveX .


2) Register it via Regsvr32 [/u] [/s] <OCX File Name>

3) Create your proxy class for our ActiveX control by inheriting CFW class CL_GUI_CONTROL and access methods.

4) Create your ABAP program and use your class and show your activeX

For understanding whole process please read blog by Thomas JungUsing Classic ActiveX Controls in the ABAP Cont… | SCN

Example:

Access Webcam in ABAP –


1) (due to some company policy restriction) Here for ActiveX i’m gonna used already developed activeX  – Video Capture ActiveX SDK | VideoCap SDK ActiveX  – just download and install it even you don’t need to register it.


2) Create your Proxy class ycl_gui_webcamdownload it from My GitHub


Class.JPG



3) Create your program ygui_webcam download it from My GitHub


Program.JPG


Download – Aashish28/ABAP · GitHub


Run your program –


webcam.JPG


Just Try It and Enjoy

You can also try it with your Media Player

Media.jpg


To report this post you need to login first.

14 Comments

You must be Logged on to comment or reply to a post.

    1. ASHISH AHIRE Post author

      @Ravi – you’r most welcome …. 🙂   i’d learned many things from SCN and still learning 😉 …and this time try to share my knowledge 🙂  

      (0) 
  1. siva vempati

    Thanks a lot Ashish.

    This is exactly the requirement we are looking at now.

    If i may ask, currently to view the Web-Cam in legacy (they are using VB), i.e. they have an IP address which they give “hardcode” and see the view.

    We are able to see the view by giving that IP, example SAPHTML_DEMO1 prog…

    Is there an option, to pass the IP to active X and view the Webcam?

    Kindly suggest?

    And to take a snap shot i guess this would suffice.

    Do we need to register? meaning do we need need to go for liscensing if we take this approach of ActiveX.

    Your inputs would be of great help.

    (0) 
    1. ASHISH AHIRE Post author

      Hi @siva ,

                       As i understand you want to access your remote location webcam which is IP based via ActiveX control ??

      If yes – than for passing ip and access webcam you need your own activeX ( create it in VB6.0 or C# or any language ) if you want to avoid licencing issue . from SAP point of view you don’t need any licence , in my above example i used just demo licence for Videocap activeX i thing if you want to use same than you need licence.

      in my actual system i’d created my own for avoiding licencing issue 🙂

      BR,

      Ashish

      (0) 
      1. siva vempati

        Hi Ashish,

        Great! Thanks a lot for your inputs.

        Yes, you are right, i want to access a remote location webcam which is IP based via activeX control and take a snap-shot of the same when clicked on Capture.

        Would you be able to suggest how to create ActiveX in VB6.0 (i have no idea on VB6.0) and using the same in our ABAP/ system. Any example that you may give for understanding.

        FYI, in current environment they are using VB to show the webcam & capture the Image, but now we need to do this in ABAP.

        one more question as we are discussing, is there a way to show a portion of the browser in the custom controlller via ActiveX, i.e. instead of showing the entire view of IP (which is webcam plus some buttons), can we show only a part of the browser (only the view).

        For Example: take youtube page as the entire browser / page, if we would want to show only the vedio portion in the contained (html view container, for example), instead of the entire browser.

        in my understanding, in VB, they have this option to display a portion of the browser (only the View that is needed) and are able to capture the image.

        And further reduce the size of the captured image to put in the desired size / window of the Layout (smartform).

        Your inputs would be a great help.

        Best Regards, Siva

        (0) 
        1. siva vempati

          Hi Ashish,

          I tried your example & It works, thanks a ton.

          Yes, now the question remains how to create similar activex. your suggestion would help.

          I also noticed, there is IP Camera “ipcam.exe” in “VideoCap ActiveX Control”.

          is there a way i can find out the methor and properties of the same to invoke / use the control.

          thank you.

          Best Regards, Siva

          (0) 
          1. ASHISH AHIRE Post author

            Hi @siva – Yes this activeX will work with IP camera also – methods are –

            1) short StartIPCamera(

                            BSTR strURL,

                            BSTR strUserID,

                            BSTR strPassword);

            2) void StopIPCamera();

            You can use help file which is located in your installation folder

            C:\Program Files\VideoCap ActiveX Control\HELP\videocapactivex.chm

            help.JPG

            BR

            Ashish

            (0) 
            1. siva vempati

              Thanks a lotAshish.

              I tried using this method, passing the Url, uid & pwd, unfortunately the webcam does not appear.

              Strange thing is, when i set property ‘CaptureMode’ as 0 (false) and call method ‘StartIPCamera’. the SAP screen

              gets logged off, i.e. automatically closes off. completly signs me off. (No dump).

              & when set property ‘CaptureMode’ as 1 (Ture) , the screen stays , but no visual.

                  CALL METHOD me->set_property
                    EXPORTING
                      property = ‘CaptureMode’                        
                      value    = 1.

                  CALL METHOD me->call_method
                    EXPORTING
                      method  = ‘StartIPCamera’
                      p1 = ‘url’
                      p2      =  “‘usrid’
                      p3      =  “‘pwd’
                      p_count = 3.

              I have also tried to follow the help given in Help text… i.e.. To only display the image…

              Somehow …it does not work….

              No success!! 🙁

              ———————– start snippet from help given

              How to capture your IP cam with VideoCap
              ActiveX 

              First you need know the URL of actual MJPEG stream for your IP cam. Normally
              if you can access your IP cam with http://www.yourwebsite.com:portNumber/CgiStart?page=Single&Language=0
              But this URL is not actual MJPEG stream, Please open CHROME browser , enter URL of
              your IP CAM, do not use IE or FireFox. You may use CHROME browser
              only.
              e.g.
              http://www.yourwebsite.com:portNumber/CgiStart?page=Single&Language=0

              Then input your user name and password. Now you should enter the control panel and
              see the video of your IP cam.

              On the Video image, right click and it has
              a option called “copy image URL”. Then you can get the URL of actual
              MJPEG stream.

              ——————————————— end of snippet from help given

              I am able to open the webcam via the URL in browser.
              I am not sure what is causing the issue…
              I also tried to set the properties “show preview”, “capture vedio” etc…

              @Ashish,

              I have few more questions, if you may give some inputs please. (if you have something in mind).

              1) how do we get to know the Class id for our ActiveX control?

              Example:

              wf_clsid = ‘{AA408ECC-E50B-401F-8036-021E81B9E5A1}’.

              Just in case, i need to use some other activeX that i may find in Google & download a demo version.

              is there a

              And also you have set property “lisence….”, but i dont see this property in help.

              is this to be passed irrespective? just to know if i download any other activeX and try to use this activeX

              Sorry for so many questions, just trying to share the output as i thought, you should have done a lot of analysis

              from your end while trying to build the example.

              Yup, one more thing, when i directly exectue the “ipcam.exe”, it gives me error, .”General network error.”

              Where as when i execute “VCCamerControl.exe”, its same as “Webcam”.

              Is the classid different for this exe?

              Can you suggest on how we capture the result (return value) from ActiveX, i.e. when we call the Webcam/ methods,

              there are some “return values” sent back by call_method (in few cases).
              I tried to create a return value of type any and try to capture the value in importing ….
              But it dumps….

              I appreciate your support.

              Best Regards, Siva

              (0) 
              1. ASHISH AHIRE Post author

                Hi @siva – Actually I don’t have remote location webcam 🙁 but i know after setting property call below method on button event – than you can access your webcam –

                CALL METHOD me->call_method

                      EXPORTING

                        method  = ‘StartIPCamera’

                        p1 = ‘url’

                        p2      =  “‘usrid’

                        p3      =  “‘pwd’

                        p_count = 3.

                you can access any ActiveX classid , methods ,property via ole viewer or other tools are also available . you can use only available input and output of methods of ActiveX if you want according to your choice you can also create your own ActiveX their are lots of tutorial available and you can do it 🙂

                i usually create my own because of licencing and same issue which you are facing 😉


                BR

                Ashish

                (0) 
                1. siva vempati

                  Hi Ashish,

                  Thanks a lot for your support & inputs.

                  Sorry for a delayed response.

                  Yes, i tried as above, but i am unable to view the Webcam.

                  I also have reached out (via email) to “Support Team” of this product that we downloaded (demo version) seeking their support, as it seems to be not working.

                  I tried executing the “Exe” file directly as well, by giving the IP of Image (as suggested in help). gives the same error.

                  They asked me for a Web-cam with Public IP, for them to analyse. I provided them the details (URL with public ip that has camera, User id & Password). Still waiting for their analysis.

                  If you would want to try, i can provide you with URL, Uid & Pwd.

                  The same IP camera can be seen via Browser, but not via Exe the downloaded demo version.

                  I do not have VB / VB.net skills to create the ActiveX for the same. Else i should i have tried to create an ActiveX of my own.

                  In the legacy they use VB to capture this Image of Webcam, using a picture image etc…

                  Please let me know if you want to give it a try, i can provide you with public ip with IP camera in a seperate e-mail (to your personal email id), i.e. as you seem to know VB, you may even try to create your own activeX to find a solution for this. 🙂

                  Thanks a lot for your support.

                  Regards, Siva

                  (0) 
                  1. ASHISH AHIRE Post author

                    Hi siva,

                                you can view my email id in my profile section send me your public ip ,username and password , let me check firstly with VideoCap otherwise if possible i’ll provide you activeX for webcam.

                    BR

                    Ashish

                    (0) 

Leave a Reply