Skip to end of metadata
Go to start of metadata

Open the Transaction SE80 and create a webdynpro component .

Step-1: Create an input field inside a group. Map this input field to the context attribute LIFNR whose type is LIFNR. Since we are referring to that of Database ref field, we will the F4 Functionality


 

Step-2:  Create a UI Element - Multipane in the Layout as shown below. Refer the below images for setting up the properties and the binding.



 

Step-3:  Create a transparent Container For Header Details.

Here create a Label as 'PO No:' and a Text View for storing the value.Map the text property of this textview to VBELN as shown below.


 

Step-4:  Create another transparent Container For Item Details. Here Create a Table and create the binding as shown in the below screen shot.


 

Step-5:  Create a supply function for the sub node. i.e for Items. Refer the below screen shots for binding and the coding.


 

Step-6:  In the view attributes, insert one attribute called ALL_IN_ONE_UTIL as shown in the below screen shot.


 

Step-7:  Here is the code which should get triggered after entering the Vendor number and hit ENTER. => We need to create an action for the LIFNR input filed.
DATA lo_el_context TYPE REF TO if_wd_context_element.

DATA ls_context TYPE wd_this->element_context.

DATA lv_lifnr LIKE ls_context-lifnr.

* get element via lead selection

lo_el_context = wd_context->get_element( ).

* get single attribute

lo_el_context->get_attribute(

EXPORTING

name = `LIFNR`

IMPORTING

value = lv_lifnr ).

TYPES: BEGIN OF ty_pos,

ebeln TYPE ekko-ebeln,

END OF ty_pos.

DATA:it_pos TYPE TABLE OF ty_pos,

wa_pos TYPE ty_pos.

TYPES: BEGIN OF ty_items,

ebeln TYPE ekpo-ebeln,

ebelp TYPE ekpo-ebelp,

matnr TYPE ekpo-matnr,

bukrs TYPE ekpo-bukrs,

werks TYPE ekpo-werks,

lgort TYPE ekpo-lgort,

matkl TYPE ekpo-matkl,

menge TYPE ekpo-menge,

netpr TYPE ekpo-netpr,

netwr TYPE ekpo-netwr,

END OF ty_items.

DATA:it_items TYPE TABLE OF ty_items,

wa_items TYPE ty_items.

DATA lo_nd_mp_data TYPE REF TO if_wd_context_node.

DATA lo_el_mp_data TYPE REF TO if_wd_context_element.

DATA ls_mp_data TYPE wd_this->element_mp_data.

DATA lt_mp_data TYPE TABLE OF wd_this->element_mp_data.

* navigate from <CONTEXT> to <MP_DATA> via lead selection

lo_nd_mp_data = wd_context->get_child_node( name = wd_this->wdctx_mp_data ).

* get element via lead selection

lo_el_mp_data = lo_nd_mp_data->get_element( ).

REFRESH:it_pos.

IF lv_lifnr IS NOT INITIAL.

SELECT ebeln FROM ekko INTO wa_pos WHERE lifnr EQ lv_lifnr.

MOVE:wa_pos-ebeln TO ls_mp_data-ebeln.

APPEND ls_mp_data TO lt_mp_data.

ENDSELECT.

SORT lt_mp_data BY ebeln.

CALL METHOD lo_nd_mp_data->bind_table

EXPORTING

new_items = lt_mp_data.

IF lt_mp_data[] IS NOT INITIAL.

SELECT ebeln ebelp matnr bukrs werks lgort matkl menge netpr netwr

FROM ekpo INTO TABLE it_items FOR ALL ENTRIES IN it_pos WHERE ebeln = it_pos-ebeln.

ENDIF.

ELSE.

ENDIF.


 

Step-8:  Here is the code that should be written in the Supply Function

DATA: ls_parent_attributes TYPE wd_this->element_mp_data.

TYPES: BEGIN OF ty_items,

ebeln TYPE ekpo-ebeln,

ebelp TYPE ekpo-ebelp,

matnr TYPE ekpo-matnr,

bukrs TYPE ekpo-bukrs,

werks TYPE ekpo-werks,

lgort TYPE ekpo-lgort,

matkl TYPE ekpo-matkl,

menge TYPE ekpo-menge,

netpr TYPE ekpo-netpr,

netwr TYPE ekpo-netwr,

END OF ty_items.

DATA:it_items TYPE TABLE OF ty_items,

wa_items TYPE ty_items.

* This would result in the ststem fetching the PO number value being displayed in the current pane

parent_element->get_static_attributes( IMPORTING static_attributes = ls_parent_attributes ).

SELECT ebeln ebelp matnr bukrs werks lgort matkl menge netpr netwr FROM ekpo INTO TABLE it_items WHERE ebeln = ls_parent_attributes-ebeln.

TYPES: BEGIN OF ty_items2,

ebelp TYPE ekpo-ebelp,

matnr TYPE ekpo-matnr,

bukrs TYPE ekpo-bukrs,

werks TYPE ekpo-werks,

lgort TYPE ekpo-lgort,

matkl TYPE ekpo-matkl,

menge TYPE ekpo-menge,

netpr TYPE ekpo-netpr,

netwr TYPE ekpo-netwr,

END OF ty_items2.

DATA:it_items2 TYPE TABLE OF ty_items2,

wa_items2 TYPE ty_items2.

LOOP AT it_items INTO wa_items.

MOVE-CORRESPONDING wa_items TO wa_items2.

APPEND wa_items2 TO it_items2.

ENDLOOP.

DATA element TYPE REF TO if_wd_context_element.

element = node->create_element( ).

node->bind_table( EXPORTING new_items = it_items2 ).


 

Step-9: Create an event containerin the Layout as shown in the below screen shot. The necessity of creating this Event Container is , What ever action that is performed in the Multipane should be Stored / caught. This can be Caught by the ALL IN ONE UTIL and can be displayed in EVENT CONTAINER. As we dont want to display the details of the event that we perform on the pane, we can make it invisible by setting the Visible attribute to none.

Refer the below screen shots of layout and the coding that needs to be done in the WDMODIFYVIEW.


 

Step-10:  Now create an application, activate the WDComponent and test it .

  • No labels