cancel
Showing results for 
Search instead for 
Did you mean: 

ho to fetch thedata from multiple database table and display it in browser in tabular format

Former Member
0 Kudos

Dear Exports

Now I am  working with a ABAP webdynpro comonent related to Sales Registry. Here I have 3 select option fields which are VBRK-VBELN, VBRK-FKART and VBRK-FKDAT. When I will put the input inthis 3 fields in next screen a table will be display which contain the fields of VBRK, VBRP,KNA1, KONV, T006 and a ztable . ztable-vbeln=vbrk-vbeln, vbrp-vbeln=vbrk-vbeln,konv-knumv=vbrk-knumv,t006-msehi=vbrp-msehi. this is the contion for fetching the data from the respective table. but my problem is I am able to fetch the data only from the VBRK table not from others. Because I have created a single node(node_VBRK) whose attributes are the fields of VBRK table.And in layout of the view I have created a table ui element and bind it to that context node(node_VBRK).But if i will create another node (node_vbrp), then in layout i need to create anothe table ui element for this context node. But my result screen contains a single table will all the fields from all the 6 tables.So I am not able to do it.Can anyone please guide me how to solve this problem.How to bind multiple context node with a single table ui element. Please any can help. this is a orgent one for me. because i have spent 8 days for this application. But till now i am not getting the result. Please help me.

Regards

Rashmita

7829797165  

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Rashmita ...

create a context wich containing all the required fields ..

then create a table ui element nd bind this context witht table...

finally follow ur abap logic it will definitely..

the same requirement i did with 3 tables .

Thanks And Regards

Lokesh

Former Member
0 Kudos

Thanks a lot for your valuable answer. Today i have done according to your steps. Then when I wrote the select query to fatch the data "

SELECT * INTO CORRESPONDING FIELDS OF TABLE isvbrk FROM zsales_struct1 WHERE VBELN in <fs_vbeln>
   
and FKART in <fs_fkart> and FKDAT in <fs_fkdat>."

one dump arised that

where zsales_struct1 is the structure which contains the field of VBRK,VBRP,KNA1, KNUV,T006 and a ztable. Iwill put the detail screenshot below.Kindly tell me where is the error.

1. My component name is ZSALES_REPORT .

2. Created 2 components using the tab use component for the webdynpro component.

3. Then I created a context node(SALES_NODE) in component controller of type zsales_struct1 which i have created in data dictionary for storing all the table fields with cardinality 0:n.

4.then map the context from component controller context to interface controller DATA node.

5. then mapped the context from component controller to context of view controller. In layout tab of view created 2 view container ui elemnt ,1 search button and a table and bind that table to context node(SALES_node).

6.Then go to the property tab of view (MAIN) and create controllers for the component using create icon.Then go to attribute tab of MAIN view and create two attribute like m_handler Ref to if_wd_select_options and m_wd_select_options ref to IWCI_WDR_select_options.

7.then on the method wd_doinit I wrote the following code:

data lo_cmp_usage type ref to if_wd_component_usage.
     lo_cmp_usage
=   wd_this->wd_cpuse_select_opt( ).


 
if lo_cmp_usage->has_active_component( ) is initial.
    lo_cmp_usage
->create_component( ).
 
endif.

Now save and check the method.

Again click on method ONACTIONCONTINUE and put the following codes

DATA: node_sale TYPE REF TO if_wd_context_node.

 
TYPES: BEGIN OF STRUCT_SALE,
        FKART
TYPE ZSALES_STRUCT-FKART,
        BE_NO
TYPE ZSALES_STRUCT-BE_NO,
        BE_DATE
TYPE ZSALES_STRUCT-BE_DATE,
        UNIT_NAME
TYPE ZSALES_STRUCT-UNIT_NAME,
        VBELN
TYPE ZSALES_STRUCT-VBELN,
        FKDAT
TYPE ZSALES_STRUCT-FKDAT,
        KUNNR
TYPE ZSALES_STRUCT-KUNNR,
        STRAS
TYPE ZSALES_STRUCT-STRAS,
        REGIO
TYPE ZSALES_STRUCT-REGIO,
        PSTLZ
TYPE ZSALES_STRUCT-PSTLZ,
        INCO1
