getting the next and previous record of alv table into container form based on user actions
Post on 05-Apr-2018
224 Views
Preview:
TRANSCRIPT
-
7/31/2019 Getting the Next and Previous Record of ALV Table Into Container Form Based on User Actions
1/13
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
2010 SAP AG 1
Getting the Next and PreviousRecord of ALV Table intoContainer Form Based on UserActions
Applies to:
Web Dynpro ABAP
Summary
This document explains how to get next record and previous record of ALV Table into the Container Formbased on User Actions in Web Dynpro ABAP.
Author: Tulasi PalnatiCompany: Yash Technologies
Created on: 13 July 2010
Author Bio
Tulasi Palnati is an Enterprise Portal Consultant at Yash Technologies, Hyderabad-India
-
7/31/2019 Getting the Next and Previous Record of ALV Table Into Container Form Based on User Actions
2/13
Getting the Next and Previous Record of ALV Tableinto Container Form Based on User Actions
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
2010 SAP AG 2
Table of Contents
Step 1: Create Web Dynpro Component ............................................................................................................ 3Step 2: Create Node at View Level and Map the Controller Context to View Context ....................................... 4Step 3: Embed the Standard ALV Component to Used Components of Our Component ................................. 4Step 4: Design the Layout at View Level and Place the Code ........................................................................... 5Step 5: Embed the view container UI Element at Window Level ....................................................................... 7Step 6: Paste the Code in Component Controller WDDOINIT( ) Method .......................................................... 8Step 7: Drag and Drop the Controller Context Node SPFLI_NODE to Interface Controller DATA Node .......... 8Step 8: Save and Activate the Web Dynpro Component and Create a Application ........................................... 9Related Content ................................................................................................................................................ 12Disclaimer and Liability Notice .......................................................................................................................... 13
-
7/31/2019 Getting the Next and Previous Record of ALV Table Into Container Form Based on User Actions
3/13
Getting the Next and Previous Record of ALV Tableinto Container Form Based on User Actions
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
2010 SAP AG 3
Step 1: Create Web Dynpro Component
Create a Node in Component Controller named SPFLI_NODE with Cardinality 0..n
-
7/31/2019 Getting the Next and Previous Record of ALV Table Into Container Form Based on User Actions
4/13
Getting the Next and Previous Record of ALV Tableinto Container Form Based on User Actions
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
2010 SAP AG 4
Step 2: Create Node at View Level and Map the Controller Context to View Context
Create a node in main View named NEXT_NODE with Structure SPFLI and Cardinality: 1n
Drag and Drop the Controller Context Node SPFLI_NODE to View Context
Step 3: Embed the Standard ALV Component to Used Components of OurComponent
Create an ALV Component
-
7/31/2019 Getting the Next and Previous Record of ALV Table Into Container Form Based on User Actions
5/13
Getting the Next and Previous Record of ALV Tableinto Container Form Based on User Actions
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
2010 SAP AG 5
Step 4: Design the Layout at View Level and Place the Code
Create:
1. View Container UI Element in View Layout.2. Group Element in View Layout.3. Right Click on Group and create container form using node NEXT_NODE.4. Create a buttons in Group and create an action NECTRECORD,
GET_PREVIOUS to that buttons.5. Design the Layout as follows:
6. Use the ALV Controller in MAIN View.
To do this go to Properties Tab and click on create controller usage Button and
select as below.
-
7/31/2019 Getting the Next and Previous Record of ALV Table Into Container Form Based on User Actions
6/13
Getting the Next and Previous Record of ALV Tableinto Container Form Based on User Actions
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
2010 SAP AG 6
7. Create two Actions like Get_PREVIOUS and NEXTRECORD
Paste the following Code in ONACTIONNEXTRECORD .
METHOD onactionnextrecord .
DATA lo_nd_spfli_node TYPEREFTO if_wd_context_node.DATA lo_el_spfli_node TYPEREFTO if_wd_context_element.
DATA ls_spfli_node TYPE wd_this->element_spfli_node.lo_nd_spfli_node = wd_context->get_child_node( name = wd_this-
>wdctx_spfli_node ).lo_el_spfli_node = lo_nd_spfli_node->get_element( ).CALLMETHOD lo_nd_spfli_node->move_nextRECEIVINGnew_lead_selection = lo_el_spfli_node.
lo_el_spfli_node->get_static_attributes(IMPORTINGstatic_attributes = ls_spfli_node ).
DATA lo_nd_next_node TYPEREFTO if_wd_context_node.DATA lo_el_next_node TYPEREFTO if_wd_context_element.DATA ls_next_node TYPE wd_this->element_next_node.lo_nd_next_node = wd_context->get_child_node( name = wd_this-
>wdctx_next_node ).
lo_el_next_node = lo_nd_next_node->get_element( ).lo_el_next_node->set_static_attributes(
static_attributes = ls_spfli_node ).
ENDMETHOD.
-
7/31/2019 Getting the Next and Previous Record of ALV Table Into Container Form Based on User Actions
7/13
Getting the Next and Previous Record of ALV Tableinto Container Form Based on User Actions
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
2010 SAP AG 7
Paste the following Code in ONACTIONGET_PREVIOUS.
METHOD onactionget_previous .DATA lo_nd_spfli_node TYPEREFTO if_wd_context_node.DATA lo_el_spfli_node TYPEREFTO if_wd_context_element.DATA ls_spfli_node TYPE wd_this->element_spfli_node.lo_nd_spfli_node = wd_context->get_child_node( name = wd_this-
>wdctx_spfli_node ).lo_el_spfli_node = lo_nd_spfli_node->get_element( ).
CALLMETHOD lo_nd_spfli_node->move_previousRECEIVINGnew_lead_selection = lo_el_spfli_node.
lo_el_spfli_node->get_static_attributes(IMPORTINGstatic_attributes = ls_spfli_node ).
DATA lo_nd_next_node TYPEREFTO if_wd_context_node.DATA lo_el_next_node TYPEREFTO if_wd_context_element.DATA ls_next_node TYPE wd_this->element_next_node.lo_nd_next_node = wd_context->get_child_node( name = wd_this-
>wdctx_next_node ).lo_el_next_node = lo_nd_next_node->get_element( ).lo_el_next_node->set_static_attributes(
static_attributes = ls_spfli_node ).
ENDMETHOD.
Step 5: Embed the view container UI Element at Window Level
Go to Windows and select Main window.
Right click on View Container which is in MAIN View and say EMBED VIEW.
Pop up is shown and select SALV_WD_TABLE.
-
7/31/2019 Getting the Next and Previous Record of ALV Table Into Container Form Based on User Actions
8/13
Getting the Next and Previous Record of ALV Tableinto Container Form Based on User Actions
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
2010 SAP AG 8
Step 6: Paste the Code in Component Controller WDDOINIT( ) Method
DATA : t_spfli typeTABLEOF spfli.
SELECT *FROM spfliinto CORRESPONDING FIELDSOFTABLE t_spfli.
DATA lo_nd_spfli_node TYPEREFTO if_wd_context_node.
DATA lo_el_spfli_node TYPEREFTO if_wd_context_element.DATA ls_spfli_node TYPE wd_this->element_spfli_node.
* navigate from to via lead selectionlo_nd_spfli_node = wd_context->get_child_node( name = wd_this-
>wdctx_spfli_node ).lo_nd_spfli_node->bind_table( t_spfli ).
Step 7: Drag and Drop the Controller Context Node SPFLI_NODE to Interface
Controller DATA NodeGo to Component Usages, Click on Controller Usage Shown on right hand side and select ComponentController.
-
7/31/2019 Getting the Next and Previous Record of ALV Table Into Container Form Based on User Actions
9/13
Getting the Next and Previous Record of ALV Tableinto Container Form Based on User Actions
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
2010 SAP AG 9
Drag and Drop the SPFLI_NODE into DATA of INTERFACECONTROLLER.
After Mapping U will get a message as below.
Step 8: Save and Activate the Web Dynpro Component and Create a Application
Create Application
-
7/31/2019 Getting the Next and Previous Record of ALV Table Into Container Form Based on User Actions
10/13
Getting the Next and Previous Record of ALV Tableinto Container Form Based on User Actions
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
2010 SAP AG 10
Select Any Record on the Table and Click on Previous
The below Screen Shot gets the Previous Record of Current Selected Record into the Container Form
And on Click on Next it gets the Next Record of the Current Selected Record into the Container Form
-
7/31/2019 Getting the Next and Previous Record of ALV Table Into Container Form Based on User Actions
11/13
Getting the Next and Previous Record of ALV Tableinto Container Form Based on User Actions
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
2010 SAP AG 11
-
7/31/2019 Getting the Next and Previous Record of ALV Table Into Container Form Based on User Actions
12/13
Getting the Next and Previous Record of ALV Tableinto Container Form Based on User Actions
SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
2010 SAP AG 12
Related Content
Web Dynpro ABAP Homepage
Web Dynpro ABAP Wiki's
http://www.sdn.sap.com/irj/sdn/nw-wdabap%23section2http://www.sdn.sap.com/irj/sdn/nw-wdabap%23section2http://wiki.sdn.sap.com/wiki/display/WDABAP/Web+Dynpro+ABAP+Homehttp://wiki.sdn.sap.com/wiki/display/WDABAP/Web+Dynpro+ABAP+Homehttp://wiki.sdn.sap.com/wiki/display/WDABAP/Web+Dynpro+ABAP+Homehttp://www.sdn.sap.com/irj/sdn/nw-wdabap%23section2 -
7/31/2019 Getting the Next and Previous Record of ALV Table Into Container Form Based on User Actions
13/13
top related