cancel
Showing results for 
Search instead for 
Did you mean: 

display data from diferent tables

Former Member
0 Kudos

My requirement is to display data from diferent tables supose tables likeVBAK and VBAP.it will allow for all entries concept oops abap?.

how to write code for display data from diferent tables .

method WDDOINIT.

data:

node_sflight type ref to if_wd_context_node,

Itab_sflight type standard table of SFLIGHT.

select * from SFLIGHT into table Itab_sflight.

node_sflight = wd_context->get_child_node( name = 'SFLIGHT_NODE' ).

node_sflight->bind_table( itab_sflight ).

endmethod.

Thanks,

Rama

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

HI,

IS IT CORRECT WAY OF DONIG CODING?

IF I AM WORNG PLEASE SUGEST ME.

method WDDOINIT.

data:

node_sflight type ref to if_wd_context_node,

final type standard table of vbap.

types: begin of t_vbak,

vbeln type vbak-vbeln,

end of t_vbak.

endmethod.

data wa_vbak type t_vbak.

data i_vbak type standard table of t_vbak.

types: begin of t_vbap,

vbeln type vbap-vbeln,

posnr type vbap-posnr,

matnr type vbap-matnr,

end of t_vbap.

data wa_vbap type t_vbap.

data i_vbap type standard table of t_vbap.

select vbeln from vbak into table I_vbak.

select vbeln posnr matnr from vbap into table I_vbap

for all entries in I_vbak

where vbeln = i_vbak-vbeln.

loop at I_vbak.

read table i_vbap with key vbeln = I_vbak-vbeln.

final-vbeln = I_vbap-vbeln.

final-posnr = I_vbap-posnr .

final-matnr = I_vbap-matnr .

append final.

clear final.

endloop.

node_sflight = wd_context->get_child_node( name = 'NODE_VBAP' ).

node_sflight->bind_table( final ).

endmethod.

Thanks,

rama

Former Member
0 Kudos

is it correct code below?

method WDDOINIT .

data:

node_sflight type ref to if_wd_context_node,

Itab_vbak type standard table of vbak.

Itab_vbap type standard table of vbap.

data: begin of i_vbak occurs 0,

vbeln type vbak-vbeln,

end of i_vbak.

select vbeln from vbak into table I_vbak.

select vbeln posnr matnr from vbap into table Itab_vbap.

for all entries in I_vbak

where vbeln = i_vbak-vbeln

loop at I_vbak.

read table i_vbap with key vbeln = Itab_vbak-vbeln.

final-vbeln = Itab_vbak-vbeln.

final-posnr = Itab_vbak-posnr .

final-matnr = Itab_vbak-matnr .

append final.

clear final.

endloop.

node_sflight = wd_context->get_child_node( name = 'NODE_SFLIGHT' ).

node_sflight->bind_table( final ).

endmethod.

thanks,

Rama

Former Member
0 Kudos

Hi Mutyapu Naveen,

i need to get data from vbak- vbeln

based on that vbeln i need to get posnr and matnr from table vbap.

my finall out put is vbak-vbeln

vbap-posnr and vbap-matnr.

please guide me how to do code.

Thanks,

Rama

Former Member
0 Kudos

Hi Ram.

Depends on your process. But if you simply want to display all items of an order

you only need a table of type vbak, because vbak contains vbeln.

So create a context node of type vbak and add all fields.

Question is where you get the vbeln from? I consider it is user input.

So in the corresponding action handler just select all itenms from vbka with the given vbeln

and then call node->bind_table( lt_vbak ) or similar.

Just depends on where you get the vbeln.

Cheers,

Sascha

Former Member
0 Kudos

Hi Ram,

For Display data from multiple tables You need to create two different Nodes for VBAK and VBAP in the CONTEXT level and select fields for Nodes which are necessary from the dictionary Structure.

After that You have to bind the fields to the UI Elements either Table Structure or Separate Filed's.

Have u done this process.

Then U need to follow CLL their only u need to write the code which will increase the Performance.

Don't use direct SQL Statements [select * from SFLIGHT into table Itab_sflight.]

in INIT method.

Write in reply exactly what you have done and what u need to DO.

<i>Provide me Points, If it is helpful to you......</i>

Regards,

<b>Mutyapu Naveen</b>