TYPE ZSALES_STRUCT-INCO1,
        ARKTX
TYPE ZSALES_STRUCT-ARKTX,
        FKIMG
TYPE ZSALES_STRUCT-FKIMG,
        MEINS
TYPE ZSALES_STRUCT-MEINS,
        CST_DTY
TYPE ZSALES_STRUCT-CST_DTY,
        NETWR
TYPE ZSALES_STRUCT-NETWR,
        VAT
TYPE ZSALES_STRUCT-VAT,
        CST
TYPE ZSALES_STRUCT-CST,
        TCS
TYPE ZSALES_STRUCT-TCS,
        AS_VALUE
TYPE ZSALES_STRUCT-AS_VALUE,
        TR_CHLN_NO
TYPE ZSALES_STRUCT-TR_CHLN_NO,
        TR_CHLN_DATE
TYPE ZSALES_STRUCT-TR_CHLN_DATE,
        TOT_INV_AMT
TYPE ZSALES_STRUCT-TOT_INV_AMT,
     
END OF STRUCT_SALE.



 
DATA: rt_vbeln TYPE REF TO data.
 
DATA: rt_fkart TYPE REF TO data.
 
DATA: rt_fkdat TYPE REF TO data.

 
DATA :isvbrk TYPE STANDARD TABLE OF STRUCT_SALE,
        wsvbrk
LIKE LINE OF isvbrk.

 
FIELD-SYMBOLS: <fs_vbeln> TYPE table,
                 <fs_fkart>
TYPE table,
                 <fs_fkdat>
TYPE table.

 


 

  rt_vbeln = wd_this->m_handler->get_range_table_of_sel_field(
  i_id
= 'VBELN_VF' ).

  ASSIGN rt_vbeln->* to <fs_vbeln>.

  rt_fkart
= wd_this->m_handler->get_range_table_of_sel_field(
  i_id
= 'FKART' ).
 
ASSIGN rt_fkart->* to <fs_fkart>.

  rt_fkdat
= wd_this->m_handler->get_range_table_of_sel_field(
  i_id
= 'FKDAT' ).
 
ASSIGN rt_fkdat->* to <fs_fkdat>.

 
CLEAR isvbrk.
 
REFRESH isvbrk.

= wd_this->m_handler->get_range_table_of_sel_field(
  i_id
= 'VBELN_VF' ). 

  SELECT * INTO CORRESPONDING FIELDS OF TABLE isvbrk FROM zsales_struct1 WHERE VBELN in <fs_vbeln>
   
and FKART in <fs_fkart> and FKDAT in <fs_fkdat>.

node_sale = wd_context->get_child_node( name = 'SALES_NODE') .
  node_sale
->bind_elements( isvbrk ).
endmethod.

If I will put ZSALES_TABLE which is a line type table of the structure ZSALES_STRUCT1 same dump will arised that not defined in dictionary.

Kindly help me. I have in deadline condition. PLease help me.

regards

Rashmita

Former Member
0 Kudos

thanks a lot for your valuable answer. Today i have done according to your steps. Then when I wrote the select query to fatch the data "

SELECT * INTO CORRESPONDING FIELDS OF TABLE isvbrk FROM zsales_struct1 WHERE VBELN in <fs_vbeln>
   
and FKART in <fs_fkart> and FKDAT in <fs_fkdat>."

one dump arised that

where zsales_struct1 is the structure which contains the field of VBRK,VBRP,KNA1, KNUV,T006 and a ztable. Iwill put the detail screenshot below.Kindly tell me where is the error.

1. My component name is ZSALES_REPORT .

2. Created 2 components using the tab use component for the webdynpro component.

3. Then I created a context node(SALES_NODE) in component controller of type zsales_struct1 which i have created in data dictionary for storing all the table fields with cardinality 0:n.

4.then map the context from component controller context to interface controller DATA node.

5. then mapped the context from component controller to context of view controller. In layout tab of view created 2 view container ui elemnt ,1 search button and a table and bind that table to context node(SALES_node).

6.Then go to the property tab of view (MAIN) and create controllers for the component using create icon.Then go to attribute tab of MAIN view and create two attribute like m_handler Ref to if_wd_select_options and m_wd_select_options ref to IWCI_WDR_select_options.

