Let’s Web Dynpro. Part V

Web Dynpro. Part V. To a limited extent IV, we figured out how to make the components noticeable as we really want them and furthermore figured out how to make the compulsory fields toss mistake message. Till now we managed the straightforward table result. In this part, we would perceive how we can show the equivalent plain result in ALV. For ALV show in Web Dnypro ABAP, we want to do “Part Utilization“.

One more new term in Web Dynpro.. .. The Internet Dynpro structure furnishes us with a strategy called ‘Part Utilization’, with the assistance of which we can reuse the occasions, techniques and setting of one WD part into another WD part. In basic words, Part Utilization implies reuse of currently evolved existing Web Dynpro. Part V Parts (standard or potentially custom). Very much like, we utilize standard “REUSE_ALV_GRID_DISPLAY” capability module to show our ALV in ordinary ABAP, correspondingly we can utilize standard Web Dynpro. Part V “SALV_WD_TABLE”. Very much like “REUSE_ALV_GRID_DISPLAY” has table “T_OUTTAB” where we can relegate ANY kind of interior table, comparatively in WD “SALV_WD_TABLE” has a setting hub called “Information” where we can tie setting of ANY sort.

We need to use:
a) Interface View ‘TABLE’ of component SALV_WD_TABLE
b) Interface node ‘DATA’ of component SALV_WD_TABLE.

The other very oftenly used standard components are WDR_OVS (for Object Value Selector OVS) and WDR_SELECT_OPTIONS (for select options).

Allow us to utilize similar model we did To a limited extent III. This time we are announcing worldwide settings in ComponentController (excessive, only for showing).

1

Drag these hubs in the primary View and presently they are accessible in the view (very much like we pass factors as boundaries in the Subroutine/Performs to make those variable accessible in the subroutines).

2

Trust, at this point you know how to make button and connection it to an activities (screen shot beneath in the event that you neglected).

3
4

For showing the ALV yield, we can utilize View Compartment UI Component (figure above). The View Compartment UI Component need NOT be bound to any setting here. We will show later the way things are bound.

5

Trust you have bound any remaining screen components.

On Execute button, we really want to do three stages.

  • Peruse information entered in the screen (fig underneath).
  • Utilize the information entered in screen to remove information from data set (in this model VBAK).
  • Tie the removed information to the result setting hub (it would show the last result) (fig underneath).
6
7

* Code Snippet

METHOD onactionexecute .

* Read data entered in screen
DATA lo_nd_cn_sel_screen TYPE REF TO if_wd_context_node.
DATA lo_el_cn_sel_screen TYPE REF TO if_wd_context_element.
DATA ls_cn_sel_screen TYPE wd_this->element_cn_sel_screen.
DATA lo_nd_cn_result TYPE REF TO if_wd_context_node.
DATA lt_cn_result TYPE wd_this->elements_cn_result.

lo_nd_cn_sel_screen = wd_context->get_child_node( name = wd_this->wdctx_cn_sel_screen ).
* get element via lead selection
lo_el_cn_sel_screen = lo_nd_cn_sel_screen->get_element( ).
* 1. Read data entered in the screen.
lo_el_cn_sel_screen->get_static_attributes(
IMPORTING
static_attributes = ls_cn_sel_screen ).

* 2. Use the data entered in screen to extract data from database
* Select from VBAK with the input screen fields
SELECT
vbeln ” Sales Document
erdat ” Date on Which Record Was Created
ernam ” Name of Person who Created the Object
auart ” Sales Document Type
FROM vbak
INTO TABLE lt_cn_result
WHERE ernam = ls_cn_sel_screen-userid
AND erdat GE ls_cn_sel_screen-from_date
AND erdat LE ls_cn_sel_screen-to_date.
IF lt_cn_result[] IS NOT INITIAL.
* Keep the extracted data in a context node (table) bound to ALV
lo_nd_cn_result = wd_context->get_child_node( name = wd_this->wdctx_cn_result ).

* 3. Bind the extracted data to the output result context node
lo_nd_cn_result->bind_table( new_items = lt_cn_result set_initial_elements = abap_true ).
ENDIF.

ENDMETHOD.

The View Compartment UI Component is as yet not bound to any specific situation. So the last step is to connect a setting to the last result. For this we would use the generally existing standard WD Part, SALV_WD_TABLE.

Make a part use. In this model the name is CU_DETAIL of WD Part SALV_WD_TABLE. Naming show CU_ for Part Use. If it’s not too much trouble, note in the left side board new Part Uses credits (CU_DETAIL) get made. Save/Actuate the progressions done work now.

8
10

Go to the Window W_MAIN. On the right side, right snap on the W_MAIN window and select Install View. Pick the view V_MAIN. View V_MAIN alongside the View Compartment UI component is implanted in the Window. Presently right snap on the View Compartment VC_RESULT and picked Insert View select Part Utilization View TABLE. Your window is connected to standard part SALV_WD_TABLE’s TABLE view.

10_2
11
12
13

Presently we want to tie the result information to the setting of the SALV_WD_TABLE. The setting we would be restricting to is “Information”. Click on the INTERFACECONTROLLER of the Part Use CU_DETAIL. Really take a look at the symbol under “Information” in setting has single bolt underlined. Presently we want to tell the SALV_WD_TABLE, what information would be bound to the “Information” setting. In our model, CN_RESULT setting has the last information, thus, we drag CN_RESULT from right to the “Information” setting on the left.

18

Check, the bolt is two way now and furthermore you ought to receive the message “Outside planning for setting component “Information” was characterized”.

Save and Initiate your part. You are finished.

Allow us to try out child.

21

This is one of the most straightforward method for showing ALV. In genuine venture situations, you seldom utilize one ALV yield. In the following parts, we would investigate numerous ALVs and furthermore various highlights of the ALV list; like onclick of a column/field, make the ALV show/input just, enact/deactive standard elements of ALV, put custom buttons programatically and so on.

Kindly let us know, on the off chance that you face any issue in any of the means. We would very much love to expound them.

Thank you kindly for your time!!

 

YOU MAY BE INTERESTED IN

How to check your custom ABAP code for SAP BTP ABAP Environment

Tips for Building Custom SAP Applications: A Comprehensive Guide

Is SAP ABAP a High Paying Job?

X
WhatsApp WhatsApp us