cancel
Showing results for 
Search instead for 
Did you mean: 

syntax error

Former Member
0 Kudos

Hi ,

I created one view having table which displays VBAK information.

for that

1) Create node( node_vbak) having table vbak under context of component controller

CONTEXT

NODE_VBAK (Node name)

vbeln

erdat

....

2) Created view (Main)

i) mapped component controller context to view controller context

II) Under Layout tab created table (Tableex )

III) Created context binding for table Tableex

iv) Under WDDOINIT Method

code written as

method wddoinit .

DATA lo_nd_node_vbak TYPE REF TO if_wd_context_node.

DATA lo_el_node_vbak TYPE REF TO if_wd_context_element.

DATA ls_node_vbak TYPE wd_this->element_node_vbak.

select * from vbak into corresponding fields of table ls_node_vbak.

  • navigate from <CONTEXT> to <NODE_VBAK> via lead selection

lo_nd_node_vbak = wd_context->get_child_node(

name = wd_this->wdctx_node_vbak ).

lo_nd_node_vbak->bind_table( ls_node_vbak ).

endmethod

I am getting error as

"LS_NODE_VBAK" is not an internal table "OCCURS n" specification is missing

if I change LS_node_vbak as

DATA ls_node_vbak TYPE standard table of vbak.

Then I am getting correct output.

Here my question.

DATA ls_node_vbak TYPE wd_this->element_node_vbak.

with this delclaration , I want to get the output

should I change any select statment.

Thanks,

Asha

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

hi

you change

DATA ls_node_vbak TYPE wd_this->element_node_vbak.

DATA ls_node_vbak TYPE wd_this->elements_node_vbak.

or

select * from vbak into corresponding fields ls_node_vbak.

endselect.

Answers (3)

Answers (3)

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

As a general rule of good programming technique you should never return data directly into data objects defined off of the generated Context structures. In your case wd_this->element_node_vbak. If the context definition changes, this can break your code. In your case you are using the structure element_node_vbak instead of the internal table elements_node_vbak - hence the error. Or you could have said DATA ls_node_vbak TYPE STANDARD TABLE OF wd_this->element_node_vbak.

Actually another rule of structure for Web Dynpro is that you should never have SELECT statements in your coding. You are violating MVC. You should only have select statements in the assistance class, another free form class, a service object, or some other form of model.

Former Member
0 Kudos

Please send a sample program,

Where should I want to declare select statments.

Thanks,

Asha

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

>

> Where should I want to declare select statments.

>

> Thanks,

> Asha

Frankly, anywhere except in the Web Dynpro Component itself. I personally like to use the Web Dynpro Assistance Class, but really it can be any ABAP class or function module.

This is taken right from the online Dos and Don't of Web Dynpro ABAP:

Write your application source code in ABAP OO classes. For example, use the assistance class.

Source: http://help.sap.com/saphelp_nw70ehp1/helpdata/en/5e/b29046859d48d68af26c16c75d4a89/frameset.htm

More details on an Assistance Class:

http://help.sap.com/saphelp_nw70ehp1/helpdata/en/43/1f6442a3d9e72ce10000000a1550b0/frameset.htm

pranav_nagpal2
Contributor
0 Kudos

Hi Asha,

I think problem is since your select statement is returning values which contains a mandt field as well and in yur node you dont have attribute for mandt field you are getting error.......

regards

Pranav

arjun_thakur
Active Contributor
0 Kudos

Hi Asha,

Refer to Alex Justin's reply in this [thread|].

I hope it helps.

Regards

Arjun