7.then on the method wd_doinit I wrote the following code:

data lo_cmp_usage type ref to if_wd_component_usage.
     lo_cmp_usage
=   wd_this->wd_cpuse_select_opt( ).


 
if lo_cmp_usage->has_active_component( ) is initial.
    lo_cmp_usage
->create_component( ).
 
endif.

Now save and check the method.

Again click on method ONACTIONCONTINUE and put the following codes

DATA: node_sale TYPE REF TO if_wd_context_node.

 
TYPES: BEGIN OF STRUCT_SALE,
        FKART
TYPE ZSALES_STRUCT-FKART,
        BE_NO
TYPE ZSALES_STRUCT-BE_NO,
        BE_DATE
TYPE ZSALES_STRUCT-BE_DATE,
        UNIT_NAME
TYPE ZSALES_STRUCT-UNIT_NAME,
        VBELN
TYPE ZSALES_STRUCT-VBELN,
        FKDAT
TYPE ZSALES_STRUCT-FKDAT,
        KUNNR
TYPE ZSALES_STRUCT-KUNNR,
        STRAS
TYPE ZSALES_STRUCT-STRAS,
        REGIO
TYPE ZSALES_STRUCT-REGIO,
        PSTLZ
TYPE ZSALES_STRUCT-PSTLZ,
        INCO1
TYPE ZSALES_STRUCT-INCO1,
        ARKTX
TYPE ZSALES_STRUCT-ARKTX,
        FKIMG
TYPE ZSALES_STRUCT-FKIMG,
        MEINS
TYPE ZSALES_STRUCT-MEINS,
        CST_DTY
TYPE ZSALES_STRUCT-CST_DTY,
        NETWR
TYPE ZSALES_STRUCT-NETWR,
        VAT
TYPE ZSALES_STRUCT-VAT,
        CST
TYPE ZSALES_STRUCT-CST,
        TCS
TYPE ZSALES_STRUCT-TCS,
        AS_VALUE
TYPE ZSALES_STRUCT-AS_VALUE,
        TR_CHLN_NO
TYPE ZSALES_STRUCT-TR_CHLN_NO,
        TR_CHLN_DATE
TYPE ZSALES_STRUCT-TR_CHLN_DATE,
        TOT_INV_AMT
TYPE ZSALES_STRUCT-TOT_INV_AMT,
     
END OF STRUCT_SALE.



 
DATA: rt_vbeln TYPE REF TO data.
 
DATA: rt_fkart TYPE REF TO data.
 
DATA: rt_fkdat TYPE REF TO data.

 
DATA :isvbrk TYPE STANDARD TABLE OF STRUCT_SALE,
        wsvbrk
LIKE LINE OF isvbrk.

 
FIELD-SYMBOLS: <fs_vbeln> TYPE table,
                 <fs_fkart>
TYPE table,
                 <fs_fkdat>
TYPE table.

 


 

  rt_vbeln = wd_this->m_handler->get_range_table_of_sel_field(
  i_id
= 'VBELN_VF' ).

  ASSIGN rt_vbeln->* to <fs_vbeln>.

  rt_fkart
= wd_this->m_handler->get_range_table_of_sel_field(
  i_id
= 'FKART' ).
 
ASSIGN rt_fkart->* to <fs_fkart>.

  rt_fkdat
= wd_this->m_handler->get_range_table_of_sel_field(
  i_id
= 'FKDAT' ).
 
ASSIGN rt_fkdat->* to <fs_fkdat>.

 
CLEAR isvbrk.
 
REFRESH isvbrk.

= wd_this->m_handler->get_range_table_of_sel_field(
  i_id
= 'VBELN_VF' ). 

  SELECT * INTO CORRESPONDING FIELDS OF TABLE isvbrk FROM zsales_struct1 WHERE VBELN in <fs_vbeln>
   
and FKART in <fs_fkart> and FKDAT in <fs_fkdat>.

node_sale = wd_context->get_child_node( name = 'SALES_NODE') .
  node_sale
->bind_elements( isvbrk ).
endmethod.

If I will put ZSALES_TABLE which is a line type table of the structure ZSALES_STRUCT1 same dump will arised that not defined in dictionary.

