cancel
Showing results for 
Search instead for 
Did you mean: 

how to display data in table

Former Member
0 Kudos

Hi all,

I am creating an application for Equipment Master....and first time using to display data in table......i have taken node from dictionary structures

DATA lo_nd_co_rmclf TYPE REF TO if_wd_context_node.

DATA lo_el_co_rmclf TYPE REF TO if_wd_context_element.

DATA ls_co_rmclf TYPE wd_this->Element_co_rmclf.

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

lo_nd_co_rmclf = wd_context->get_child_node( name = wd_this->wdctx_co_rmclf ).

  • get element via lead selection

lo_el_co_rmclf = lo_nd_co_rmclf->get_element( ).

  • get all declared attributes

lo_el_co_rmclf->get_static_attributes(

IMPORTING

static_attributes = ls_co_rmclf ).

DATA lo_nd_co_mwert TYPE REF TO if_wd_context_node.

DATA lo_el_co_mwert TYPE REF TO if_wd_context_element.

DATA ls_co_mwert TYPE wd_this->Element_co_mwert.

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

lo_nd_co_mwert = wd_context->get_child_node( name = wd_this->wdctx_co_mwert ).

  • get element via lead selection

lo_el_co_mwert = lo_nd_co_mwert->get_element( ).

  • get all declared attributes

lo_el_co_mwert->get_static_attributes(

IMPORTING

static_attributes = ls_co_mwert ).

data: ls_klah type klah . ******I think here i am doing something wrong....how to declare this in proper way

select single KSCHL from SWOR

into corresponding fields of ls_co_rmclf

where CLINT = ls_klah-CLINT . ****here when i hardcoded the value of CLINT....it is displaying....

lo_el_co_rmclf->set_attribute(

name = `KSCHL`

value = ls_co_rmclf-KSCHL ).

Thanks

Kiran

Accepted Solutions (1)

Accepted Solutions (1)

gill367
Active Contributor
0 Kudos

I guess you are looking for this.

DATA lo_nd_co_rmclf TYPE REF TO if_wd_context_node.

DATA lo_el_co_rmclf TYPE REF TO if_wd_context_element.
DATA ls_co_rmclf TYPE wd_this->Element_co_rmclf.

DATA lt_co_rmclf TYPE wd_this->Elements_co_rmclf.                                            "added line

 navigate from <CONTEXT> to <CO_RMCLF> via lead selection
lo_nd_co_rmclf = wd_context->get_child_node( name = wd_this->wdctx_co_rmclf ).

* get element via lead selection
lo_el_co_rmclf = lo_nd_co_rmclf->get_element( ).


* get all declared attributes
lo_el_co_rmclf->get_static_attributes(
IMPORTING
static_attributes = ls_co_rmclf ).

DATA lo_nd_co_mwert TYPE REF TO if_wd_context_node.

DATA lo_el_co_mwert TYPE REF TO if_wd_context_element.
DATA ls_co_mwert TYPE wd_this->Element_co_mwert.

* navigate from <CONTEXT> to <CO_MWERT> via lead selection
lo_nd_co_mwert = wd_context->get_child_node( name = wd_this->wdctx_co_mwert ).

* get element via lead selection
lo_el_co_mwert = lo_nd_co_mwert->get_element( ).


* get all declared attributes
lo_el_co_mwert->get_static_attributes(
IMPORTING
static_attributes = ls_co_mwert ).

data: lt_klah type standard table of klah . ******I think here i am doing something wrong....how to declare this in proper way
data ls_klah type klah.

select * from klah into lt_klah.

loop at lt_klah into ls_klah.


select single KSCHL from SWOR
into corresponding fields of ls_co_rmclf
where CLINT = ls_klah-CLINT . ****here when i hardcoded the value of CLINT....it is displaying.... 

append ls_co_rmclf to lt_co_rmclf .

endloop.


lo_nd_co_rmclf ->bind_table( lt_co_rmclf ).

this code will fethc all the clint and class values and then using the query fetch all the values from swor table and put it in one table.

and bind that table to node.

thanks

sarbjeet singh

Former Member
0 Kudos

Thanks Sarbjeet

Answers (2)

Answers (2)

gill367
Active Contributor
0 Kudos

What exactly is the problem that you are facing.

i am not able to understand.

r u facing any probelm in displaying a node's data in table.

for that bind the table to the node using bind_table method.

so first fill the table with data then bind it to the node to display the same data in UI table.

thanks

sarbjeet singh

Former Member
0 Kudos

Hello Sarbjeet,

When i am passing the input that is not coming in this structure ls_klah...i m using this input in below query:

data:ls_klah type klah.

select single KSCHL from SWOR

into corresponding fields of ls_co_rmclf

where CLINT = ls_klah-CLINT .

Thanks

Kiran

gill367
Active Contributor
0 Kudos

>

> Hello Sarbjeet,

>

> When i am passing the input that is not coming in this structure ls_klah...i m using this input in below query:

>

> data:ls_klah type klah.

>

> select single KSCHL from SWOR

> into corresponding fields of ls_co_rmclf

> where CLINT = ls_klah-CLINT .

>

> Thanks

> Kiran

Hi

you mean to say that you have some input field on the screen where you will give value of clint.

if that is the case then you need to first fetch the value and then use it in the select query.

get_attribute methos you need to use if that is the case.

thanks

sabjeet singh

Former Member
0 Kudos

HI ,

Where are you supposed to get the value of ls_klah-CLINT from?

Because , If what you have posted is the only code , then ls_klah is initial i guess...

Thanks,

Aditya.

Former Member
0 Kudos

Hello Sarbjeet,

By this i am getting the values when i harcoded CLASS.But i need to pass all values as u said....can you pls tell me how to declare that....CLASS field is coming from KLAH table...i declared as ls_klah type KLAH....but i know i am not declaring it properly

select single s~KSCHL

into corresponding fields of ls_co_rmclf

from ( SWOR AS s INNER JOIN KLAH AS k

ON sCLINT = kCLINT

AND k~CLASS = 'ED111' ).

Thanks

Kiran

Former Member
0 Kudos

i Changed my query now i have to pass values for all class (just to chk my query i hardcoded...its working fine)..i don't know how declare that and pass here.CLASS field is from KLAH table.

select single s~KSCHL

into corresponding fields of ls_co_rmclf

from ( SWOR AS s INNER JOIN KLAH AS k

ON sCLINT = kCLINT

AND k~CLASS = 'ED111' ).

Thanks

Kiran

Former Member
0 Kudos

Hi Kiran ,

Create a variable of char40 and make it as the destination of the select query. (say the variable is lv_KSCHL).

Then code as follows ,

select single KSCHL from SWOR
into lv_KSCHL where CLINT = ls_klah-CLINT . ****here when i hardcoded the value of CLINT....it is displaying.... 


lo_el_co_rmclf->set_attribute(
name = `KSCHL`
value = lv_KSCHL ).

Thanks,

Aditya.

Former Member
0 Kudos

Hello Aditya,

That is not working...my exact prob is in passing i/p

When i am passing the input that is not coming in this structure ls_klah...i m using this input in below query:

data:ls_klah type klah.

select single KSCHL from SWOR

into corresponding fields of ls_co_rmclf

where CLINT = ls_klah-CLINT .

Thanks

Kiran

Edited by: kiran162 on Mar 7, 2011 7:57 AM