Skip to Content
0

Serial COMM Port input value contains questions marks

Sep 11, 2017 at 02:37 AM

84

avatar image
Former Member

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.

10 |10000 characters needed characters left characters exceeded

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

0
Former Member

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.

0
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.
0
Former Member

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.

0
* Please Login or Register to Answer, Follow or Comment.

1 Answer

avatar image
Former Member Sep 28, 2017 at 02:46 AM
1

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.

Share
10 |10000 characters needed characters left characters exceeded