Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Serial COMM Port input value contains questions marks

Former Member
0 Kudos

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.

5 REPLIES 5

Sandra_Rossi
Active Contributor
0 Kudos

Did you try DATA wa_buffer(60) TYPE x ? Which hexadecimal value do you get?

Former Member
0 Kudos

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.

Sandra_Rossi
Active Contributor
0 Kudos
Oh sorry. Mistake. Try with DATA input(60) TYPE x only. Let wa_buffer being of type I (integer) and rename it by the way to "buffer_length" for clarification.

Former Member
0 Kudos

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.

Former Member

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.