Grouping and input columns ALV
HI ,
my requirement is to group the columns that have same value in my ALV ( like fonction sort/subtotal in standard ALV) and have other input coloums in my ALV .
I observe that groupement don't work if have one of columns as input .
have you any idea to have on the same time grouping fonction and other iput columns , on my ALV grid
thanks
There is a layout property cell_merge in ALV layout. You can try with that. But not sure whether it works with a editable column.
Kesav
Similar Messages
-
Groups and Multi Column Reports
I'm using CR for .Net 2003. I've been running into a problem with the grouping feature, where groups are spanning multiple columns and are not being kept together, but only when spanning b/w columns. However, the groups aren't being broken between pages. Anyone else running into this? Here's my setup:
Page Header
Group Header
Details
Group Footer
Page Footer
The "Group Header", "Details" and "Group Footer" are all set to Keep Together in the Selection Expert. The layout of the "Details" section has "Format Groups with multiple Columns" checked. (I only have two columns) And my group options has the option "Keep Group Together" selected.
I was under the impression that if I have "Keep Group Together" it would keep the group together regardless of an end of page, or an end of column...but, maybe I have something misconfigured.
advTHANKSance for any help!Confirm version of Crystal Reports and version of .NET.
Also, have you applied any Service Packs to your version of CR?
Ludek -
Group and Owner fields blank when viewing Service Request results via UWQ
When looking at a row that represents a service request in either the UWQ or View Service Requests (search form) the group and owner columns are blank only for some of my users.
If you look at the detail for the SR, there is a owner and group.
Not sure what the issue is..? Inherited this role.
-JPWhich release is this occuring? At the first glance it looks like an issue that cropped up in 11.5.3. and has been fixed since.
-
"Custom" grouping and / or colored lines in ALV
Hi!
Two questions:
1. Is it possible to use colors in the ALV for a given set of rows? I'd like to mark rows with a color, which are logically belongs together.
2. Other approach would be to sort the ALV and via that the "similar" rows (i.e. some column values in the rows have the same value ) would be grouped.
The normal ALV grouping feature is too general. E.g if the ALV contains a lot of empty cells, then those cells will be grouped as well, nevertheless they are logically don't belong together -> looks quite weird.
If the custom grouping cannot be realized, then my approach would be the following:
1. Sorting the table. -> rows where the content partially equal are in succession.
2. Manually clear the cells in the second (in my business case only two lines can be partially equal, others are unique) row, which are the same as in the previous row.
3. Use coloring to indicate that these two lines are belonging together.
Best regards,
PeterHi Peter,
It is possible to assign colors to a specific row. But you need to have some work around.
You have to create an extra attribute for each column that you have in your table. The type of that attribute should be of WDUI_TABLE_CELL_DESIGN.
After Instatiating your ALV Component you have to use the following statement for the column that you have to apply the color.
ls_column-r_column->set_cell_design_fieldname( COLUMN1_DESIGN ). Assuming ls_column-r_column will have COLUMN1 as filed name.
There are 16 colors that are defined and each combination from '00' to '15' will define one color.
Look at the structure below. Its a table with 4 columns(2nd and 4th represents colors for first and third columns)
value11 00 value12 00
value21 00 value22 00
value31 02 value32 02.
If you consider the above struture as your output table 3 rows and 4 columns then your third row will be highlighted in green color because 02 represents green. You can hide your second column and fourth column in above example because they represents colors. Use the following statement to hide those columns.
ls_column-r_column->set_visible(
cl_wd_uielement=>e_visible-none ). "ls_column-r_column will have 'COLUMN1_DESIGN'
Let me know if you know more code.
Thank You,
Gajendra. -
How to do the ALV report output in groups and caluculate the tOTALS(URGENT
Hi
In my ALV report output .I have to group the output based on the DAYS field
0-10 days in one group
10-30 days in one group
above 30 days one group
There is also a field by name "AMOUNT" in my output.
I have to calculate SUBTOTALs at the end of every group and at the end of the report i should caluculate GRAND TOTAL.
Please remember that i should not use any any BLOCKED ALVs and for Totals i should not use the SYMBOLS provided in the application toolbar of the report
Thanks in AdvancePlease don't repost your questions...
Check out my answer in your other post.
How to make the ALV report in groups and caluculate the TOTALS
Regards,
Naimesh Patel -
I am developing an ETL tool which has to create SSIS packages dynamically (and later execute them without being edited in Data Tools). One of my proto type scenarios is a simple data flow from a flat file to a flat file - without anything in between.
However there is a problem with the columns of the flat file destination - it says it doesn't have any.
Saving the package to XML and opening the destination component in the advanced editor (tab "Input and Output Properties") really shows that are no input columns defined. One click on the tab "Column Mappings" however solves the
problem. The columns and the mapping are generated, the package can run.
I already tried to place "ReinitializeMetaData()" calls nearly anywhere in the code, for both components, unfortunately without success:
destinationComponentWrapper.AcquireConnections(null);
destinationComponentWrapper.ReinitializeMetaData();
destinationComponentWrapper.ReleaseConnections();
The actual error during validation is (When the line for column mapping in the code below is commented out):
"0xC020201B - The number of input columns for Flat File Destination.Inputs[Flat File Destination Inputs] cannot be zero"
I am also trying to insert a column mapping - this leads to a com error: 0xC020201B
In this case I am wondering why Data Tools tell me that there are no input columns yet I can iterate over them - they just don't have a valid ID (0x8000004B / -2147483573) which is then causing the 0xC020201B.
See also "PROBLEM HERE" marker in the code below.
How can I make the destination component recognize the columns programmatically, as when I click on the "Column Mappings" tab of the advanced editor of the component in Data Tools?
Here is the complete proto type code:
using Microsoft.SqlServer.Dts.Pipeline.Wrapper;
using Microsoft.SqlServer.Dts.Runtime;
using Microsoft.SqlServer.Dts.Runtime.Wrapper;
using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Dts = Microsoft.SqlServer.Dts;
namespace msdatapipe
class Program
static void Main(string[] args)
Dts.Runtime.Application application = new Dts.Runtime.Application();
Dts.Runtime.Package package = new Dts.Runtime.Package();
package.Name = "Data Commander DTS Package";
// ADD PIPELINE TASK
Dts.Runtime.Executable pipelineExecutable = package.Executables.Add("STOCK:PipelineTask");
Dts.Runtime.TaskHost pipelineTaskHost = (Dts.Runtime.TaskHost)pipelineExecutable;
pipelineTaskHost.Name = "Data Commander Pipeline Task";
Dts.Pipeline.Wrapper.MainPipe pipelineTask = (Dts.Pipeline.Wrapper.MainPipe) pipelineTaskHost.InnerObject;
// ADD SOURCE COMPONENT TO THE PIPELINE TASK
String sourceFilePath = "C:\\cmi\\tmp\\data.csv";
Dts.Runtime.ConnectionManager sourceConnectionManager = package.Connections.Add("FLATFILE");
sourceConnectionManager.ConnectionString = sourceFilePath;
sourceConnectionManager.Name = "Source Connection";
sourceConnectionManager.Description = "Source Connection Manager";
sourceConnectionManager.Properties["ColumnNamesInFirstDataRow"].SetValue(sourceConnectionManager, "True");
sourceConnectionManager.Properties["Format"].SetValue(sourceConnectionManager, "Delimited");
sourceConnectionManager.Properties["TextQualifier"].SetValue(sourceConnectionManager, "\"");
sourceConnectionManager.Properties["CodePage"].SetValue(sourceConnectionManager, "65001");
sourceConnectionManager.DelayValidation = false;
// START --- MANUALLY READ COLUMNS FROM TEXT FILE AND ADD TO SOURCE CONNECTION MANAGER COLUMNS
IDTSConnectionManagerFlatFile100 sourceConnectionInterface = sourceConnectionManager.InnerObject as IDTSConnectionManagerFlatFile100;
using (StreamReader reader = new StreamReader(sourceFilePath))
String firstSourceFileLine = reader.ReadLine();
String[] columnNames = firstSourceFileLine.Split(',');
for (int i = 0; i < columnNames.Length; ++i)
columnNames[i] = columnNames[i].Substring(1, columnNames[i].Length - 2);
IDTSConnectionManagerFlatFileColumns100 sourceColumns = sourceConnectionManager.Properties["Columns"].GetValue(sourceConnectionInterface) as IDTSConnectionManagerFlatFileColumns100;
IDTSConnectionManagerFlatFileColumn100 column = null;
foreach (String columnName in columnNames)
column = sourceColumns.Add();
column.DataType = DataType.DT_TEXT;
column.ColumnDelimiter = ",";
column.TextQualified = true;
(column as IDTSName100).Name = columnName;
Console.WriteLine(columnName);
column.ColumnDelimiter = "\r\n";
// END --- MANUALLY READ COLUMNS FROM TEXT FILE AND ADD TO SOURCE CONNECTION MANAGER COLUMNS
sourceConnectionInterface.RowDelimiter = "\r\n";
Dts.Pipeline.Wrapper.IDTSComponentMetaData100 sourceComponent = pipelineTask.ComponentMetaDataCollection.New();
sourceComponent.Name = "Flat File Source";
sourceComponent.ComponentClassID = "DTSAdapter.FlatFileSource";
sourceComponent.ValidateExternalMetadata = true;
CManagedComponentWrapper sourceComponentWrapper = sourceComponent.Instantiate();
sourceComponentWrapper.ProvideComponentProperties();
// LINK CONNECTION TO THE SOURCE COMPONENT
sourceComponent.RuntimeConnectionCollection[0].ConnectionManager = Dts.Runtime.DtsConvert.GetExtendedInterface(sourceConnectionManager);
sourceComponent.RuntimeConnectionCollection[0].ConnectionManagerID = sourceConnectionManager.ID;
// Connect to the data source, and then update the metadata for the source.
//sourceComponentWrapper.Validate();
//sourceComponentWrapper.ProvideComponentProperties();
sourceComponentWrapper.AcquireConnections(null);
sourceComponentWrapper.ReinitializeMetaData();
sourceComponentWrapper.ReleaseConnections();
// ADD DESTINATION CONNECTION MANAGER
Dts.Runtime.ConnectionManager destinationConnectionManager = package.Connections.Add("FLATFILE");
destinationConnectionManager.ConnectionString = "C:\\cmi\\tmp\\data_out.csv";
destinationConnectionManager.Name = "DatComConOut";
destinationConnectionManager.Description = "Data Commander Connection Manager";
destinationConnectionManager.DelayValidation = false;
destinationConnectionManager.Properties["Format"].SetValue(destinationConnectionManager, "Delimited");
destinationConnectionManager.Properties["TextQualifier"].SetValue(destinationConnectionManager, "\"");
destinationConnectionManager.Properties["CodePage"].SetValue(destinationConnectionManager, "65001");
// ADD DESTINATION COMPONENT
Dts.Pipeline.Wrapper.IDTSComponentMetaData100 destinationComponent = pipelineTask.ComponentMetaDataCollection.New();
destinationComponent.Name = "Flat File Destination";
destinationComponent.ComponentClassID = "DTSAdapter.FlatFileDestination";
destinationComponent.ValidateExternalMetadata = true;
CManagedComponentWrapper destinationComponentWrapper = destinationComponent.Instantiate();
destinationComponentWrapper.ProvideComponentProperties();
destinationComponent.RuntimeConnectionCollection[0].ConnectionManager = Dts.Runtime.DtsConvert.GetExtendedInterface(destinationConnectionManager);
destinationComponent.RuntimeConnectionCollection[0].ConnectionManagerID = destinationConnectionManager.ID;
// CREATE PATH
Dts.Pipeline.Wrapper.IDTSPath100 pipelinePath = pipelineTask.PathCollection.New();
pipelinePath.AttachPathAndPropagateNotifications(sourceComponent.OutputCollection[0], destinationComponent.InputCollection[0]);
// DESTION CONNECTION MANAGER COLUMNS
IDTSConnectionManagerFlatFile100 destinationConnectionInterface = destinationConnectionManager.InnerObject as IDTSConnectionManagerFlatFile100;
IDTSConnectionManagerFlatFileColumns100 destinationColumns = destinationConnectionManager.Properties["Columns"].GetValue(destinationConnectionManager) as IDTSConnectionManagerFlatFileColumns100;
// START --- MANUALLY READ COLUMNS FROM DESTINATION COMPONENT AND ADD THEM TO DESTIONATION CONNECTION MANAGER COLUMNS
foreach (IDTSInput100 input in destinationComponent.InputCollection)
IDTSVirtualInput100 virtualInput = input.GetVirtualInput();
IDTSConnectionManagerFlatFileColumn100 column = null;
foreach (IDTSVirtualInputColumn100 virtualInputColumn in virtualInput.VirtualInputColumnCollection)
column = destinationColumns.Add();
column.DataType = DataType.DT_TEXT;
column.ColumnDelimiter = ",";
column.TextQualified = true;
(column as IDTSName100).Name = virtualInputColumn.Name;
column.ColumnDelimiter = "\r\n";
// END --- MANUALLY READ COLUMNS FROM DESTINATION COMPONENT AND ADD THEM TO DESTIONATION CONNECTION MANAGER COLUMNS
// NEED TO CREATE NEW META DATA AFTER COLUMNS
destinationComponentWrapper.AcquireConnections(null);
destinationComponentWrapper.ReinitializeMetaData();
destinationComponentWrapper.ReleaseConnections();
// MAP INPUT COLUMNS
foreach (IDTSInput100 input in destinationComponent.InputCollection)
IDTSVirtualInput100 virtualInput = input.GetVirtualInput();
foreach (IDTSVirtualInputColumn100 virtualInputColumn in virtualInput.VirtualInputColumnCollection)
Console.WriteLine("VIC " + virtualInputColumn.Name + "(" + virtualInputColumn.ID + ")");
destinationComponentWrapper.SetUsageType(input.ID, virtualInput, virtualInputColumn.LineageID, DTSUsageType.UT_READONLY);
foreach (IDTSExternalMetadataColumn100 metadataColumn in input.ExternalMetadataColumnCollection)
if (virtualInputColumn.Name.Equals(metadataColumn.Name)) {
// PROBLEM HERE:
// An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in msdatapipe.exe
// Additional information: Exception HRESULT: 0xC0047072
// at this point is virtualInputColumn.ID = -2147483573
destinationComponentWrapper.MapInputColumn(input.ID, virtualInputColumn.ID, metadataColumn.ID);
// if the code is commented out and the program rerun there is a package validation error instead: 0xC020201B
// 0xC020201B - The number of input columns for Flat File Destination.Inputs[Flat File Destination Inputs] cannot be zero
// NEED TO CREATE META DATA AFTER COLUMNS HAVE BEEN ADDED TO THE DESTIONATION MANAGER
// AND USAGE TYPE HAS BEEN SET OR WE'LL GET A VS_NEEDSNEWMETADATA
destinationComponentWrapper.AcquireConnections(null);
destinationComponentWrapper.ReinitializeMetaData();
destinationComponentWrapper.ReleaseConnections();
// SAVING DTSX PACKAGE FOR DEBUGGING
application.SaveToXml("C:\\Users\\CMI\\documents\\visual studio 2010\\Projects\\SSIS Tutorial\\SSIS Tutorial\\generated.dtsx", package, null);
Microsoft.SqlServer.Dts.Runtime.DTSExecResult packageResults = package.Execute();
Console.WriteLine("package execution result: " + packageResults.ToString());
// Basic check for errors
foreach (DtsError error in package.Errors)
Console.WriteLine("ErrorCode : 0x{0:X}", error.ErrorCode);
Console.WriteLine(" SubComponent : {0}", error.SubComponent);
Console.WriteLine(" Description : {0}", error.Description);
Console.WriteLine("press the return key hard to continue...");
Console.Read();I suggest you revise your code against examples given in http://blogs.msdn.com/b/mattm/archive/2008/12/30/samples-for-creating-ssis-packages-programmatically.aspx
Arthur My Blog -
Is it possible to have sorting by group and checkboxes in the same ALV
Hi there,
Does anyone know whether it is possible to have sorting and group on one field in ALV and checkboxes set on another field in ALV?
eg.
Fieldname
===========
Name----
Text
Allowance----
Numeric -> Sort & Group
Verified----
Checkbox
How do I code it if it is possible to have grouping and check box all in one ALV. Meaning I want some data that are the same to merge using sort, while still having the checkbox available for my other field (Verified).
Thanks in advance.
Lawrencehi,
GROUP BY clause is used on database tables with select statement.
sort is used on internal tables.
can u clearly explain y u need group by and sort on the same field.
if u are extracting from dbtable using grou by clause on a field, then no need to sort it again.
if u want sort u can do it by giveing "sort itab by field". thats not a problem.
now coming to check box.instead of using SLIS type field catalog, u use LVC type.
in LVC_S_LAYO, u can fine box_fname.
while defining layout, u declare a variable of type LVC_S_LAYO
AND GIVE BOX_FNAME = internal table field name -
How to write a query for grouping them the columns and give the sequence order to each group/
Hi i have table that contains country columns .
India,USA,UK like these when ever the group changed into the differt country i make a group and arrange them the sequence into those Countries
like below
1)India
2)India
1)USA
2)USA
like these to write a query ..........pls help me for this queryAssuming you're using SQL Server you can ask here:
http://www.sqlteam.com/forums/forum.asp?FORUM_ID=23
Otherwise, please ask in the relevant forum for the type of technology you're using.
Basically it's either:
select *
from [table name]
order by country
If you want to do something with groups do something like:
select (max) income, country
from [table name]
group by country
Kind regards,
Margriet Bruggeman
Lois & Clark IT Services
web site: http://www.loisandclark.eu
blog: http://www.sharepointdragons.com -
Drag And Drop in ALV Column Tree
Hello All,
Can anyone tell me the method used for a drag and drop in a column tree....
i found it for a simple tree but not for a column tree.....
thanks in advance....
Regards,
PraveenCheck the links -
drag drop required for alv column!
drag and drop in a tree
Drag&Drop within the Tree
Drag&Drop within a tree
Drag and drop in ALV tree
Regards,
Amit
Reward all helpful replies. -
Selecting both - Column and Rows in ALV Grid
Hi All,
I am developing a module pool in which in a ALV Grid Display the user wants to select multiple rows and multiple columns.
How to set this in ALV grid? Right now I can set selection of multiple rows but once user clicks on column the rows are deselected and the column gets selected.
Similarly when user selects on one column and clicks on another column the previous selected column gets deselected.
Is there any way to do this in ALV Grid?
Thanks,
Rashmi.
PS: I am using OO ALV for this development.Hi Andrey,
I know this. I was just trying to find out if there is some other alternative to this.
Anyways, this seems to be the only choice.
Thanks,
Rashmi. -
Cant we do group and subtotal on a column which is having Go-URL in OBIEE
Hi,
I have a scenario that a report should show subtotal on amount column for different sales reps. At the same time, I have used GO URL for that sales rep column.
In the GO URL Code, I have passed 4 columns as parameters. So the report is doing grouping on those columns also and showing subtotals at those column levels.
Please help me out.
Thanks,
SiriTry these:
SUM(SUM("Activity Metrics"."# of Closed Activities" by Employee."Employee Name") by task result)
or
SUM("Activity Metrics"."# of Closed Activities" by Employee."Employee Name"||task result)
Mike L -
Grouping and UnGrouping of JTable Rows?
Hi,
Has somebody done Grouping and UnGrouping of JTable Rows as we find in MS-Excel.
Thanks & regards
blueHi,
Have anyone done something like this.
If u r not clear about the requirement:
Please see the screenshot uploaded at below url:
[http://www.geocities.com/coolneela/GroupableTable.JPG]
As shown the screenshot i want the Group 1 ,2,3 to be expandable and hideable i.e should behave like a Jtree node.....In rest of the column User can enter any input i.e for the columns A,B,C..
thanks & regards
Neel -
Hello All,
Is it possible to have a user input in ALV grid. I know there can be editable columns/cells but suppose the application demands an input field to be placed in ALV Grid where the user will enter some value.
Could someone please suggest if this can be done.
Regards
IndrajitHere's THE definitive way to do it.
This little proggy demonstrates the following.
1) Create a DYNAMIC FCAT for an internal table with USER defined fields (i.e non ddic) and colour some columns in the FCAT.
2) Create a DYNAMIC TABLE.
3) Define a subclass of CL_GUI_ALV_GRID so you can access some very useful protected methods and attributes - you can get original and changed table IN ROWS which is a lot easier sometimes than messing around with individual
cells.
4) Create extra buttons on the toolbar.
5) Define EVENT handlers including data change so you can get control when the user enters data. YOU DON'T NEED PAI anymore with event handlers.
6) Call methods in your subclass of CL_GUI_ALV_GRID (you can also call methods in CL_GUI_ALV_GRID by virtue of Inheritance) from methods in your event handler class.
7) Display an editable Grid.
This method will work for almost any conditions you need to use.
I'm sure this covers all the bases -- please reply if any queries.
Run the program, click on the EDIT button and enter your data. Press ENTER when done.
All you need to do is copy this code and create one empty screen (SE51) with a custom container called CCONTAINER1 with the following logic in it.
PROCESS BEFORE OUTPUT.
MODULE STATUS_0100.
PROCESS AFTER INPUT.
MODULE USER_COMMAND_0100.
(In the program you don't actually do anything in the PAI as the event handler takes care of this)
Now here's the program
PROGRAM zdynfieldcat.
class zcltest definition deferred. "For field symbol reference.
Simple test of dynamic ITAB with user defined (not ddic) fields
Build dynamic fcat
Table structure obtained via new RTTI functionality
use ALV grid to display and edit.
Create a blank screen 100 with a custom container called CCONTAINER1.
Define field symbols as these can't be defined in classes
field-symbols: <dyn_table> type standard table,
<g2> type ref to zcltest,
<g1> type ref to cl_gui_custom_container,
<actual_tab> type standard table,
<outtab> type table,
<fs1> type ANY,
<FS2> TYPE TABLE,
<fs3> type table,
<fs4> type table,
<fs5> type table.
class zcltest definition inheriting from cl_gui_alv_grid.
define this as a subclass so we can access the protected attributes
of the superclass cl_gui_alv_grid
public section.
types: g4 type ref to cl_gui_custom_container.
types: g3 type ref to cl_alv_changed_data_protocol.
data: i_parent type g4,
lr_rtti_struc TYPE REF TO cl_abap_structdescr, "RTTI
zog like line of lr_rtti_struc->components. "RTTI
types: struc like zog.
types: struc1 type table of struc.
methods:
constructor
importing i_parent type g4,
disp_tab
importing p_er_data_changed type g3,
create_dynamic_fcat
importing zogt type struc1
exporting it_fldcat type lvc_t_fcat.
Protected section.
data: stab type ref to data,
wa_it_fldcat type lvc_s_fcat,
c_index type sy-index.
endclass.
class zcltest implementation.
METHOD constructor.
CALL METHOD super->constructor
EXPORTING
i_appl_events = 'X'
i_parent = i_parent.
endmethod.
method disp_tab.
mt_outtab is the data table held as a protected
attribute in class cl_gui_alv_grid.
assign me->mt_outtab->* TO <outtab>. "Original data
assign p_er_data_changed->mp_mod_rows TO <FS1>.
stab = p_er_data_changed->mp_mod_rows.
assign p_er_data_changed->mt_inserted_rows to <fs3>.
assign p_er_data_changed->mt_deleted_rows to <fs4>.
assign p_er_data_changed->mt_mod_cells to <fs5>.
assign stab->* TO <fs2>.
do whatever you want with <outtab>
contains data BEFORE changes each time.
Note that NEW (Changed) table has been obtained
already by call to form
check_data USING P_ER_DATA_CHANGED
TYPE REF TO CL_ALV_CHANGED_DATA_PROTOCOL.
Entered data is in table defined by <fs2>
In this method you can compare original and changed data.
Easier than messing around with individual cells.
do what you want with data in <fs2> validate / update / merge etc
endmethod.
method create_dynamic_fcat.
loop at zogt into zog.
c_index = c_index + 1.
clear wa_it_fldcat.
wa_it_fldcat-fieldname = zog-name .
wa_it_fldcat-datatype = zog-type_kind.
wa_it_fldcat-inttype = zog-type_kind.
wa_it_fldcat-intlen = zog-length.
wa_it_fldcat-decimals = zog-decimals.
wa_it_fldcat-coltext = zog-name.
wa_it_fldcat-lowercase = 'X'.
if c_index eq 2.
wa_it_fldcat-emphasize = 'C411'.
endif.
if c_index eq 3.
wa_it_fldcat-emphasize = 'C511'.
endif.
append wa_it_fldcat to it_fldcat .
endloop.
endmethod. "create_dynamic_fcat
endclass. "zcltest IMPLEMENTATION
class lcl_grid_event_receiver definition.
public section.
note that zcltest inherits all of events etc from
class cl_gui_alv_grid so specify event handler for
zcltest.
methods:
handle_data_changed
for event data_changed of zcltest
importing er_data_changed,
toolbar
for event toolbar of zcltest
importing e_object
e_interactive,
user_command
for event user_command of zcltest
importing e_ucomm.
endclass.
class lcl_grid_event_receiver implementation.
method handle_data_changed.
code whatever required after data entry.
various possibilites here as you
can get back Cell(s) changed
columns or the entire updated table.
Data validation is also possible here.
Note here the field sybol <g2> contains our
instance of class zcltest so we can now
call any methods / access
attributes of that class from this method
in our event handler class.
call method <g2>->disp_tab
EXPORTING
p_er_data_changed = er_data_changed.
endmethod. "handle_data_changed
method toolbar.
data : ls_toolbar type stb_button.
clear ls_toolbar.
move 0 to ls_toolbar-butn_type.
move 'EDIT' to ls_toolbar-function.
move space to ls_toolbar-disabled.
move 'Edit' to ls_toolbar-text.
move icon_change_text to ls_toolbar-icon.
move 'Click2Edit' to ls_toolbar-quickinfo.
append ls_toolbar to e_object->mt_toolbar.
clear ls_toolbar.
move 0 to ls_toolbar-butn_type.
move 'UPDA' to ls_toolbar-function.
move space to ls_toolbar-disabled.
move 'Update' to ls_toolbar-text.
move icon_system_save to ls_toolbar-icon.
move 'Click2Update' to ls_toolbar-quickinfo.
append ls_toolbar to e_object->mt_toolbar.
clear ls_toolbar.
move 0 to ls_toolbar-butn_type.
move 'EXIT' to ls_toolbar-function.
move space to ls_toolbar-disabled.
move 'Exit' to ls_toolbar-text.
move icon_system_end to ls_toolbar-icon.
move 'Click2Exit' to ls_toolbar-quickinfo.
append ls_toolbar to e_object->mt_toolbar.
endmethod. "toolbar
method user_command.
case e_ucomm .
when 'EDIT'. "From Tool bar
perform set_input.
perform init_grid.
when 'UPDA'. "From Tool bar
perform refresh_disp.
perform update_table.
when 'EXIT'. "From Tool bar
leave program.
endcase.
endmethod. "user_command
endclass. "lcl_grid_event_receiver IMPLEMENTATION
program data
include <icon>.
define any old internal structure NOT in DDIC
types: begin of s_elements,
anyfield1(20) type c,
anyfield2(20) type c,
anyfield3(20) type c,
anyfield4(20) type c,
anyfield5(11) type n,
end of s_elements.
data: wa_element type s_elements,
wa_data type s_elements.
Note new RTTI functionality allows field detail
retrieval at runtime for dynamic tables.
data:
grid1 type ref to zcltest,
grid_handler type ref to lcl_grid_event_receiver,
c_dec2 type s_elements-anyfield5,
wa_it_fldcat type lvc_s_fcat,
it_fldcat type lvc_t_fcat,
lr_rtti_struc TYPE REF TO cl_abap_structdescr, "RTTI
lt_comp TYPE cl_abap_structdescr=>component_table,"RTTI
ls_comp LIKE LINE OF lt_comp, "RTTI
zog like line of lr_rtti_struc->components, "RTTI
struct_grid_lset type lvc_s_layo,
l_valid type c,
new_table type ref to data.
types: struc like zog.
data: zogt type table of struc,
grid_container1 type ref to cl_gui_custom_container,
g_event_receiver type ref to lcl_grid_event_receiver,
ok_code like sy-ucomm,
i4 type int4.
start-of-selection.
call screen 100.
module status_0100 output.
if grid_container1 is initial.
create object grid_container1
exporting
container_name = 'CCONTAINER1'.
assign grid_container1 to <g1>.
create object grid1
exporting i_parent = grid_container1.
we need reference to this instance so we can use
Methods etc of zcltest class and alv (superclass)
in our event receiver class.
assign grid1 to <g2>.
create object grid_handler.
set handler:
grid_handler->user_command for grid1,
grid_handler->toolbar for grid1,
grid_handler->handle_data_changed for grid1.
Get the Internal table structure
lr_rtti_struc ?= cl_abap_structdescr=>describe_by_data( wa_data ).
Build field catalog just use basic data here
colour specific columns as well
zogt[] = lr_rtti_struc->components.
call method grid1->create_dynamic_fcat
EXPORTING
zogt = zogt
IMPORTING
it_fldcat = it_fldcat.
Create dynamic internal table and assign
to field symbol.
Use dynamic field catalog just built.
call method cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = it_fldcat
IMPORTING
ep_table = new_table.
assign new_table->* to <dyn_table>.
perform populate_dynamic_itab.
perform init_grid.
perform register_enter_event.
set off ready for input initially
i4 = 0.
call method grid1->set_ready_for_input
EXPORTING
i_ready_for_input = i4.
endif.
endmodule. "status_0100 OUTPUT
module user_command_0100 input.
*PAI not needed in OO ALV anymore as User Commands
are handled as events
*in method user_command.
we can also get control if any data was entered
and the ENTER is pressed by
raising an event.
Control then returns to method handle_data_changed.
endmodule. "user_command_0100 INPUT
form populate_dynamic_itab.
load up a line of the dynamic table
c_dec2 = c_dec2 + 11.
wa_element-anyfield1 = 'Tabbies'.
wa_element-anyfield2 = 'ger.shepards'.
wa_element-anyfield3 = 'White mice'.
wa_element-anyfield4 = 'Any old text'.
wa_element-anyfield5 = c_dec2.
append wa_element to <dyn_table>.
endform. "populate_dynamic_itab
form exit_program.
call method grid_container1->free.
call method cl_gui_cfw=>flush.
leave program.
endform. "exit_program
form refresh_disp.
call method grid1->refresh_table_display.
endform. "refresh_disp
form update_table.
The dynamic table here is the changed table
read from the grid
after user has changed it
Data can be saved to DB or whatever.
loop at <dyn_table> into wa_element.
do what you want with the data here
endloop.
switch off edit mode again for next function
i4 = 0.
call method grid1->set_ready_for_input
EXPORTING
i_ready_for_input = i4.
endform. "update_table
form set_input.
i4 = 1.
call method grid1->set_ready_for_input
EXPORTING
i_ready_for_input = i4.
endform. "set_input
form switch_input.
if i4 = 1.
i4 = 0.
else.
i4 = 1.
endif.
call method grid1->set_ready_for_input
EXPORTING
i_ready_for_input = i4.
endform. "switch_input
form init_grid.
Enabling the grid to edit mode,
struct_grid_lset-edit = 'X'. "To enable editing in ALV
struct_grid_lset-grid_title = 'Jimbos Test'.
call method grid1->set_table_for_first_display
EXPORTING
is_layout = struct_grid_lset
CHANGING
it_outtab = <dyn_table>
it_fieldcatalog = it_fldcat.
endform. "init_grid
form register_enter_event.
call method grid1->register_edit_event
EXPORTING
i_event_id = cl_gui_alv_grid=>mc_evt_enter.
Instantiate the event or it won't work.
create object g_event_receiver.
set handler g_event_receiver->handle_data_changed for grid1.
endform. "register_enter_event
Have fun with this
Cheers
jimbo -
Post Author: tadj188#
CA Forum: Formula
Needed: Sum of LineCount Including Groups and Detail Data On Each Page Used To Generate New Page If TotalPageLineCount > 28
Background:
1) Report SQL is created with unions to have detail lines continue on a page, until it reaches page footer or report footer, rather than using subreports. A subreport report is now essentially a group1a, group1b, etc. (containing column headers and other data within the the report with their respective detail lines). I had multiple subreports and each subreport became one union.
Created and tested, already:
1) I have calculated @TotalLineForEachOfTheSameGroup, now I need to sum of the individual same group totals to get the total line count on a page.
Issue:
1) I need this to create break on a certain line before, it dribbles in to a pre-printed area.
Other Ideas Appreciated:
1) Groups/detail lines break inconveniently(dribble) into the pre-printed area, looking for alternatives for above situation.
Thank you.
Tadjexport all image of each page try like this
var myDoc = app.activeDocument;
var myFolder = myDoc.filePath;
var myImage = myDoc.allGraphics;
for (var i=0; myImage.length>i; i++){
app.select(myImage[i]);
var MyImageNmae = myImage[i].itemLink.name;
app.jpegExportPreferences.jpegQuality = JPEGOptionsQuality.high;
app.jpegExportPreferences.exportResolution = 300;
app.selection[0].exportFile(ExportFormat.JPG, File(myFolder+"/"+MyImageNmae+".JPEG"), false);
alert(myImage[i].itemLink.name) -
Creating Header and Footer in ALV
hi,
can anyone please tell how will you create Header and Footer in ALv and Classical Report.Hi,
In classical report use events 'top-of-page' for header and 'end-of-page' for footer.
in ALV
follow this link
http://www.sap-img.com/abap/test-alv-display-with-header-footer.htm
http://sap.ittoolbox.com/groups/technical-functional/sap-dev/header-footer-display-in-alv-grid-for-layout-description-344391
Regards and Best wishes.
Maybe you are looking for
-
Pages '09 and an Epson RX580 printer
I just made the jump to an IMac. I have run into an issue with printing envelopes with my Epson RX580 printer. I downloaded and installed the newest drivers that are available for Leopard from the Epson site for this printer. When I try to print enve
-
How do I log into iChat if my iCloud is set up through my personal email?
I have an iCloud account through a personal email address, but when I log into iChat on my Mac it asks me for an AIM, @mac.com, or @me.com address? Help?
-
Time on Calendar in Month View
Can someone tell me how to show the time of appointments when the calendar is in Month View. I know I saw it on the IPAD, but I can't find it now that I want to use it. Talked to Apple Care today, but they said it wasn't possible. I know better - hel
-
Disabling auto sort of rows for Pivot Tables in BI Publisher
is there a way to avoid the Pivot table in BI Publisher from sorting your data and just display the rows in the order retured from the data model ? By default it is sorting the data in asc order. Thanks !
-
What is a smart address and how do I use this function.
I am trying to find out how to add the name of a sender to my address book. Mail help says " In a message you receive, click the arrow in a Smart Address and choose "Add to Address Book" from the pop-up menu. Or select a message in the message window