Skip to Content

Make two components of Web Dynpro ABAP, suppose one for flight Booking and the other for Customer details : Take two Webdynpro Components separately, Example: ZZ_CALLING_APPLICATION and ZZ_CALLED_APPLICATION. The navigation PDF is attached.

STEP 1: CREATE A WEBDYNPRO COMPONENT (SAY: ZZ_CALLING_APPLICATION) THAT WILL TAKE THE “Date on Which Record Was Created” MEANS AEDAT AND A BUTTON NAMED SHOW PURCHASE ORDER, AND A TABLE THAT WILL SHOW THE DETAILS OF PURCHASE ORDER OF THE MENTIONED DATE FROM EKKO TABLE.



/wp-content/uploads/2014/03/img_1_411982.jpg


STEP 2: CREATE AN ANOTHER COMPONENT (SAY: ZZ_CALLED_APPLICATION) WHERE TAKE A TABLE WITH ELEMENTS OF EKPO TABLE.




/wp-content/uploads/2014/03/img_2_411990.jpg


STEP 3: GOTO THE CALLING APPLICATION, SELECT THE TABLE AND GOTO THE EVENT “ON LEAD SELECTION” IN PROPERTY AND CREATE AN ACTION, SAY: ON_LEAD_SELECT.


/wp-content/uploads/2014/03/img_3_411993.jpg



PROPERTIES:


  /wp-content/uploads/2014/03/img_4_412002.jpg


STEP 4: DOUBLE CLICK ON THE EVENT NAME I.E. , ON_LEAD_SELECT AND WRITE THE CODE FOR THE ACTION TO OPEN THE SECOND APPLICATION FROM THE FIRST ONE ONCE THE USER SELECTS THE LEFT HAND SIDE OF THE DESIRED ROW.


/wp-content/uploads/2014/03/img_5_411898.jpg



THE PIECE OF CODE IS:


METHOD onactionon_lead_select .
DATA lo_nd_ekko_node TYPE REF TO if_wd_context_node.
DATA lo_el_ekko_node TYPE REF TO if_wd_context_element.
DATA ls_ekko_node TYPE wd_this->element_ekko_node.
DATA lv_ebeln LIKE ls_ekko_node-ebeln.
* navigate from <CONTEXT> to <EKKO_NODE> via lead selection
lo_nd_ekko_node = wd_context->get_child_node( name = wd_this->wdctx_ekko_node ).

* @TODO handle not set lead selection
IF lo_nd_ekko_node IS INITIAL.
ENDIF.

* get element via lead selection
lo_el_ekko_node = lo_nd_ekko_node->get_element(  ).

* @TODO handle not set lead selection
IF lo_el_ekko_node IS INITIAL.
ENDIF.

* alternative access  via index
* lo_el_ekko_node = lo_nd_ekko_node->get_element( index = 1 ).
* @TODO handle non existant child
* IF lo_el_ekko_node IS INITIAL.
* ENDIF.

* get single attribute
lo_el_ekko_node->get_attribute(
EXPORTING
name = 
`EBELN`
IMPORTING
value = lv_ebeln ).

DATA: lv_url TYPE string.

CALL METHOD cl_wd_utilities=>construct_wd_url
EXPORTING
application_name =
‘ZZ_CALLED_APPLICATION’
IMPORTING
out_absolute_url = lv_url.

DATA:lv_ebeln_out TYPE string.

lv_ebeln_out = lv_ebeln.

*NOW ATTATCH THE VALUE TO THE URL AT THE RUN TIME.

CALL METHOD cl_http_server=>append_field_url
EXPORTING
name  =
‘EBELN’
value = lv_ebeln_out
CHANGING
url   = lv_url.

*GENERATE THE WINDOW TO OUTPUT THE URL.

DATA:lv_comp1 TYPE REF TO if_wd_component.

lv_comp1 = wd_comp_controller->WD_GET_API( ).

DATA: lr_window_manager TYPE REF TO if_wd_window_manager.

CALL METHOD lv_comp1->get_window_manager
RECEIVING
window_manager = lr_window_manager.

DATA: lr_window TYPE REF TO if_wd_window.

CALL METHOD lr_window_manager->create_external_window
EXPORTING
url    = lv_url
title  = ‘PURCHASE ITEM DETAILS’
RECEIVING
window = lr_window.

CALL METHOD lr_window->open( ).

ENDMETHOD.




STEP 5: GOTO THE SECOND COMPONENT I.E., ZZ_CALLED_APPLICATION AND GOTO METHOD WDDOINIT ( ) , Controller Initialization Method, AND RIGHT THE PIECE OF CODE TO INITIALIZE THE DATA IN THE SECOND COMPONENT.



/wp-content/uploads/2014/03/img_6_412034.jpg



/wp-content/uploads/2014/03/img_7_412035.jpg


THE CODE IS:


method wddoinit .

DATA: LV_VAL TYPE STRING.

DATA: LWA_EKPO TYPE EKPO.

DATA: LT_EKPO TYPE TABLE OF EKPO.

LV_VAL = WDR_TASK=>CLIENT_WINDOW->GET_PARAMETER( ‘EBELN’ ).

DATA lo_nd_ekpo_node TYPE REF TO if_wd_context_node.
DATA lo_el_ekpo_node TYPE REF TO if_wd_context_element.
DATA ls_ekpo_node TYPE wd_this->element_ekpo_node.
DATA LT_ekpo_node TYPE wd_this->elementS_ekpo_node.
* navigate from <CONTEXT> to <EKPO_NODE> via lead selection
lo_nd_ekpo_node = wd_context->get_child_node( name = wd_this->wdctx_ekpo_node ).

SELECT * FROM
EKPO
INTO TABLE LT_ekpo_node
WHERE EBELN = LV_VAL.

CALL METHOD lo_nd_ekpo_node->bind_table
EXPORTING
new_items            = LT_ekpo_node.

endmethod.




STEP 6 AND OUTPUT: CREATE THE WEB DYNPRO APPLICATION FOR BOTH THE COMPONENTS, AND ACTIVATE THEM AS WELL AS RUN THE FIRST. SELECT ONE DATE, ALL THE PURCHASE ORDER WILL GET OPENED OF THE SELECTED DATE FROM THE TABLE. THEN CLICK ON THE LEFT HAND SIDE OF ROW THAT YOU NEED TO SELECT FOR PURCHASE ITEM DETAILS, AND THE SECOND APPLICATION WILL GET OPENED WITH THE PURCHASE ITEM DETAILS FROM THE EKPO DB TABLE. THE SCREENSHOTS OF THE OUTPUT IS DEFINED BELOW:


/wp-content/uploads/2014/03/img_8_412036.jpg



/wp-content/uploads/2014/03/img_9_412058.jpg



/wp-content/uploads/2014/03/img_10_412059.jpg


CLICK ON THE LEFT HAND SIDE OF THE ROW YOU WANT TO SELECT.



/wp-content/uploads/2014/03/img_11_412060.jpg




/wp-content/uploads/2014/03/img_12_412085.jpg



THANKS & REGARDS,

JOYJIT BISWAS

To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply