Você está na página 1de 2

In case of web dynpro you can try using the Table Popin feature:

1. Create a WD component with Window W_DEFAULT and View V_DEFAULT.


2. View V_DEFAULT :
2.1 : Create two context node HEADER & ITEMS as follows:
HEADER ( EBELN, BUKRS, BSTYP, BSART, POPIN_NAME<string> ) . ITEMS(
EBELN, EBELP, LOEKZ, STATU, AEDAT ).
2.2 : Assign the Supply function SUPPLY_HEADER to the HEADER node and
SUPPLY_ITEM to ITEM node.

METHOD supply_header.
data declaration
DATA lt_header TYPE wd_this->elements_header.
DATA ls_header LIKE LINE OF lt_header.
@TODO compute values
SELECT ebeln bukrs bstyp bsart FROM ekko
UP TO 10 ROWS INTO TABLE lt_header.

bind all the elements


node->bind_table(
new_items = lt_header
set_initial_elements = abap_true ).
ENDMETHOD.

METHOD supply_items.
data declaration
DATA lt_items TYPE wd_this->Elements_items.
DATA ls_items LIKE LINE OF lt_items.
@TODO compute values
e.g. call a data providing FuBa
SELECT EBELN EBELP LOEKZ STATU AEDAT FROM EKPO
INTO TABLE LT_ITEMS
WHERE EBELN = LS_PARENT_ATTRIBUTES-EBELN.
bind all the elements
node->bind_table(
new_items = lt_items
set_initial_elements = abap_true ).
ENDMETHOD.

2.3 : Go to layout of the V_DEFAULT


2.4 : Create a TABLE UI element TABLE_HEADER . right click on the TABLE_HEADER
context and insert table popin.Give the ID as TABLEPOPIN.
Assign a method CLOSE_POPIN to the onClose event of TABLEPOPIN.

define CONTEXT_ELEMENT as an importing parameter for the event and type ref to
IF_WD_CONTEXT_ELEMENT.
METHOD onactionclose_popin .
context_element->set_attribute(
value = space
name = 'POPIN_NAME'
).
ENDMETHOD.

2.5 : right click on TABLEPOPIN and insert content. Insert a tableUI element and
give it a name TBL_ITEMS.
Give the data source ITEMS to the TBL_ITEMS table UI. Insert all the
columns from context to the table TBL_ITEMS.

2.6 : select TABLE_HEADER context and give HEADER as the data source. Now insert
the table columns using context. Do not insert column for POPIN_NAME.

2.7: After you have EBELN, BUKRS, BSTYP, BSART as the columns for TABLE_HEADER.
select the TABLE_HEADER right click and insert a table column named TABLECOLUMN.
select TABLECOLUMN and right click and insert CELLVARIANT
Give ID CELL_VARIANT and select TABLEPOPINTOGGLECELL.

2.8 : select CELL_VARIANT context and give VARIANTKEY as LITERAL POPIN. assign
TOGGLE_CELL method to ONTOGGLE event.

METHOD ONACTIONTOGGLE_CELL.
define a context_element as as importing parameter ref to IF_WD_CONTEXT_ELEMENT.
context_element->set_attribute( name = 'POPIN_NAME' value = 'TABLEPOPIN' ).

ENDMETHOD.

2.9. Mark the TABLE_HEADER element and bind the selectedPopin attribute to
POPIN_NAME attribute of HEADER node.

Save and activate the component.Create an application and test.

Thanks,
Abhishek