This Document would explain the required pre-requisites for capturing the weight of the Truck on the weighbridge via serial port (COMM1) from an ABAP program without involving the third party software. Step 1 : Register the Windows activeX control MSCOM32.OCX on the client PC where the Weighbridge's serial port is connected. Step 2: Implement this control in Transaction SOLE in SAP (Create an entry MSCOMMLIB.MSCOMM.1 and enter the CLSID. {648A5600-2C6E-101B-82B6-000000000014} Step 3 : Active this MSCOMM32.OCX with Licence Key on the client PC where the Weighbridge's serial port is connected. Open RUN execute: regedit Go to u201CHKEY_CLASSES_ROOT\Licenses\u201D Create new key (Folder) name with '4250E830-6AC2-11cf-8ADB-00AA00C00905' Give the default VALUE: kjljvjjjoquqmjjjvpqqkqmqykypoqjquoun Restart the system. Step 4: Copy MSCOMM32.OCX onto the local disk of the system in the path mentioned below
Copy The same file onto the following mentioned location as well :
By
Niroop Chintha
Step 5: Now Create the Function Module as shown below:
The Import parameters of the function module are shown below:
The Export parameters of the function module are shown below:
In the Import parameters we have to give the port settings which should be checked from the system on which the program is being run and to check the setting of the comport we have to goto MYCOMPUTER -->> DEVICE
By
Niroop Chintha
MANAGER -->> OPEN THE ‘PORTS(COM & LPT)’ NODE and right click on the port and choose properties which is shown in the below screen shot :
The Source Code For the Function Module is as follows : FUNCTION ZINMM_FM_WEIGHTBRIDGE. *"---------------------------------------------------------------------*"*"Local Interface: *" IMPORTING *" REFERENCE(MODE) TYPE I DEFAULT 0 *" REFERENCE(COMMPORT) TYPE I DEFAULT 1 *" REFERENCE(SETTINGS) TYPE C DEFAULT '9600,8,N,1' *" REFERENCE(OUTPUT) TYPE C *" EXPORTING *" REFERENCE(INPUT) TYPE C *"---------------------------------------------------------------------TYPE-POOLS: sabc. INCLUDE ole2incl. * checking whether the weighbridge is connected to the system or not PERFORM init. * opening the port PERFORM open_port USING commport settings. * reading the data from the port IF mode = 0. PERFORM read_port CHANGING input. ENDIF. * writing the data to the port IF mode = 1. PERFORM write_port USING output CHANGING input. ENDIF. * closing the port PERFORM final. ENDFUNCTION. DATA: o_obj TYPE ole2_object . *&--------------------------------------------------------------------*& Form Init *&-------------------------------------------------* text
By
Niroop Chintha
*---------------------------------------------------------------------* --> p1 text * 0.
By
Niroop Chintha
GET PROPERTY OF o_obj 'Input' = input. EXIT. ENDIF. ENDDO. * converting the value read from the port to numeric value***** input1 = input+5(5) . condense input1 . clear : input . input = input1. ENDFORM. *--------------------------------------------------------------------* 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 *
Thank you for interesting in our services. We are a non-profit group that run this website to share documents. We need your help to maintenance this website.