cancel
Showing results for 
Search instead for 
Did you mean: 

Error in module RSQL of the database interface.

former_member295881
Contributor
0 Kudos

Hello Experts,

I'm new to Web Dynpro and trying to develop an application. It seems like there is something wrong with SELECT statement, however, I can't what's the issue. Can somebody see what's wrong with it? For reference here is my code.

*************************************************************************************************************************

* create where condition
if not stru_node_vbak-vbeln eq ''.
concatenate 'VBELN = ''' stru_node_vbak-vbeln '''' into ls_where.
append ls_where to lt_where.
endif.

if not stru_node_vbak-erdat eq '00000000'.
concatenate 'ERDAT = ''' stru_node_vbak-erdat '''' into ls_where.
if stru_node_vbak-vbeln ne ''.
concatenate 'AND' ls_where into ls_where separated by space.
endif.
append ls_where to lt_where.
endif.


select vbeln erdat erzet audat vbtyp auart augru
from vbak into table lt_vbak where (lt_where).

*************************************************************************************************************************

Attached is output on browser.

Many thanks in advance.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

The problem must be with the dynamic formation of the select statement. Try the below code hope it would help you.

data : lv_condition type string.

* create where condition

if stru_node_vbak-vbeln is NOT INITIAL.

   CONCATENATE lv_condition 'and vbeln = stru_node_vbak-vbeln'  INTO lv_condition.
endif.

if stru_node_vbak-erdat IS NOT INITIAL.
   CONCATENATE lv_condition 'and erdat = stru_node_vbak-erdat' INTO lv_condition SEPARATED BY space.
endif.

if lv_condition is NOT INITIAL.
   lv_condition = lv_condition+4.
   select vbeln erdat erzet audat vbtyp auart augru
          from vbak
          into table lt_vbak
          where (lv_condition).
endif.

Best Regards ,

Arun K

former_member295881
Contributor
0 Kudos

Many thanks for your input Arun,

I re-wrote the code as follows and it resolved my issue.

DATA: node_node_vbak           TYPE REF TO if_wd_context_node,
         elem_node_vbak            TYPE REF TO if_wd_context_element,
         node_node_alv               TYPE REF TO if_wd_context_node,
         stru_node_vbak              TYPE wd_this->element_node_vbak,
         stru_node_alv                 TYPE wd_this->element_node_alv,
         lt_vbak                           TYPE STANDARD TABLE OF vbak.

* navigate from <CONTEXT> to <NODE_VBAK> via lead selection
   node_node_vbak = wd_context->get_child_node( name = if_input_view=>wdctx_node_vbak ).

* get element via lead selection
   elem_node_vbak = node_node_vbak->get_element).

* get all declared attributes
   elem_node_vbak->get_static_attributes(
     IMPORTING
       static_attributes = stru_node_vbak ).

   SELECT *
      FROM VBAK
        INTO CORRESPONDING FIELDS OF TABLE lt_vbak
          WHERE vbeln EQ stru_node_vbak-vbeln
            or  erdat eq stru_node_vbak-erdat.


   node_node_alv = wd_context->get_child_node( name = wd_this->wdctx_node_alv ).
   node_node_alv->bind_table( lt_vbak ).

Answers (1)

Answers (1)

Former Member
0 Kudos

U might have given VBAK as dictionary structure at the node.

Remove Dictionary Structure assignment at node NODE_VBAK properties.

Thanks,

Mahendra K.