Kindly help me. I have in deadline condition. PLease help me.

regards

Rashmita

Answers (3)

Answers (3)

former_member282968
Contributor
0 Kudos

Hi Rashmitha,

1.Create a Function module or an assistance class method.

2.Make the inteface parameters as per your requirement of input selections in the screen.

3.Create an output table interface with structure defined in the dictionary as per your final structure.

4.Make a service call and in the Adapt context make all the object type as context node.

5.Bind the context node attributes to your input selections and output node to the reporting table.

With regards,

Former Member
0 Kudos

By using function module I got the result.But whn I execute the function module then how i will use the select option for the import parameter.Can you kindly explain me the detail process please. Then I think I will do it successfully. Please now this object is in deadline conditon, If I will do it there are other six same type of object are in my pipeline. then I will do it easily. Please help me. Tell me the detail process elaborately.

Regards

Rashmita

Former Member
0 Kudos

Create select options of type RSDSSELOPT_T as a parameter to this FM you have created.

Now you can pass this to your select query and export the Internal table data.

Is your requirement completed.

Hope this helps.

jayanthi_jayaraman
Active Contributor
0 Kudos

Hi,

Whatever is required to output in the form of table, create a dictionary structure and then use the same in node. Do the coding as required by the logic and then finally bind table to the node.

Former Member
0 Kudos

thanks a lot for your valuable answer. Today i have done according to your steps. Then when I wrote the select query to fatch the data "

SELECT * INTO CORRESPONDING FIELDS OF TABLE isvbrk FROM zsales_struct1 WHERE VBELN in <fs_vbeln>
   
and FKART in <fs_fkart> and FKDAT in <fs_fkdat>."

one dump arised that

where zsales_struct1 is the structure which contains the field of VBRK,VBRP,KNA1, KNUV,T006 and a ztable. Iwill put the detail screenshot below.Kindly tell me where is the error.

1. My component name is ZSALES_REPORT .

2. Created 2 components using the tab use component for the webdynpro component.

3. Then I created a context node(SALES_NODE) in component controller of type zsales_struct1 which i have created in data dictionary for storing all the table fields with cardinality 0:n.

4.then map the context from component controller context to interface controller DATA node.

5. then mapped the context from component controller to context of view controller. In layout tab of view created 2 view container ui elemnt ,1 search button and a table and bind that table to context node(SALES_node).

6.Then go to the property tab of view (MAIN) and create controllers for the component using create icon.Then go to attribute tab of MAIN view and create two attribute like m_handler Ref to if_wd_select_options and m_wd_select_options ref to IWCI_WDR_select_options.

7.then on the method wd_doinit I wrote the following code:

data lo_cmp_usage type ref to if_wd_component_usage.
     lo_cmp_usage
=   wd_this->wd_cpuse_select_opt( ).


 
if lo_cmp_usage->has_active_component( ) is initial.
    lo_cmp_usage
->create_component( ).
 
endif.

Now save and check the method.

Again click on method ONACTIONCONTINUE and put the following codes

DATA: node_sale TYPE REF TO if_wd_context_node.

 
TYPES: BEGIN OF STRUCT_SALE,
        FKART
TYPE ZSALES_STRUCT-FKART,
        BE_NO
TYPE ZSALES_STRUCT-BE_NO,
        BE_DATE
TYPE ZSALES_STRUCT-BE_DATE,
        UNIT_NAME
TYPE ZSALES_STRUCT-UNIT_NAME,
        VBELN
TYPE ZSALES_STRUCT-VBELN,
        FKDAT
TYPE ZSALES_STRUCT-FKDAT,
        KUNNR
TYPE ZSALES_STRUCT-KUNNR,
        STRAS
TYPE ZSALES_STRUCT-STRAS,
        REGIO
TYPE ZSALES_STRUCT-REGIO,
        PSTLZ
TYPE ZSALES_STRUCT-PSTLZ,
        INCO1
TYPE ZSALES_STRUCT-INCO1,
        ARKTX
TYPE ZSALES_STRUCT-ARKTX,
        FKIMG
TYPE ZSALES_STRUCT-FKIMG,
        MEINS
TYPE ZSALES_STRUCT-MEINS,
        CST_DTY
