Diego
Diego

Reputation: 133

Field "REF" is unknown in ADBC statement

I'm having trouble using ABDC.

This is the code I am trying to run:

DATA:
      gr_sql_result_set TYPE REF TO cl_sql_result_set,
      gr_sql_statement  TYPE REF TO cl_sql_statement.

START-OF-SELECTION.

  CREATE OBJECT gr_sql_statement.

  gr_sql_result_set = gr_sql_statement->execute_query( 'SELECT VBELN ERDAT ERNAM AUDAT VKORG FROM VBAK' ).
  gr_sql_result_set->set_param_table( itab_ref = REF # ( gt_orders_head ) ).

The problem lies in gr_sql_result_set->set_param_table. The REF # statement gives me the following error: Field "REF" is unknown. It is neither in one of the specified tables nor defined by a "DATA" statement.

Is it possibile that I don't have the right version of SAP-ABAP installed which supports this statement?

Note: gt_orders_head is defined as gt_orders_head TYPE TABLE OF zordhead_str. zordhead_str is a structure that I defined/created in Transaction S11.


I'm currently using SAP_BASIS Release 731


Upvotes: 2

Views: 696

Answers (1)

Philipp
Philipp

Reputation: 69663

The constructor expressions like REF require SAP_BASIS 7.40 or later. So you can not use them in your 7.31 system until you update.

In the meantime you will have to work with a temporary reference variable instead:

DATA gt_order_head_ref LIKE REF TO gt_orders_head.
GET REFERENCE OF gt_orders_head INTO gt_order_head_ref.
gr_sql_result_set->set_param_table( itab_ref = gt_order_head_ref ).

Upvotes: 3

Related Questions