Beruflich Dokumente
Kultur Dokumente
Prepared by:
Pallavi Gupta (Emp. Code 00662K)
Email ID Palgupt2@in.ibm.com
Contents
Use of Assistance Class:..............................................................................................
Advantages of Assistance Class:...................................................................................
Overview...................................................................................................................
Creation of DDIC Objects............................................................................................
Creation of Assistance Class........................................................................................
Add Inheritance.........................................................................................................
Create Methods in the Class.........................................................................................
Create Text Elements..................................................................................................
Create WebDynpro Component....................................................................................
Object for the Class....................................................................................................
Code.........................................................................................................................
Test..........................................................................................................................
Create Application...................................................................................................
Reference(s)..............................................................................................................
Overview
In this Document, Ill display the sales document details. The user will have to enter
the creation date; all the documents with that creation date will be displayed. When
user selects any particular sales document, the line items of that particular sales
document will be displayed
Steps:
Creation of DDIC Objects
Create 2 structures as show below in SE11.
Click on create.
Add Inheritance
Note: All the assistance classes inherit from CL_WD_COMPONENT_ASSISTANCE.
To add the name of the superclass, click on the button next to class name field, a
new field for superclass will appear. Add the name of the superclass.
Click on Save.
Click on create.
Add Inheritance
Note: All the assistance classes inherit from CL_WD_COMPONENT_ASSISTANCE.
To add the name of the superclass, click on the button next to class name field, a
new field for superclass will appear. Add the name of the superclass.
Click on Save.
The assistance is ready to be used. We can test the working of our class by clicking
the execute button.
Double click on the component name. In the Assistance class field, add the name of
the class.
Create 2 string attributes: TEXT1 and TEXT2. These will be used to display the
dynamic texts. Finally the nodes and attributes would look this:
Insert 2 Table UI elements. One to display the header lines of the sales documents
and other to display the line items of the selected sales document.
Create a button UI element, and create an onAction event hander with the name
ONSEARCH.
Create an OnLeadSelect event handler for the first table. This event handler will be
called every time when a row in the first table is selected.
Bind the Caption of both the tables with attribute TEXT1 and TEXT2 respectively.
Code
Go the WDDOINIT method of the view and use the following code:
The following code calls the IF_WD_COMPONENT_ASSISTANCE~GET_TEXT method
of the assistance class. This method takes the message number as input and
returns the text element corresponding to it. These texts are then set to TEXT1
and TEXT2 attribute and will appear on the caption of the table.
method WDDOINIT .
data: header1
header2
Elem_Context
Stru_Context
Item_TEXT1
*
type string,
type string,
type ref to If_Wd_Context_Element,
type If_Main_View=>Element_Context,
like Stru_Context-TEXT1.
endmethod.
endmethod.
button.
Give the instance name (object name) of the class, which is WD_ASSIST in our
case. Provide the class name and method to be called. Code will be generated by
the system.
Use the following code on the OnLeadSelect method of the first table.
The following code will get the selected sales document number (VBELN) and will
pass it to the GET_SALES_DOCUMENT_DETAILS method of the class to get the line
items corresponding to that sales document number.
method ONACTIONONSELECT .
data:
Node_Vbak
type ref to If_Wd_Context_Node,
Elem_Vbak
type ref to If_Wd_Context_Element,
Stru_Vbak
type If_Main_View=>Element_Vbak ,
Node_Vbap
type ref to If_Wd_Context_Node,
Elem_Vbap
type ref to If_Wd_Context_Element,
Stru_Vbap
type If_Main_View=>Element_Vbap ,
it_vbap
type zvbap_tt.
* navigate from <CONTEXT> to <VBAK> via lead selection
Node_Vbak = wd_Context->get_Child_Node( Name = IF_MAIN_VIEW=>wdctx_V
bak ).
*
endmethod.
Test
Create Application
Right click on the component name. Create WebDynpro application.
Save it.
Right click on application Test.
Initial Screen
Enter the
creation
date and click on Search button. Sales documents created on that date gets
displayed.
Select any sales document, line items corresponding to that sales document gets
displayed.
Reference(s)
1. Project Experience
2. http://www.sdn.sap.com/
3. http://help.sap.com