TYPE ZSALES_STRUCT-CST_DTY,
        NETWR
TYPE ZSALES_STRUCT-NETWR,
        VAT
TYPE ZSALES_STRUCT-VAT,
        CST
TYPE ZSALES_STRUCT-CST,
        TCS
TYPE ZSALES_STRUCT-TCS,
        AS_VALUE
TYPE ZSALES_STRUCT-AS_VALUE,
        TR_CHLN_NO
TYPE ZSALES_STRUCT-TR_CHLN_NO,
        TR_CHLN_DATE
TYPE ZSALES_STRUCT-TR_CHLN_DATE,
        TOT_INV_AMT
TYPE ZSALES_STRUCT-TOT_INV_AMT,
     
END OF STRUCT_SALE.



 
DATA: rt_vbeln TYPE REF TO data.
 
DATA: rt_fkart TYPE REF TO data.
 
DATA: rt_fkdat TYPE REF TO data.

 
DATA :isvbrk TYPE STANDARD TABLE OF STRUCT_SALE,
        wsvbrk
LIKE LINE OF isvbrk.

 
FIELD-SYMBOLS: <fs_vbeln> TYPE table,
                 <fs_fkart>
TYPE table,
                 <fs_fkdat>
TYPE table.


 

  rt_vbeln = wd_this->m_handler->get_range_table_of_sel_field(
  i_id
= 'VBELN_VF' ).

  ASSIGN rt_vbeln->* to <fs_vbeln>.

  rt_fkart
= wd_this->m_handler->get_range_table_of_sel_field(
  i_id
= 'FKART' ).
 
ASSIGN rt_fkart->* to <fs_fkart>.

  rt_fkdat
= wd_this->m_handler->get_range_table_of_sel_field(
  i_id
= 'FKDAT' ).
 
ASSIGN rt_fkdat->* to <fs_fkdat>.

 
CLEAR isvbrk.
 
REFRESH isvbrk.

= wd_this->m_handler->get_range_table_of_sel_field(
  i_id
= 'VBELN_VF' ).

  SELECT * INTO CORRESPONDING FIELDS OF TABLE isvbrk FROM zsales_struct1 WHERE VBELN in <fs_vbeln>
   
and FKART in <fs_fkart> and FKDAT in <fs_fkdat>.

node_sale = wd_context->get_child_node( name = 'SALES_NODE') .
  node_sale
->bind_elements( isvbrk ).
endmethod.

If I will put ZSALES_TABLE which is a line type table of the structure ZSALES_STRUCT1 same dump will arised that not defined in dictionary.

Kindly help me. I have in deadline condition. PLease help me.

regards

Rashmita

Former Member
0 Kudos

Hi Rashmitha,

Create one structure with fields (From different tables)  . And create context with the structure..

Create table type  for structure in programming...  Fill the data in table ( Fetch from different database tables and modify in table type)... 

Finally bind to node....

Regards,

Venkat.

Former Member
0 Kudos

thanks a lot for your valuable answer. Today i have done according to your steps. Then when I wrote the select query to fatch the data "

SELECT * INTO CORRESPONDING FIELDS OF TABLE isvbrk FROM zsales_struct1 WHERE VBELN in <fs_vbeln>
   
and FKART in <fs_fkart> and FKDAT in <fs_fkdat>."

one dump arised that

where zsales_struct1 is the structure which contains the field of VBRK,VBRP,KNA1, KNUV,T006 and a ztable. Iwill put the detail screenshot below.Kindly tell me where is the error.

1. My component name is ZSALES_REPORT .

2. Created 2 components using the tab use component for the webdynpro component.

3. Then I created a context node(SALES_NODE) in component controller of type zsales_struct1 which i have created in data dictionary for storing all the table fields with cardinality 0:n.

4.then map the context from component controller context to interface controller DATA node.

5. then mapped the context from component controller to context of view controller. In layout tab of view created 2 view container ui elemnt ,1 search button and a table and bind that table to context node(SALES_node).

6.Then go to the property tab of view (MAIN) and create controllers for the component using create icon.Then go to attribute tab of MAIN view and create two attribute like m_handler Ref to if_wd_select_options and m_wd_select_options ref to IWCI_WDR_select_options.

7.then on the method wd_doinit I wrote the following code:

