Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Introduction:
The CL_SALV_TABLE class is part of the ALV Object Model which was introduced in Net Weaver
2004. Basically it is an encapsulation of the pre-existing ALV tools. For example the class
CL_SALV_TABLE actually wraps around the CL_GUI_ALV_GRID class for container
implementation, as well as the REUSE_ALV_GRID_DISPLAY and REUSE_ALV_LIST_DISPLAY
function modules for full screen display.
It was designed to be a single point of entry when using a specific ALV tool such as the ALV
table display, ALV hierarchical sequential list, and tree ALV. All of these individual ALV tools
have their own base class, for table it is the CL_SALV_TABLE, but all have a common look. A lot
of the methods are the same, with only some differences in the parameters of the methods
depending on the actual tool you are using.
So to summarize, the ALV Object Model was delivered to give a more collective interface to the
ALV tools. There are limitations in the ALV Object Model, for example, you can NOT color a line
or a cell, but you can color a column. Also, you can NOT have an editable ALV using the Object
Model.
For sorting and subtotals, you use a total of nine levels or columns.
For columns that can be aggregated, note that the internal length of the column is large
enough for both single values and the result.
The output is column-oriented. You are only able to display flat, structured tables. You are not
able to display nested tables.
Tables displayed with ALV are not ready for input.
If you insert the table as grid in container, you are not able to use batch mode (background)
MVC Requirement
Design Pattern: is a set of rules using which the code can be implemented.
Design Patterns in ABAP Objects:
2. MVC Design Pattern - --> In this, we need to separate the business logic with presentation
logic
View ---> responsible for generating the content to the user (output)
3. Factory Design Pattern - ---> hides the complexity of instantiating the objects
MVC (Model View Controller) Design pattern: The aim of MVC design pattern is to separate
the business logic and presentation logic, so that in future, changes can be made to business
logic and presentation logic without having much dependency.
Requirement: Develop an interface using MVC Design pattern to display the sales orders data
in the selected format.
Attribute tab:
Note: ‘ZTVBAK’ is table type associated with dictionary structure ‘ZCVBAK’ with the fields vbeln,
erdat, erzet, ernam
Method tab:
After copying the standard dictionary structure ‘RSDSSELOPT’ to the custom dictionary
structure ‘ZSTRERDAT’, replace the data elements of low and high fields to ‘ERDAT’.
Implementation for method ‘getsalesorders’:
method getsalesorders.
select vbeln erdat erzet ernam
from vbak
into table gt_vbak
where erdat between i_erdat-low and i_erdat-high.
endmethod.
Attribute Tab:
Method tab:
Implementation for method ‘createmodelobject’ :
method createmodelobject.
create object o_model.
endmethod.
T-code: SMARTFORMS
Save and activate the smartform Generates function module dynamically
report z730view.
initialization.
create object o_ctrl.
form getmodelobject .
call method o_ctrl->createmodelobject.
endform. " GETMODELOBJECT
form getdata .
call method o_ctrl->o_model->getsalesorders
exporting
i_erdat = so_erdat.
form displayalvreport .
data o_alv type ref to cl_salv_table.
try.
call method cl_salv_table=>factory "uses factory design pattern
importing
r_salv_table = o_alv
changing
t_table = o_ctrl->o_model->gt_vbak.
catch cx_salv_msg .
message 'Exception in creating ALV object' type 'I'.
endtry.
form displayclassicalreport .
data wa_vbak type zcvbak.
leave to list-processing.
format color 3.
loop at o_ctrl->o_model->gt_vbak into wa_vbak.
write :/ wa_vbak-vbeln,
wa_vbak-erdat,
wa_vbak-erzet,
wa_vbak-ernam.
endloop.
format color off.
endform. " DISPLAYCLASSICALREPORT
form displaysmartform .
* get the smartform function module name
data lv_fname type rs38l_fnam.
call function 'SSF_FUNCTION_MODULE_NAME'
exporting
formname = 'Z730SFORM'
importing
fm_name = lv_fname.
In the program, choose goto menu text elements selection texts (construct appropriate
text)