Buffer parameter definition in interface method

Posted by alex.wiese.pulse on 07-May-2018 18:30

The following class compiles successfully:

CLASS Test:

DEFINE TEMP-TABLE ttTest
FIELD id AS INTEGER
FIELD NAME AS CHARACTER.

METHOD PUBLIC VOID TestMethod( BUFFER p-ttTest FOR ttTest ):

UNDO, THROW NEW Progress.Lang.AppError("METHOD NOT IMPLEMENTED").

END METHOD.

END CLASS.

If I try to define an interface for this class I get this error (on the METHOD line).

"Only datasets, temp-tables, and properties may be defined in an interface. (13149)"

INTERFACE SkuUnit.ITest:


DEFINE TEMP-TABLE ttTest
FIELD id AS INTEGER
FIELD NAME AS CHARACTER.

METHOD PUBLIC VOID TestMethod(BUFFER p-ttTest FOR ttTest).

END INTERFACE.

Removing the parameter allows it to compile successfully.

How can I define an interface method that matches this class?

Posted by Evan Bleicher on 08-May-2018 10:31

As Peter noted you can use a TABLE parameter (to pass the complete temp-table) or a HANDLE parameter for a buffer.  The challenge with using a TABLE parameter is that you will be passing more data than you may want to pass and the challenge with using a HANDLE for a buffer is that the method will need to use dynamic programming to access the information.

The issue you have raised is a limitation with the implementation of interfaces.  I have added this issue to the Language team’s backlog.

Please note, that if you did not want to enforce the method signature via an Interface, the existing method syntax does support passing a buffer. This limitation exists with the ABL’s ability to enforce the method signature via interfaces.

All Replies

Posted by Peter Judge on 08-May-2018 08:08

You may have to use either a TABLE parameter or a HANDLE for a buffer.
 

Posted by Evan Bleicher on 08-May-2018 10:31

As Peter noted you can use a TABLE parameter (to pass the complete temp-table) or a HANDLE parameter for a buffer.  The challenge with using a TABLE parameter is that you will be passing more data than you may want to pass and the challenge with using a HANDLE for a buffer is that the method will need to use dynamic programming to access the information.

The issue you have raised is a limitation with the implementation of interfaces.  I have added this issue to the Language team’s backlog.

Please note, that if you did not want to enforce the method signature via an Interface, the existing method syntax does support passing a buffer. This limitation exists with the ABL’s ability to enforce the method signature via interfaces.

Posted by slegian-bva on 03-Dec-2019 22:12

Dec 2019 and 12.1 gives the same compile error. How is that backlog going?

This thread is closed