data lo_cmp_usage type ref to if_wd_component_usage.
     lo_cmp_usage
=   wd_this->wd_cpuse_select_opt( ).


 
if lo_cmp_usage->has_active_component( ) is initial.
    lo_cmp_usage
->create_component( ).
 
endif.

Now save and check the method.

Again click on method ONACTIONCONTINUE and put the following codes

DATA: node_sale TYPE REF TO if_wd_context_node.

 
TYPES: BEGIN OF STRUCT_SALE,
        FKART
TYPE ZSALES_STRUCT-FKART,
        BE_NO
TYPE ZSALES_STRUCT-BE_NO,
        BE_DATE
TYPE ZSALES_STRUCT-BE_DATE,
        UNIT_NAME
TYPE ZSALES_STRUCT-UNIT_NAME,
        VBELN
TYPE ZSALES_STRUCT-VBELN,
        FKDAT
TYPE ZSALES_STRUCT-FKDAT,
        KUNNR
TYPE ZSALES_STRUCT-KUNNR,
        STRAS
TYPE ZSALES_STRUCT-STRAS,
        REGIO
TYPE ZSALES_STRUCT-REGIO,
        PSTLZ
TYPE ZSALES_STRUCT-PSTLZ,
        INCO1
TYPE ZSALES_STRUCT-INCO1,
        ARKTX
TYPE ZSALES_STRUCT-ARKTX,
        FKIMG
TYPE ZSALES_STRUCT-FKIMG,
        MEINS
TYPE ZSALES_STRUCT-MEINS,
        CST_DTY
TYPE ZSALES_STRUCT-CST_DTY,
        NETWR
TYPE ZSALES_STRUCT-NETWR,
        VAT
TYPE ZSALES_STRUCT-VAT,
        CST
TYPE ZSALES_STRUCT-CST,
        TCS
TYPE ZSALES_STRUCT-TCS,
        AS_VALUE
TYPE ZSALES_STRUCT-AS_VALUE,
        TR_CHLN_NO
TYPE ZSALES_STRUCT-TR_CHLN_NO,
        TR_CHLN_DATE
TYPE ZSALES_STRUCT-TR_CHLN_DATE,
        TOT_INV_AMT
TYPE ZSALES_STRUCT-TOT_INV_AMT,
     
END OF STRUCT_SALE.



 
DATA: rt_vbeln TYPE REF TO data.
 
DATA: rt_fkart TYPE REF TO data.
 
DATA: rt_fkdat TYPE REF TO data.

 
DATA :isvbrk TYPE STANDARD TABLE OF STRUCT_SALE,
        wsvbrk
LIKE LINE OF isvbrk.

 
FIELD-SYMBOLS: <fs_vbeln> TYPE table,
                 <fs_fkart>
TYPE table,
                 <fs_fkdat>
TYPE table.

 


 

  rt_vbeln = wd_this->m_handler->get_range_table_of_sel_field(
  i_id
= 'VBELN_VF' ).

  ASSIGN rt_vbeln->* to <fs_vbeln>.

  rt_fkart
= wd_this->m_handler->get_range_table_of_sel_field(
  i_id
= 'FKART' ).
 
ASSIGN rt_fkart->* to <fs_fkart>.

  rt_fkdat
= wd_this->m_handler->get_range_table_of_sel_field(
  i_id
= 'FKDAT' ).
 
ASSIGN rt_fkdat->* to <fs_fkdat>.

 
CLEAR isvbrk.
 
REFRESH isvbrk.

= wd_this->m_handler->get_range_table_of_sel_field(
  i_id
= 'VBELN_VF' ). 

  SELECT * INTO CORRESPONDING FIELDS OF TABLE isvbrk FROM zsales_struct1 WHERE VBELN in <fs_vbeln>
   
and FKART in <fs_fkart> and FKDAT in <fs_fkdat>.

node_sale = wd_context->get_child_node( name = 'SALES_NODE') .
  node_sale
->bind_elements( isvbrk ).
endmethod.

If I will put ZSALES_TABLE which is a line type table of the structure ZSALES_STRUCT1 same dump will arised that not defined in dictionary.

Kindly help me. I have in deadline condition. PLease help me.

regards

Rashmita