cancel
Showing results for 
Search instead for 
Did you mean: 

How to add Top of Page for ALV

0 Kudos

Hi

How to add Top of page for ALV

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Welcome to Web Dynpro for ABAP Forum.

check this code to set the image and text to the table header.

*ALV Component usage
data: l_ref_cmp_usage type ref to if_wd_component_usage.

l_ref_cmp_usage =   wd_this->wd_cpuse_alv( ).
if l_ref_cmp_usage->has_active_component( ) is initial.
  l_ref_cmp_usage->create_component( ).
endif.

*Call Get_model() of Interface Controller to set changes to the output
*table

data: l_ref_interfacecontroller type ref to iwci_salv_wd_table .
l_ref_interfacecontroller =   wd_this->wd_cpifc_alv( ).
  data:
    l_value type ref to cl_salv_wd_config_table.

  l_value = l_ref_interfacecontroller->get_model(
  ).
*Create Header
data: l_header type ref to cl_salv_wd_header,
      str type string.
*Add Text and Image to the Header
l_header = l_value->if_salv_wd_table_settings~create_header( ).
str = 'Flights Details'.

l_header->set_text( value = str  ).

l_header->set_image_source( value = 'ICON_FLIGHT' ).

Thanks

Suman

0 Kudos

Thank you Suman for your help , it is for giving heading but how to give top of page or TOP OF LIST

uday_gubbala2
Active Contributor
0 Kudos

Hi Mohammed,

Use the SET_TOP_OF_LIST method of CL_SALV_TABLE. Go through the class documentation for CL_SALV_TABLE you can find the necessary help for this method.

Regards,

Uday

Former Member
0 Kudos

Hi,

Sorry for the late response.I have been trying for the solution.It was little bit difficult to me to get the solution.Any how the solution is.....

Follw the below steps to get the Top of list and End of list in ALV.

Actually Top of list and end of list are not events. they are header and footer areas for ALV table display.

We can insert design objects in these areas.

1.Create a context node TOP_OF_LIST with cardinality 1..1 and selection is 1...1

add attribute content of type ref to cl_salv_wd_form_element to this and then bind this context node to the Top of list node of Interface controller.

2. Then write the below code to get the Top of list

*TOP_OF_LIST in ALV

DATA:

NODE_TOP_OF_LIST TYPE REF TO IF_WD_CONTEXT_NODE,

ELEM_TOP_OF_LIST TYPE REF TO IF_WD_CONTEXT_ELEMENT,

STRU_TOP_OF_LIST TYPE IF_SEARCH=>ELEMENT_TOP_OF_LIST .

DATA: LR_FLOW TYPE REF TO CL_SALV_FORM_LAYOUT_GRID,

R_VALUE TYPE REF TO CL_SALV_FORM_LABEL,

R_VALUE1 TYPE REF TO CL_SALV_FORM_TEXT.

*create object lr_flow.

CREATE OBJECT LR_FLOW

  • EXPORTING

  • COLUMNS =

.

R_VALUE1 = LR_FLOW->CREATE_TEXT(

ROW = 1

COLUMN = 2

  • ROWSPAN = ROWSPAN

  • COLSPAN = COLSPAN

TEXT = 'TEXT1'

  • TOOLTIP = TOOLTIP

).

R_VALUE = LR_FLOW->CREATE_LABEL(

ROW = 1

COLUMN = 1

  • ROWSPAN = ROWSPAN

  • COLSPAN = COLSPAN

TEXT = 'Lable1'

  • TOOLTIP = TOOLTIP

R_LABEL_FOR = R_VALUE1

).

R_VALUE1 = LR_FLOW->CREATE_TEXT(

ROW = 2

COLUMN = 2

  • ROWSPAN = ROWSPAN

  • COLSPAN = COLSPAN

TEXT = 'TEXT2'

  • TOOLTIP = TOOLTIP

).

R_VALUE = LR_FLOW->CREATE_LABEL(

ROW = 2

COLUMN = 1

  • ROWSPAN = ROWSPAN

  • COLSPAN = COLSPAN

TEXT = 'Lable2'

  • TOOLTIP = TOOLTIP

R_LABEL_FOR = R_VALUE1

).

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

NODE_TOP_OF_LIST = WD_CONTEXT->GET_CHILD_NODE( 'TOP_OF_LIST' ).

NODE_TOP_OF_LIST->SET_ATTRIBUTE(

  • INDEX = USE_LEAD_SELECTION

VALUE = LR_FLOW

NAME = 'CONTENT'

).

*Set top of list

L_VALUE->IF_SALV_WD_TABLE_SETTINGS~SET_TOP_OF_LIST_VISIBLE(

VALUE = ABAP_TRUE

).

Follow the same steps for End of list.Create End of list node and then bind this with end of list node of Interface controller.

Thanks,

Suman

0 Kudos

Hi Suman

