Tuesday, March 27, 2012
  • Create Web Dynpro Application - TOP OF LIST in ALV - Web Dynpro ABAP
  • Go to Component Controller COMPONENTCONTROLLER
    • Context tab->Create END_OF_LIST node with attribute CONTENT (type ref to CL_SALV_FORM_ELEMENT).
 
    • Context tab-> Map node END_OF_LIST of ALV Component context to END_OF_LIST of Component Controller.
    • Methods tab->Write the code in WDDOINIT to populate data in ALV and creating TOP_OF_LIST and END_OF_LIST events. 
    • WDDOINIT method code
    • method wddoinit.
      
        wd_this->get_pa0002_data(  ).
        wd_this->create_top_of_list(  ).
        wd_this->create_end_of_list(  ).
      
      endmethod.
      
    • CREATE_END_OF_LIST code
    • method create_end_of_list .
        data lo_nd_top_of_list type ref to if_wd_context_node.
        data lo_el_top_of_list type ref to if_wd_context_element.
        data ls_top_of_list    type wd_this->element_top_of_list.
        data:lr_grid           type ref to cl_salv_form_layout_grid.
      * TOP-OF-LIST
      **...create top grid
        create object lr_grid
          exporting
            columns = 5.
      
      *... fill 1. row
        lr_grid->create_text(
          exporting
            row = 1
            column = 1
            rowspan = 1
            colspan = 1
            text = 'Cell 1,1' ).
      
        lr_grid->create_text(
          exporting
            row = 1
            column = 2
            rowspan = 1
            colspan = 1
            text = 'Cell 1,2' ).
      
        lr_grid->create_text(
          exporting
            row = 1
            column = 3
            rowspan = 1
            colspan = 1
            text = 'Cell 1,3' ).
      
        lr_grid->create_text(
        exporting
          row = 1
          column = 4
          rowspan = 1
          colspan = 1
          text = 'Cell 1,4' ).
      
        lr_grid->create_text(
      exporting
        row = 1
        column = 5
        rowspan = 1
        colspan = 1
        text = 'Cell 1,5' ).
      *...fill 2nd row
        lr_grid->create_text(
          exporting
            row = 2
            column = 1
            rowspan = 1
            colspan = 1
            text = 'Cell 2,1' ).
      
        lr_grid->create_text(
          exporting
            row = 2
            column = 2
            rowspan = 1
            colspan = 1
            text = 'Cell 2,2' ).
      
        lr_grid->create_text(
          exporting
            row = 2
            column = 3
            rowspan = 1
            colspan = 1
            text = 'Cell 2,3' ).
      
        lr_grid->create_text(
        exporting
          row = 2
          column = 4
          rowspan = 1
          colspan = 1
          text = 'Cell 2,4' ).
      
        lr_grid->create_text(
      exporting
        row = 2
        column = 5
        rowspan = 1
        colspan = 1
        text = 'Cell 2,5' ).
        "Navigate from  to  via lead selection
        lo_nd_top_of_list = wd_context->get_child_node( name = wd_this->wdctx_top_of_list ).
      
        "pass TOL to context node
        lo_nd_top_of_list = wd_context->get_child_node( name = 'END_OF_LIST' ).
        lo_el_top_of_list = lo_nd_top_of_list->get_element( index = 1 ).
      
        call method lo_el_top_of_list->set_attribute
          exporting
            value = lr_grid
            name  = 'CONTENT'.
      
      endmethod.
      
  • Activate Web Dynpro Component. 
  • Run Web Dynpro Application. 

0 comments:

Post a Comment

Your useful comments, suggestions are appreciated.Your comments are moderated.

Followers

Contact Form

Name

Email *

Message *

Web Dynpro ABAP Book

An SAP Consultant

Follow US


Want to Contribute ?

If you are interested in writing about the new stuff you learn everyday while working, please write to the.sap.consultants@gmail.com.

Click on Contribution for more details.