Hello everyone, i'm a completely newbie at OOABL.

I want to know how to read/looping a set of records from a class method that returns a temp-table as handle.

This is my GetUsers method into my UserClass:

CLASS classes.UserClass:

    /*------------------------------ Definitions ---------------------------------*/

    DEFINE STATIC TEMP-TABLE ttUser

        FIELD b2b_id  AS INTEGER

        FIELD b2b_username  AS CHARACTER

        FIELD b2b_password  AS CHARACTER

        FIELD b2b_role      AS CHARACTER

        FIELD b2b_domain    AS CHARACTER.

    DEFINE DATASET dsUser FOR ttUser.

    DEFINE DATA-SOURCE srcUser FOR b2b.b2b_users.

    DEFINE PRIVATE STATIC BUFFER bUser FOR ttUser.

    DEFINE QUERY qUser FOR ttUser.

/*------------------------------------------------------------------------------

Purpose:   

Notes:   

------------------------------------------------------------------------------*/

CONSTRUCTOR PUBLIC UserClass (  ):

   

    BUFFER ttUser:ATTACH-DATA-SOURCE (DATA-SOURCE srcUser:HANDLE ).

        DATASET dsUser:FILL ().   /* All 18 Employees */

        OPEN QUERY qUser PRESELECT EACH ttUser.

END CONSTRUCTOR.

METHOD PUBLIC HANDLE GetUsers( INPUT pcFilter AS LONGCHAR ):

        DEFINE VARIABLE hQuery    AS HANDLE NO-UNDO.

        hQuery = QUERY qUser:HANDLE.

       

        IF pcFilter <> "" THEN

        DO:

            pcFilter = " WHERE " + STRING(pcFilter).

        END.

       

        hQuery:QUERY-PREPARE("FOR EACH b2b.b2b_users" + STRING(pcFilter)).

        hQuery:QUERY-OPEN ().

        hQuery:GET-FIRST ().

        DO WHILE NOT hQuery:QUERY-OFF-END:

            CREATE ttUser.

            BUFFER-COPY b2b.b2b_users TO ttUser.

            hQuery:GET-NEXT ().

        END.  

        hQuery:QUERY-CLOSE ().

        RETURN TEMP-TABLE ttUser:HANDLE.


END METHOD.

DESTRUCTOR PUBLIC UserClass ( ):

        CLOSE QUERY qUser.

        EMPTY TEMP-TABLE ttUser.

END DESTRUCTOR.


END CLASS.

From a CGI-WRAPPER, I want to run this method, assign to a handle variable that stores the temp-table and loop through the records and finally show the field values  with {&OUT} expression.


How to make this ?