Skip to Content
avatar image
Former Member

Serial COMM Port input value contains questions marks

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.

Add comment
10|10000 characters needed characters exceeded

  • 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.

  • 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

    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.

  • Get RSS Feed

1 Answer

  • avatar image
    Former Member
    Sep 28, 2017 at 02: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.

    Add comment
    10|10000 characters needed characters exceeded