09-11-2017 3:37 AM
Dear all,
We have a requirement to interface SAP with a weighbridge connected to a PC through a COMM Port.
I've been able to setup the COMM port reading in a function module like described in the following thread: https://archive.sap.com/discussions/thread/1688977
However I'm not able to understand the value retrieved from the serial port. It contains a lot of questions marks whereas in VBA it doesn't.
Example of value read from the following code:
GET PROPERTY OF o_obj 'InBufferCount' = wa_buffer.
IF wa_buffer > 0.
GET PROPERTY OF o_obj 'Input' = input.
ENDIF.
ABAP input value ==> 0? ?58?0? ? ?0???0? ?58?0
VBA input value ==> 10 20580 00
The weight is measured by the scale is 20580 kg.
Do you have any any why do I get a string with question marks in it? Is it a problem of variable type?
My input variable is a type C.
Thank you for your help.
09-11-2017 7:26 AM
Did you try DATA wa_buffer(60) TYPE x ? Which hexadecimal value do you get?
09-11-2017 12:48 PM
I just tried with :
DATA wa_buffer(60) TYPE x.
DATA input(60) TYPE x.
GET PROPERTY OF o_obj 'InBufferCount' = wa_buffer.
IF wa_buffer > 0.
GET PROPERTY OF o_obj 'Input' = input.
But I do not get anything in the input variable. It stays empty.
09-12-2017 8:35 AM
09-12-2017 8:56 AM
Yes I also tried it like you said because otherwise it wouldn't go in the IF statement. So I try with wa_buffer TYPE i but same issue.
The variable input stays empty.
09-28-2017 3:46 AM
Thank you for your help. The issue was actually not an ABAP issue but an MSCOMM setting one.
I had to use the attribute ParityReplace as follows:
SET PROPERTY OF o_obj 'ParityReplace' = ''.
With that I don't get any question marks so I can read the weight from the weighbridge.