The code is not giving any error, the issue is the TOP_OF_LIST node that is created could not be binded to interface controller,How to solve the problem????

It is giving the error: Node TOP_OF_LIST: Property input element is missing. External mapping not possible

Is it possible to bind dynamically???

With Thanks for your sincere Help

shabeeb

Former Member
0 Kudos

Hi,

Yes you are correct directly we are not able to bind the node.

Right click on Top of list node and select define binding then your node will be binded to the Top of list of Interface controller.

Thanks

Suman

0 Kudos

Hi Suman

I believe you mean Define mapping which comes by Right clicking on the TOP_OF_LIST node that is created in the context, By it is showing only the context of the view and Component controller, Not the interface view controller. Also I would like to know the Definition of of L_VALUE

(L_VALUE->IF_SALV_WD_TABLE_SETTINGS~SET_TOP_OF_LIST_VISIBLE(

VALUE = ABAP_TRUE).

With Thanks

shabeeb

Former Member
0 Kudos

Hi,

Where you have context node in the view or Controller.

from where you binded the data node to the DATA of Interface Controller.

In my example program i have taken FLIGHTS node in the view to populate the flights details then i binded this to DATA node of Interface controller.

Later I created TOP_OF_LIST node in the view then i binded this to TOP_OF_LIST of Interface controller.

L_value is table reference.

*Call Get_model() of Interface Controller to set changes to the output

*table

data: l_ref_interfacecontroller type ref to iwci_salv_wd_table .

l_ref_interfacecontroller = wd_this->wd_cpifc_alv( ).

data:

l_value type ref to cl_salv_wd_config_table.

l_value = l_ref_interfacecontroller->get_model(

).

Thanks

Suman

0 Kudos

Hi Suman

Even though you are trying to help me for TOP OF PAGE, it is not working,

Let me explan what I have done

1. Created a node FLIGHTS with dictionary structure

2. Mapped it to view by drag and drop

3.Binded this FLIGHTS to DATA node in the interface controller using Drag and Drop

4. Created another node TOP OF LIST

5 Created element CONTENT of type CL_SALV_FORM_ELEMENT under TOP OF LIST

6.Binded TOP OF LIST to TOP OF LIST of Interface controller by Right clicking on the top of the node

TOP OF LIST.

7. Written the following code

DATA node TYPE REF TO if_wd_context_node.

DATA it_sflight TYPE TABLE OF sflight.

SELECT * FROM sflight INTO TABLE it_sflight.

node = wd_context->get_child_node( name = 'FLIGHTS' ).

node->bind_table( it_sflight ).

*===========================================================

*ALV TOP of Page

*===========================================================

DATA node_top_of_list TYPE REF TO if_wd_context_node.

DATA elem_top_of_list TYPE REF TO if_wd_context_element.

DATA stru_top_of_list TYPE if_v_alv=>element_top_of_list.

DATA lr_flow TYPE REF TO cl_salv_form_layout_grid.

DATA r_value TYPE REF TO cl_salv_form_label.

DATA r_value1 TYPE REF TO cl_salv_form_text.

CREATE OBJECT lr_flow

  • EXPORTING

  • columns =

.

*===========================================================

CALL METHOD lr_flow->create_text

EXPORTING

row = 1

column = 2

  • rowspan =

  • colspan =

text = 'Text1'

  • tooltip =

RECEIVING

r_value = r_value1 .

*===========================================================

CALL METHOD lr_flow->create_label

EXPORTING

row = 1

column = 1

  • rowspan =

  • colspan =

text = 'Label'

  • tooltip =

  • r_label_for =

RECEIVING

r_value = r_value

.

*===========================================================

node_top_of_list = wd_context->get_child_node( 'TOP_OF_LIST' ).

CALL METHOD node_top_of_list->set_attribute

EXPORTING

  • index = use_lead_selection

value = lr_flow

name = 'CONTENT'

.

*===========================================================

DATA: l_ref_interfacecontroller TYPE REF TO iwci_salv_wd_table .

l_ref_interfacecontroller = wd_this->wd_cpifc_alv( ).

DATA:

l_value TYPE REF TO cl_salv_wd_config_table.

l_value = l_ref_interfacecontroller->get_model(

).

l_value->if_salv_wd_table_settings~set_top_of_list_visible(

value = abap_true

).

8. Only the ALV is displayed NO TOP OF PAGE

Thanking your help

shabeeb

Former Member
0 Kudos

Hi Mohammed,

Every thin gis correct except this.

Assign value for lable for (r_label_for) like.

r_lable_for = r_value1

Let me know immediately if you dont get the Output.

also check my Output

http://picasaweb.google.com/nvsuman519/UntitledAlbum02?authkey=2qCZrGnOluE#

Thanks

Suman

Edited by: suman kumar chinnam on Sep 19, 2008 12:57 PM

0 Kudos

Hi Suman

Sorry, I did n't get the output, and let me know how to declare and assign r_lable_for = r_value1

With Thanks

shabeeb

Former Member
0 Kudos

Hi,

What i mean is,you are displaying lable field for this you should mention to which field you are showing lable.

you assign textview reference to the R_LABLE_FOR.

your code is correct nothing wrong is there.i dont know why your not getting.Once again i am posting my complete code here check once again and do as it is.

the below is code written in the WD_DOINIT of my view.

*ALV Component usage
data: l_ref_cmp_usage type ref to if_wd_component_usage.

l_ref_cmp_usage =   wd_this->wd_cpuse_alv( ).
if l_ref_cmp_usage->has_active_component( ) is initial.
  l_ref_cmp_usage->create_component( ).
endif.

*Call Get_model() of Interface Controller to set changes to the output
*table

data: l_ref_interfacecontroller type ref to iwci_salv_wd_table .
l_ref_interfacecontroller =   wd_this->wd_cpifc_alv( ).
  data:
    l_value type ref to cl_salv_wd_config_table.

  l_value = l_ref_interfacecontroller->get_model(
  ).
*TOP_OF_LIST in ALV
  DATA:
    node_top_of_list  TYPE REF TO if_wd_context_node,
    elem_top_of_list  TYPE REF TO if_wd_context_element,
    stru_top_of_list  TYPE if_search=>element_top_of_list .


data: lr_flow type ref to cl_salv_form_layout_grid,
      r_value type ref to cl_salv_form_label,
      r_value1 type ref to cl_salv_form_text.

*create object lr_flow.

CREATE OBJECT lr_flow
*  EXPORTING
*    COLUMNS =
    .

 r_value1 = lr_flow->create_text(
              row     = 1
              column  = 2
*              ROWSPAN = ROWSPAN
*              COLSPAN = COLSPAN
               TEXT    = 'TEXT1'
*              TOOLTIP = TOOLTIP
                 ).

 r_value =  lr_flow->create_label(
                  row         = 1
                  column      = 1
*                  ROWSPAN     = ROWSPAN
*                  COLSPAN     = COLSPAN
                   TEXT        = 'Lable1'
*                  TOOLTIP     = TOOLTIP
                   R_LABEL_FOR = R_value1
                     ).

r_value1 = lr_flow->create_text(
              row     = 2
              column  = 2
*              ROWSPAN = ROWSPAN
*              COLSPAN = COLSPAN
               TEXT    = 'TEXT2'
*              TOOLTIP = TOOLTIP
                 ).

 r_value =  lr_flow->create_label(
                  row         = 2
                  column      = 1
*                  ROWSPAN     = ROWSPAN
*                  COLSPAN     = COLSPAN
                   TEXT        = 'Lable2'
*                  TOOLTIP     = TOOLTIP
                   R_LABEL_FOR = R_value1
                     ).
* navigate from <CONTEXT> to <TOP_OF_LIST> via lead selection
  node_top_of_list = wd_context->get_child_node( 'TOP_OF_LIST' ).

node_top_of_list->set_attribute(
*    INDEX  = USE_LEAD_SELECTION
     VALUE  = lr_flow
    name   = 'CONTENT'
       ).


*Set top of list
l_value->if_salv_wd_table_settings~set_top_of_list_visible(
    value  = abap_true
       ).

Thanks

Suman

0 Kudos

Hi Suman

The problem is that it will work only in DOINIT, now it is ok, But let me say one more aspect I know to bind node of table dynamicaly to create ALV dynamically, so we cann't change TOP OF LIST dynamically and if you get the code for dynamic binding, let me know. The full point is also given

With lot of Thanks

Shabeeb

0 Kudos

Hi Suman

Still one more problem is there with TOP_OF_LIST. How to Change the contents when the input data changes, Here the problem is Once we set "Label1 and Text1" in column1, and in the next run based on some condition it is changed to "Label2 and Text2" and assign the same to TOP_OF_LIST node of the View, in display it is not getting affected.

Is there any solution available for this

Former Member
0 Kudos

Hi Mohammad,

Sorry for the late reply...

I didnt get your problem.how many rows you want to populate in the Top_of_list at a time.

Thanks

Suman

0 Kudos

Hi Suman

The thing is not about the No of rows. Let me explain it here

1. First user enters a particular date

2.This date can be shown in our TOP_OF_LIST

3. Then the user clicks the link label for 'Back' and he comes to the selection screen again

4.He selects a different data,

5.But the TOP_OF_LIST shows the first data only, I like to change the TOP_OF_LIST data accordingly, But in the assignment of Label it is changing the value , in the display of TOP_OF_LIST it is showing the first assigned value only

6. The problem is the TOP_OF_LIST cannot be changed dynamically

With Thanks

Answers (1)

Answers (1)

Former Member
0 Kudos

Regards,

Edited by: sarath kumar on Sep 17, 2008 1:29 PM