on 08-30-2007 9:24 AM
How to write multiple quries in WDDOINIT method .what i wrote is it worng.
where i am doing worng. please see the below code.
method WDDOINIT .
data:
node_sflight type ref to if_wd_context_node,
Itab_sflight type standard table of SFLIGHT.
Itab_sflight1 type standard table of SFLIGHT.
data: begin of i_spfli occurs 0,
carrid type spfli-carrid,
connid type spfli-connid,
end of i_spfli.
select carrid connid from SpFLI into table I_spfli.
select * from SFLIGHT into table Itab_sflight.
for all entries in I_spfli
where carrid = i_spfli-carrid
and connid = spfli-connid.
loop at I_spfli.
read table i_spfli with key carrid = Itab_sflight-carrid.
Itab_sflight = Itab_sflight1.
append Itab_sflight.
clear Itab_sflight.
endloop.
node_sflight = wd_context->get_child_node( name = 'NODE_SFLIGHT' ).
node_sflight->bind_table( itab_sflight ).
endmethod.
Thanks
rama
Firstly, WD is a OO Enviornmen. Though most of normal ABAP programing u can do in OO, you need to follow OO programing patterns really. Things like defining a TYPE when declaring a work area or internal table..... , Declaring a work area explicitly etc...
See my comments below..
Also you need to do this Business Logic ina external ASSISTANCE CLASS , not inside the component...this is bad design....You can create a Assistance Class as any class inheriting from CL_WD_COMPONENT_ASSISTANCE and give its name in the assistance class field , when u double click on the component.
> How to write multiple quries in WDDOINIT method .what
> i wrote is it worng.
> here i am doing worng. please see the below code.
>
> method WDDOINIT .
> data:
> node_sflight type ref to if_wd_context_node,
>
> Itab_sflight type standard table of SFLIGHT.
> Itab_sflight1 type standard table of SFLIGHT.
>
> data: begin of i_spfli occurs 0,
> carrid type spfli-carrid,
> connid type spfli-connid,
> end of i_spfli.
<b> types: begin of ty_spfli,
carrid type spfli-carrid,
connid type spfli-connid,
end of ty_spfli.
data wa_spfli type ty_spfli.
data i_spfli type standard table of ty_spfli.</b>
>
> Slect carrid connid from SpFLI into table I_spfli.
>
> select * from SFLIGHT into table Itab_sflight.
> for all entries in I_spfli
> where carrid = i_spfli-carrid
> and connid = spfli-connid.
>
<b> I am not sure what ur doing here in this next loop? You are appending itab_sflight but it already has data from above ? Also You need to Loop across itab_sflight to get a work area for ex: Itab_sflight-carrid</b>
> loop at I_spfli <b>into wa_spfli</b>.
> read table i_spfli with key carrid =
> Itab_sflight-carrid.
> Itab_sflight = Itab_sflight1.
> append Itab_sflight <b>to what ?.</b>
> clear Itab_sflight.
> endloop.
>
>
> node_sflight = wd_context->get_child_node( name =
> 'NODE_SFLIGHT' ).
> node_sflight->bind_table( itab_sflight ).
> endmethod.
>
>
>
>
> Thanks
> rama
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The l_spfli you have is a type definition. You should declare it as type:. And in your data declaration, have an internal table of type l_spfli.
That apart, do not code select queries or db access directly in the web dynpro component views. Have them as separate APIs.
Regards
Nithya
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
85 | |
10 | |
9 | |
9 | |
6 | |
6 | |
6 | |
5 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.