This was done a few years ago, has not wanted to share it, and then think in order to be able to give you some ideas, gave ...
This is a computer-readable method, the general use of Comm Port connection of electronic equipment can be referenced.
Online Search Mscomm32.ocx
1. Save the above mscomm32.ocx to the system directory C:\Windows\SysWOW64\MSCOMM32. Ocx
Then register: REGSVR32 C:\Windows\SysWOW64\MSCOMM32. Ocx
2. To modify the registry:
REGEDIT
Build an item under the hkey_classes_root\licenses:
4250e830-6ac2-11cf-8adb-00aa00c00905
Modifying numeric data: Kjljvjjjoquqmjjjvpqqkqmqykypoqjquoun
Restart your computer so that the Comm component will be able to use the
The above is the data configured on the PC.
Landing GUI
T-code:sole
New entry:
OLE application Mscommlib. Mscomm.1
Version number
Class Identity {648a5600-2c6e-101b-82b6-000000000014}
CLSID Library Type
OLE Object Name
Type Information key value
Include program
Language
Check Permissions
Text
FUNCTIONz_bc_get_balance.*"----------------------------------------------------------------------*"*" Local Interface:*"Importing*"REFERENCE (MODE) TYPE I DEFAULT 0*"REFERENCE (commport) TYPE I DEFAULT 1*"VALUE (SETTINGS) TYPE C DEFAULT ' 1200,n,8,1 '*"REFERENCE (i_input) TYPE C OPTIONAL*"Exporting*"REFERENCE (e_output) TYPE C*"EXCEPTIONS*"No_create_object*"---------------------------------------------------------------------- Type-pools: SABC. INCLUDEOle2incl. DATAPosTYPEi.CLEAR: Pos,balance,value,e_output. PERFORMPrm_get_settingschangingsettings.*WAIT up to 3 SECONDS. PERFORMPrm_init. PERFORMPrm_open_portUSINGcommport settings. IFmode =0."Read serial data PERFORMPrm_read_portchangingE_output. ELSEIFmode =1."Write serial data PERFORMPrm_write_portUSINGI_inputchangingE_output. ENDIF. PERFORMprm_final. SEARCHBalance for '+'. IFSY-SUBRC =0. POS= sy-Fdpos. SHIFTBalance by(POS +1) PLACES. ENDIF. SEARCHBalance for 'g'. IFSY-SUBRC =0. POS= sy-Fdpos. Balance= balance+0(POS). CondenseBalance no-gaps. E_output=balance. ENDIF. COMMIT Workendfunctionthis block is for configuring the interface type module (self-built table with IP address to configure the corresponding Comm Port parameters)*****************************************************************************FORMPrm_get_settingschangingp_settings. DATAAddrTYPEni_nodeaddr. CLEARaddr. Pager FUNCTION 'Th_user_info' ImportingAddrstr=addr. SELECT SingleSetting intoP_settings fromZbctaddrWHEREAddr =addr. IFSY-SUBRC =0. CLEARaddr. ENDIF.EndForm."prm_get_settingsInitializing interface Objects******************************************************************************FORMPrm_init. DATA: Wa_repid likesy-Repid. CLEARWa_repid. Wa_repid= sy-Repid. Pager FUNCTION 'Authority_check_ole' Exporting Program=wa_repid Activity=Sabc_act_call Application='Mscommlib. Mscomm.1' EXCEPTIONSno_authority=1Activity_unknown=2OTHERS=3. IFSY-SUBRC <>0. MESSAGE IDSy-msgidTYPESy-msgty Numbersy-Msgno withSy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4. ENDIF. CREATE OBJECTO_obj'mscommlib.mscomm.1'. IFSY-SUBRC <>0. RAISENo_create_object. ENDIF.EndForm."Prm_initInterface Open***************************************************************************FORMPrm_open_portUSINGcommport settings. SET Property ofO_obj'Commport'=Commport. SET Property ofO_obj'Settings'=settings. SET Property ofO_obj'Inputlen'=0. SET Property ofO_obj'PortOpen'=1.EndForm."Prm_open_portread interface data: Because the interface has a cache, each time the read is stripped of the first 20 of the data and every time the data read is not complete, so you need to connect multiple read data, and then intercept****************************************************************************FORMPrm_read_portchangingE_output. DATA: Wa_bufferTYPEI, IndeTYPEi. Do - Times. Inde= Inde +1. GET Property ofO_obj'InBufferCount'=Wa_buffer. IFWa_buffer >0. GET Property ofO_obj'Input'=E_output. IFInde < -. ELSE. concatenateBalance E_output intobalance. ENDIF. ENDIF. Enddo. CLEAR: Wa_buffer,inde.EndForm."Prm_read_portwrite the data to the serial port, because there is no need, so no test.*********************************************************************FORMPrm_write_portUSINGI_inputchangingE_output. DATA: Wa_bufferTYPEi.SET Property ofO_obj'Output'=I_input. Do + Times. GET Property ofO_obj'InBufferCount'=Wa_buffer. IFWa_buffer >0. GET Property ofO_obj'Input'=E_output. EXIT. ENDIF. Enddo.EndForm."Prm_write_portend of Reading, closing the serial port, releasing the object, emptying the variable************************************************************************FORMprm_final. SET Property ofO_obj'PortOpen'=0. Free OBJECTO_obj. CLEARO_obj. COMMIT Work.EndForm."prm_final
SAP Connect Computer serial reading (electronic weigh, pound and other data read)