‎2010 Aug 22 1:21 AM
Hi experts,
We are trying to read data from the serial port with the following function we got from internet.
The problem is when creating the object with the sentence CREATE OBJECT o_obj '"MSCOMMLib.MSComm.1"'.
This returns a sy-subrc = 2 and shows the exception NO_CREATE_OBJECT.
We already copied the file MSCOMM32.OCX in c:\windows\system32 and we successfuly registered it, with regsvr32.exe.
We tried it with Windows XP and Vista.
Anybody has any idea?
Thanks in advance
FUNCTION ZSERIALCOM.
*"----
""Interfase local
*" IMPORTING
*" REFERENCE(MODE) TYPE I DEFAULT 0
*" REFERENCE(COMMPORT) TYPE I DEFAULT 1
*" REFERENCE(SETTINGS) TYPE C DEFAULT '2400,N,8,1'
*" REFERENCE(OUTPUT) TYPE C OPTIONAL
*" EXPORTING
*" REFERENCE(INPUT) TYPE C
*" EXCEPTIONS
*" NO_CREATE_OBJECT
*"----
TYPE-POOLS: sabc.
INCLUDE ole2incl.
PERFORM init.
PERFORM open_port USING commport settings.
IF mode = 0.
PERFORM read_port
CHANGING input.
ENDIF.
IF mode = 1.
PERFORM write_port
USING output
CHANGING input.
ENDIF.
PERFORM final.
ENDFUNCTION.
DATA: o_obj TYPE ole2_object.
&----
*& Form Init
&----
text
----
--> p1 text
<-- p2 text
----
FORM init.
DATA:
wa_repid LIKE sy-repid.
wa_repid = sy-repid.
CALL FUNCTION 'AUTHORITY_CHECK_OLE'
EXPORTING
program = wa_repid
activity = sabc_act_call
application = 'MSCOMMLib.MSComm.1'
EXCEPTIONS
no_authority = 1
activity_unknown = 2
OTHERS = 3.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
CREATE OBJECT o_obj '"MSCOMMLib.MSComm.1"'.
IF sy-subrc <> 0.
RAISE no_create_object.
ENDIF.
ENDFORM. " Init
----
FORM open_port *
----
........ *
----
--> COMMPORT *
--> SETTINGS *
----
FORM open_port USING commport settings.
SET PROPERTY OF o_obj 'CommPort' = commport.
SET PROPERTY OF o_obj 'Settings' = settings.
SET PROPERTY OF o_obj 'InputLen' = 0.
SET PROPERTY OF o_obj 'PortOpen' = 1.
ENDFORM. "open_port
----
FORM read_port *
----
........ *
----
--> INPUT *
----
FORM read_port
CHANGING input.
DATA:
wa_buffer TYPE i.
DO 10 TIMES.
GET PROPERTY OF o_obj 'InBufferCount' = wa_buffer.
IF wa_buffer > 0.
GET PROPERTY OF o_obj 'Input' = input.
EXIT.
ENDIF.
ENDDO.
ENDFORM. " read_port
----
FORM write_port *
----
........ *
----
--> OUTPUT *
----
FORM write_port
USING output
CHANGING input.
DATA:
wa_buffer TYPE i.
SET PROPERTY OF o_obj 'Output' = output.
DO 10 TIMES.
GET PROPERTY OF o_obj 'InBufferCount' = wa_buffer.
IF wa_buffer > 0.
GET PROPERTY OF o_obj 'Input' = input.
EXIT.
ENDIF.
ENDDO.
ENDFORM.
&----
*& Form final
&----
text
----
--> p1 text
<-- p2 text
----
FORM final.
SET PROPERTY OF o_obj 'PortOpen' = 0.
FREE OBJECT o_obj.
ENDFORM. " finalbligw
‎2011 Mar 04 10:36 AM
‎2011 Mar 24 2:18 PM
hey,
i'm having the same problem, did you found any solution?
Thanks
‎2011 Apr 14 4:31 PM
HI kholoud.
Can use a program developed in Java or .net to read a serial port.
After you should use SAP Connectors to send information between this program and SAP.
Java Connector-> http://help.sap.com/saphelp_nw70ehp1/helpdata/en/b4/3f9e64bff38c4f9a19635f57eb4248/frameset.htm
.NET Connector-> http://help.sap.com/saphelp_nw70ehp1/helpdata/en/fe/37c22b75e6154e8c67917bed8c70df/frameset.htm
Regards,
Manuel H.
‎2012 Nov 17 7:49 AM
Dear Friend,
The problem is when creating the object with the sentence CREATE OBJECT o_obj '"MSCOMMLib.MSComm.1"'.
This returns a sy-subrc = 2 and shows the exception NO_CREATE_OBJECT.
How did you find the solution of the problem
Thanks
Sohail
‎2012 Nov 17 7:50 AM
Dear Friend,
The problem is when creating the object with the sentence CREATE OBJECT o_obj '"MSCOMMLib.MSComm.1"'.
This returns a sy-subrc = 2 and shows the exception NO_CREATE_OBJECT.
How did you find the solution of the problem
Thanks
Sohail
‎2011 Apr 18 10:57 AM
Hi,
I was worked with is FM
this FM worked below Conditions Only
1. MSCOMM32.OCX file Copy to user system " C:\Windows\System\" or system32
if u r working with 64 bit OS you paste it in WOW32 folder
2. execute regsvr32 MSCOMM32.OCX it given Successfully registered Message box
3.Now Active this MSCOMM32.OCX with Licence Key is like
- Open RUN execute : regedit
- Goo u201CHKEY_CLASSES_ROOT\Licenses\u201D
- create new key (Folder) name with '4250E830-6AC2-11cf-8ADB-00AA00C00905'
- Give the default VALUE: kjljvjjjoquqmjjjvpqqkqmqykypoqjquoun
4 Restart The System
Then Run Your FM it works when Serial port Have the data
Regard's
Vijay Reddy.G
‎2013 May 27 8:31 AM
Hello,
i am working on same object.I usethe same thing.I am not getting errors but not getting values either.
Intel(R) ICH10D LPC Interface Controller - 3A1A this is the COMM port driver.I have one doubt
(SETTINGS) TYPE C DEFAULT '2400,N,8,1'these values change.Please lte me know.
Thanks in advance.
‎2015 Jun 15 12:22 PM
Hi,
Please let me know how you resolved this issue , I am also getting sy-subrc = 2, while creating object.
Thanks
Vipin
‎2011 Apr 18 10:58 AM
Hi,
I was worked with is FM
this FM worked below Conditions Only
1. MSCOMM32.OCX file Copy to user system " C:\Windows\System\" or system32
if u r working with 64 bit OS you paste it in WOW32 folder
2. execute regsvr32 MSCOMM32.OCX it given Successfully registered Message box
3.Now Active this MSCOMM32.OCX with Licence Key is like
- Open RUN execute : regedit
- Goo u201CHKEY_CLASSES_ROOT\Licenses\u201D
- create new key (Folder) name with '4250E830-6AC2-11cf-8ADB-00AA00C00905'
- Give the default VALUE: kjljvjjjoquqmjjjvpqqkqmqykypoqjquoun
4 Restart The System
Then Run Your FM it works when Serial port Have the data
Regard's
Vijay Reddy.G
‎2011 Aug 02 11:54 PM
Dear Vijay,
registration worked perfect!
fm works great just trying to see how I can make it wait for data and then report back
Frans
‎2013 May 27 8:33 AM
Hello,
i am working on same object.I usethe same thing.I am not getting errors but not getting values either.
Intel(R) ICH10D LPC Interface Controller - 3A1A this is the COMM port driver.I have one doubt
(SETTINGS) TYPE C DEFAULT '2400,N,8,1'these values change.Please lte me know.
Thanks in advance.
‎2013 May 27 8:36 AM
Hello,
i am working on same object.I usethe same thing.I am not getting errors but not getting values either.
Intel(R) ICH10D LPC Interface Controller - 3A1A this is the COMM port driver.I have one doubt
(SETTINGS) TYPE C DEFAULT '2400,N,8,1'these values change.Please lte me know.
Thanks in advance.
‎2013 May 27 10:18 AM
Hello,
i am working on same object.I usethe same thing.I am not getting errors but not getting values either.
Intel(R) ICH10D LPC Interface Controller - 3A1A this is the COMM port driver.I have one doubt
(SETTINGS) TYPE C DEFAULT '2400,N,8,1'these values change.Please lte me know.
Thanks in advance
‎2013 May 30 10:38 AM
Hello everybody,
I have worked according the following link http://scn.sap.com/thread/1688977
But in program SET PROPERTY OF o_obj 'PortOpen' = 1. I am getting sy-subrc = 3.I have all ports open.firewall Off.I am using COMM1 port.
passed following parameters 9600,N,8,1.Please let me guide from here.urgent.
Thanks in advance.
Sridhar.
‎2014 Dec 15 11:54 AM
Hi ,
I want to read value form weigh bridge through COMM port. I have developed the FM and done the setting as mentioned in the below link
Read COMM port using ABAP w/o third party software
but while executing the FM independently I am able to get the value from the COMM port,but when I call the FM from a program I am not able to get the output value from the FM.I am calling the FM from the report program.please find the code below.
report test.
data : lv_input TYPE c.
CALL FUNCTION 'ZFM_WEIGHINTERFACE'
EXPORTING
MODE = 0
COMMPORT = 1
SETTINGS = '1200,N,8,1'
OUTPUT = ''
IMPORTING
INPUT = lv_input
EXCEPTIONS
NO_CREATE_OBJECT = 1
OTHERS = 2
.
IF SY-SUBRC <> 0.
* Implement suitable error handling here
ENDIF.
if I execute the FM independently the output is getting perfectly.but while calling from a program i am facing the issue..
any suggestion is appreciated.
Thanks
Vivek
‎2012 Nov 17 7:48 AM
Dear Friend,
The problem is when creating the object with the sentence CREATE OBJECT o_obj '"MSCOMMLib.MSComm.1"'.
This returns a sy-subrc = 2 and shows the exception NO_CREATE_OBJECT.
How did you find the solution of the problem
Thanks
Sohail
‎2013 May 30 10:38 AM
Hello everybody,
I have worked according the following link http://scn.sap.com/thread/1688977
But in program SET PROPERTY OF o_obj 'PortOpen' = 1. I am getting sy-subrc = 3.I have all ports open.firewall Off.I am using COMM1 port.
passed following parameters 9600,N,8,1.Please let me guide from here.urgent.
Thanks in advance.
Sridhar.
‎2013 Jul 29 4:55 PM
Hi,
I tried the same way as mentioned here. Everything works ok, but it is not returning any data. The FM returns nothing.Please help.
regards,
Thamil.
‎2013 Nov 09 7:29 AM
‎2014 Dec 15 10:14 AM
Hi
I have developed the FM and done the settings as per the below link
when I executed the FM independently I was able to get the weight from the weigh bridge,but when I use the FM in my program I am not able to get the value from the weighbridge.the value is coming as blank.any suggestion is appreciated ..
thanks
Vivek
‎2014 Dec 15 12:30 PM
Hello Fabian,
Apparently you can't even create the OLE object in your program,
Have u added following line in transaction SOLE first ? :
MSCOMMLIB.MSCOMM.1 {648A5600-2C6E-101B-82B6-000000000014}
I've used OLE object for serial communication in one of my projects ..
and it's working succesfully.
I can help for further,
‎2015 Jun 15 12:24 PM
Hello Bulent,
Can you help me I am getting same issue as above while creating Object of MSCOMMLIB.MSCOMM.1 Sy-subrc = 2.
‎2021 Jan 04 7:24 AM
Yes, I gor sy-subrc = 2 due to I just copied the OLE Application
MSCOMMLIB.MSCOMM.1 {648A5600-2C6E-101B-82B6-000000000014}
where by mistakeMSCOMMLIB.MSCOMM.1 " {648A5600-2C6E-101B-82B6-000000000014" stored instead of
MSCOMMLIB.MSCOMM.1 {648A5600-2C6E-101B-82B6-000000000014}.
So please recheck all settings maintained in
https://blogs.sap.com/2013/07/10/read-comm-port-using-abap-wo-third-party-software/
It will definitely work.
I reach till I could created OLE object but not able to read data. Anybody has solution? Please help.
‎2015 Jul 01 8:14 AM
Hi Fabian,
First you should maintain MSCOMM.OCX file in Windows -> system and system32 in client PC then u should done your step for registration with regsvr32.exe, after done your registration we need to active MSCOMM.OCX (which program ID is MSCOMMLib.MSCOMM.1) from ActiveX compatibility manager software (Download form internet).
Once you will done all step we hope you can read date from serial port
Recently we have done one project to get date from serial port to SAP with help of MSCOMMLib.MSCOMM.1
Note : Client PC must have VB enviroment and you must maintained CLSID : {648A5600-2C6E-101B-82B6-000000000014} in ole application T-code SOLE to get data from comm prot to SAP table.
Warm Regards
Ghanshyam Acharya
‎2019 Oct 28 1:44 AM
Do you know the the settings needed in SALE which columns needed to be filled and with what value? maybe I'm missing something.