Dynamic table column editing
Hi,
I made a VO with quite complex query (nested subqueries linked with inner join) and when I dragged it from Data Control to the page I didn't get the familiar context menu with implementation options I used to get it earlier.
Instead of, I got an implemented table with following structure:
- af:table - t3
- af:forEach
- af:column - #{...}
- af:outputText - #{...}
Did I get a dynamic table?
My problem is that I cannot get the list of attributes from VO query and then to edit table columns.
They are shown in table at runtime but with default properties. I can set up af:column options generally but I need to set up all of the attributes individually.
Is this a query-level problem or there is another way doing this?
Regards,
Aleksandar Čkrebo
Hi,
I made a VO with quite complex query (nested subqueries linked with inner join) and when I dragged it from Data Control to the page I didn't get the familiar context menu with implementation options I used to get it earlier.
Instead of, I got an implemented table with following structure:
- af:table - t3
- af:forEach
- af:column - #{...}
- af:outputText - #{...}
Did I get a dynamic table?
My problem is that I cannot get the list of attributes from VO query and then to edit table columns.
They are shown in table at runtime but with default properties. I can set up af:column options generally but I need to set up all of the attributes individually.
Is this a query-level problem or there is another way doing this?
Regards,
Aleksandar Čkrebo
Similar Messages
-
I have searched for a bit in the forums and documentation for something like this, and have found nothing.
I would like to be able to have Dynamic table columns, with dynamic content in the table.
I would like the ability to add non-dynamic rows to the table, placed where I like them.
Does anyone know how to do this?I am creating a report that counts a number of events per hour, each day.
the layout will look like this:
0 1 2 3 4 5 6 7 total
day1 3 3 4 5 4 3 2 3 230
day2 4 3 2 3 4 2 3 4 235
day3 3 2 2 2 2 3 2 1 310
total 9 9 9 9 9 9 9 9 1393
The user must be able to select the range of days they can see (might be a week, might be a month, might be a year).
Also, the user can select the range of hours that they want visibile.
becaus they can select the number of hours, I need to be able to dynamically create the columns to the table, according to the user's selection.
The report is a very processor consuming report, as there are thousands of events per hour, so I want to trim the atcual data crunching to a minimum.
can anyone help with dynamic tables? -
Problem involving dynamic table columns in ECM
Hi,
In my current project I have got a requirement whose solution I am not able to figure out.
My requirement is this:
I will have a table containig budget owners name(since its compensation management in HR).There will be a table popin inside this table on the click of the personal number of the budget owner. Now the table popin will have another table with all employees name under that particular budget owner.
The problem is that the table inside the popin will not be having fixed columns.
Actually the columns will be coming from a function module(HRWPC_RFC_OADP_EVAL_DATAVIEW ) in the form of an internal table .
My requirement is this how can this be handled?
How to create the table with dynamic columns?Mind it,the data inside the table also have to binded and some of the columns will also be editable.
Experts please help!
Thanks and Regards,
Saikat.Hello Saikat,
I didnt understand why you want to create the table at design and change it runtime. you as well create the table at runtime. Because the table columns defined in the design time will not match number of table columns required at runtime. this depends on the outpur of your function module.
Anyway here is the solution for your requirement
1. create a attribute in the view controller (say MR_VIEW) of TYPE REF TO if_wd_view.
2. in the doModifyview method write the following code
if first_time = abap_true.
wd_this->mr_view = view.
endif.
3. after calling you function module write the following code to change the biniding of the table and table columns
data lo_table type ref to cl_wd_table.
lo_table ?= wd_this->mr_view->get_element( id = 'TABLE' ). "Pass the ID of the table that is created at design time
data lo_nd_table2 type ref to if_wd_context_node.
data lo_ndi_table2 type ref to if_wd_context_node_info.
data lv_node_path type string.
data lv_attribute_path type string.
data lt_attributes type wdr_context_attr_info_map.
data ls_attribute like line of lt_attributes.
data lo_column type ref to cl_wd_table_column.
data lo_text_view type ref to cl_wd_text_view.
data lo_header type ref to cl_wd_caption.
lo_nd_table2 = wd_context->get_child_node( 'TABLE2' ). "dynamically create context node name
lv_node_path = lo_nd_table2->get_meta_path( abap_true ). "Get the path of this node
lo_table->bind_data_source( path = lv_node_path ). "change the ata
lo_table->remove_all_columns( ). "remove all the design time columns
lo_table->remove_all_grouped_columns( ).
lo_ndi_table2 = lo_nd_table2->get_node_info( ).
lt_attributes = lo_ndi_table2->get_attributes( ). "get the attributes in the context node
"if you already have the list of attributes then you can just loop through them
loop at lt_attributes into ls_attribute.
concatenate lv_node_path '.' ls_attribute-name into lv_attribute_path.
"Creating Table column
lo_column = cl_wd_table_column=>new_table_column( view = wd_this->mr_view ).
"Creating table cell editor
lo_text_view = cl_wd_text_view=>new_text_view(
bind_text = lv_attribute_path "Path of the context attribute
view = wd_this->mr_view ).
"creating header for the table column
lo_header = cl_wd_caption=>new_caption(
text = ls_attribute-name
view = wd_this->mr_view ).
"Setting cell editor and header for the column
lo_column->set_table_cell_editor( lo_text_view ).
lo_column->set_header( lo_header ).
"Adding the column to the table
lo_table->add_column( the_column = lo_column ).
endloop.
BR, Saravanan -
Dynamic table columns...
hi there,
i have a table on my webdynpro with several columns displaying values in EUR with 2 decimals.
now my customer wants to be able to switch between EUR and Thousand-EUR. When Thousand-EUR is displayed ther should be no decimals visible anymore. How can i achieve that? in my context-node the values are defined with 2 decimals. is it possible to change types of context-attributes dynamically? or is there another way to achieve that.
davidHi,
Suppose ur text view element ID contained in a particular table column is 'TXT_VIEW_AMOUNT'.
then you get its reference like this in domodifvview
data: lo_text_view type ref to cl_Wd_text_view.
lo_text_view ?= view->get_element( 'TXT_VIEW_AMOUNT' ).
then call the corresponding bind_text method
lo_text_view->bind_text( path = 'DATA.AMOUNT ). "here DATA.PATH is attribute path
Hope this helps
Regards
Manas Dua -
Hi All,
I am trying to create a table where the number of columns is equal to the number of entries in an output table in my context. How do I go about creating columns dynamically dependant on the number of entries in a table?
Kind regards
SebIf you really need to create table columns programmatically, you can do this in the wdDoModifyView() method of the view controller.
Store the configuration data for the columns in the view controller context and write some code like the following:
private static void addColumn(IWDTable table, String id, String attributeName)
IWDTableColumn column = (IWDTableColumn)
table.getView().createElement(IWDTableColumn.class, id);
IWDInputField editor = (IWDInputField)
table.getView().createElement(IWDInputField.class, null);
column.setTableCellEditor(editor);
editor.bindValue(attributeName);
table.addColumn(column);
public static void wdDoModifyView(
IPrivateXYZView wdThis,
IPrivateXYZView.IContextNode wdContext,
com.sap.tc.webdynpro.progmodel.api.IWDView view,
boolean firstTime)
//@@begin wdDoModifyView
if (<table needs to be recreated>)
IWDTable table = (IWDTable)
view.getElement(<tableID>);
table.destroyAllColumns();
addColumn(table, "columnA", "attributeA");
// etc.
//@@end
This assumes you have created the table itself during design time and bound its data source already. If needed, this can also be done programmatically.
Armin -
Dynamic table columns in web dynpro abap
Hi,
In my current project I have got a requirement whose solution I am not able to figure out.
My requirement is this:
I will have a table containig budget owners name(since its compensation management in HR).There will be a table popin inside this table on the click of the personal number of the budget owner. Now the table popin will have another table with all employees name under that particular budget owner.
The problem is that the table inside the popin will not be having fixed columns.Actually the columns will be coming from a standard java web dynpro application (say in the form of an internal table).
My requirement is this how can this be handled?Can we include all the possible columns in the node(which i bind to the child table) and make them visible/invisible during runtime? or create a dynamic node and assign it to the table(but in this case a node needs to be bound to the table during design time,what to bind?) ?
Can u please help along with code snippets.
Thanks and Regards,
Saikat.Thnx for the input.
I am abke to make the table columns inside the popin visible/invisible.
I have a tabstrip.Indise one of the tabs is my main table and inside one of the columns is the popin.Inside that a transparent container and finally the table inside that.
This is the code that worked for me.
METHOD wddomodifyview .
DATA lr_root_container TYPE REF TO cl_wd_uielement_container.
DATA lr_table_popin TYPE REF TO cl_wd_table_popin.
DATA lr_transparent_container TYPE REF TO cl_wd_transparent_container.
DATA lr_table TYPE REF TO cl_wd_table.
DATA lr_table_column TYPE REF TO cl_wd_table_column.
DATA lr_table_in_table_popin TYPE REF TO cl_wd_table.
DATA lr_node_header_node TYPE REF TO if_wd_context_node.
DATA lr_node_item_node TYPE REF TO if_wd_context_node.
DATA lr_tabstrip TYPE REF TO cl_wd_tabstrip.
DATA lr_tab TYPE REF TO cl_wd_tab.
data lr_tc type ref to CL_WD_TRANSPARENT_CONTAINER.
data lr_table2 type ref to cl_wd_table.
DATA lr_table2_column TYPE REF TO cl_wd_table_column.
IF first_time = abap_false.
lr_root_container ?= view->get_element( 'ROOTUIELEMENTCONTAINER' ).
lr_tabstrip ?= lr_root_container->get_child( id = 'TABSTRIP1' ). "GETTING THE TABSTRIP
lr_tab ?= lr_tabstrip->get_tab( id = 'TAB1' ). "GETTING THE TAB INSIDE TABSTRIP
lr_table ?= lr_tab->GET_CONTENT( ). "GETTING THE CONTENT(TABLE IN THIS CASE) INSIDE TABSTRIP
lr_table_column ?= lr_table->get_grouped_column( id = 'TABLE_MAIN_PERNR' ). "GETTING THE COLUMN INSIDE THE TABLE
"Table popin
lr_table_popin ?= lr_table_column->GET_POPIN( ). "GETTING THE POPIN INSIDE THE TABLE
lr_tc ?= lr_table_popin->GET_CONTENT( ). "GETTING THE CONTENT(TRANSPARENT CONTAINER IN THIS CASE)INSIDE THE TABLE
lr_table2 ?= lr_tc->get_child( id = 'TABLE_EMPLOYEE' ). "GETTING THE EMPLOYEE TABLE INSIDE THE TRANSPARENT CONTAINER
lr_table2_column ?= lr_table2->get_grouped_column( id = 'TABLE_EMPLOYEE_PERNR' ). "GETTING THE COLUMN INSIDE THE TABLE
lr_table2_column->SET_VISIBLE( '02' ). "SETTING VISIBILITY FOR THE COLUMN
ENDIF.
ENDMETHOD.
But I'm still considering the dynamic node concept.Lets see if this works out or not.If not then I'll have to go for the dynamic node thing.
Thanks,
Saikat -
Summing values in dynamic table columns
I'm having some difficulty figuring out how to sum column
values in dynamic tables. In other words, I have created a dynamic
table (php/mysql). One column has a list of prices, and I need to
sum the list of prices. I know this is pretty simple stuff. Can
someone direct me to an example of the appropriate code?"firalivet" <[email protected]> wrote in
message
news:go1j76$d4l$[email protected]..
> One column
> has a list of prices, and I need to sum the list of
prices. I know
> this is
> pretty simple stuff.
There are several ways to do this, but a simple way is to
create a
variable to hold a running total and add the current price to
it when
you display each row. The following is a simplified example
of the
code:
<?php $total = 0; ?>
<?>php do { // this is the start of the repeat region
?>
<tr><td><?php echo
$row_recordsetName['price']; $total +=
$row_recordsetName['price']; ?></td></tr>
<?php } while ($row_recordsetName =
mysql_fetch_array($recordsetName)); // end of repeat region
?>
<tr><td><?php echo $total;
?></td></tr>
David Powers
Adobe Community Expert, Dreamweaver
http://foundationphp.com -
Structure or tabletype out of dynamic table column
Hey Experts,
I have an internal table with dynamic content. In this internal table is a column with the names of tablefields in every line. Now I need to create another internal table or structure with these tablefields in the column as table structure. How can I do that?
I create the first internal table with:
data lt_ded_gc_alv type table of /sme/ded_gc_alv.
select * from /sme/ded_gc_alv into table lt_ded_gc_alv
where id = WD_THIS->GF_SALV_ID
AND xid = WD_COMP_CONTROLLER->cockpit.
This is part of a Web Dynpro for Abap method, but this is not important.
In the table lt_ded_gc_alv I have the column with the dynamic names of tablefields.
Thanks for your help.
Best regards,
IngmarHello,
Look at class CL_ABAP_TYPEDESCR and their subclasses. You need to use RTTS to define dynamic structures, please read this [https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/b332e090-0201-0010-bdbd-b735e96fe0ae].
Regards, -
Reading dynamic table column based on user selection
Hi there,
I am having a problem of reading and manipulating the data stored in a standard SAP table. The following example simulates the table and what i am trying to do:
Table: Storing sales data for sales person
SALES_PERSON REGION YEAR MTH_S1 MTH_S2 MTH_S3 MTH_S4...
Richard S NORTH 2007 100 200 300 400
John K SOUTH 2007 50 100 100 20
Brad P NORTH 2007 300 100 100 50
User have have the following selection option:
1. Month.
The program will calculate the sales based on the individual month selected
Example, if user select Month = 3, then program take only MTH_S3 column value
So total sales = 300100100=500
2. Month range
The program will calculate the sales based on the month range selected
Example, if user select Month 2 to 4, then program take MTH 2 to MTH_S4 columns value
So total sales = 400 (for MTH_S2) + 500 (for MTH_S3) + 470 (for MTH_S4) = 1370
How should i write the logic or code for this requirement?
Hope someone can help.
Thanks,
Pang HKTry something like this
TABLES:
t247.
SELECT-OPTIONS:
s_month FOR t247-mnr NO-EXTENSION.
DATA:
BEGIN OF fs_data,
person(30),
area(10),
year(4),
mon1 TYPE kbetr,
mon2 TYPE kbetr,
mon3 TYPE kbetr,
mon4 TYPE kbetr,
mon5 TYPE kbetr,
END OF fs_data,
t_data LIKE STANDARD TABLE OF fs_data,
w_no_months TYPE i,
w_kbetr TYPE kbetr,
w_total TYPE kbetr.
LOOP AT t_data INTO fs_data.
CLEAR w_kbetr.
DO 5 TIMES VARYING w_kbetr FROM fs_data-mon1
NEXT fs_data-mon2.
IF sy-index IN s_month.
w_total = w_total + w_kbetr.
ENDIF.
ENDDO.
ENDLOOP.
change the value 5, according to the no.of months in ur internal table -
Create dynamic table using pojo data control
What are the options we can in order to create dynamic table columns based on pojo data control?
We have a class A and there are some attributes say A.x, A.y, A.z
Within class A, we have a collection of class B and has attribute say B.k
Within class A, we have a collection of class C and has attribute say C.j
Every instance of class A has same number of instances of class B
Every instance of class A has same number of instances of class C
We would like to display a table like this
A.x, A.y, A.z, [B.k, B.k, ...], [C.j, C.j, ...]
How should we do that?
ThanksWhat are the options we can in order to create dynamic table columns based on pojo data control?
We have a class A and there are some attributes say A.x, A.y, A.z
Within class A, we have a collection of class B and has attribute say B.k
Within class A, we have a collection of class C and has attribute say C.j
Every instance of class A has same number of instances of class B
Every instance of class A has same number of instances of class C
We would like to display a table like this
A.x, A.y, A.z, [B.k, B.k, ...], [C.j, C.j, ...]
How should we do that?
Thanks -
Make the jtable column editable
Hi,
I want to make the table column editable,that like double click on an editable table cell,and edit it directly.
How to solve it?hi!
if you want to make any particular column editable you may have to do something like this
TableModel dataModel = new AbstractTableModel() {
public int getColumnCount() { return names.length; }
public int getRowCount() { return data.length;}
public Object getValueAt(int row, int col) {return data[row][col];}
public String getColumnName(int column) {return names[column];}
public Class getColumnClass(int c) {return getValueAt(0, c).getClass();}
public boolean isCellEditable(int row, int col) {return col != 5;}
public void setValueAt(Object aValue, int row, int column) { data[row][column] = aValue; }
}; the isCellEditable(row, col) is importantin your case.
i hope it may help you
:) -
Here's how to do ALV (OO) with dynamic fcat, int table and editable data
Hi everybody
Here's a more useful approach to ALV grid with OO using dynamic table, data NOT from DDIC, dynamic FCAT and how to get changed lines from the grid when ENTER key is pressed.
It's really not too dificult but I think this is more useful than the ever present SFLIGHT methods from the demos.
This also defines a subclass of cl_gui_alv_grid so you can access the protected attributes / methods of that class.
You don't need to add the class via SE24 -- done fron this ABAP.
When you run it click Edit for the first time.
After editing data press ENTER and the break point should bring you into the relevant method.
Code developed on NW2004S trial version but also works on rel 6.40 on a "Real" system.
The code should work without any changes on any system >=6.40.
All you need to do is to create a blank screen 100 via SE51 with a custom container on it called CCONTAINER1.
The rest of the code can just be uploaded into your system using the SE38 upload facility.
When running the program click on the EDIT button to enable the edit functionality of the grid.
Change your data and when you press ENTER you should get the break-point where you can see the original table and changed rows.
This program is actually quite general as it covers Dynamic tables, building a dynamic fcat where your table fields are NOT in the DDIC, intercepting the ENTER key via using an event, and accessing the protected attributes of the cl_gui_alv_grid by defining a subclass of this class in the abap.
I've seen various questions relating to all these functions but none in my view ever answers the questions in a simple manner. I hope this simple program will answer all these and show how using OO ALV is actually quite easy and people shouldn't be scared of using OO.
Have fun and award points if useful.
Cheers
Jimbo.
<b>PROGRAM zdynfieldcat.
Simple test of dynamic ITAB with user defined (not ddic) fields
Build dynamic fcat
use ALV grid to display and edit.
*When edit mode set to 1 toolbar gives possibility of adding and
*deleting rows.
*Define subclass of cl_gui_alv_grid so we can use protected attributes
*and methods.
Add event handler to intercept user entering data and pressing the
*ENTER key.
When enter key is pressed get actual value of NEW table (all rows)
rather than just the changed data.
*use new RTTI functionality to retrieve internal table structure
*details.
Create a blank screen 100 with a custom container called CCONTAINER1.
James Hawthorne
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.
types: lt_rows type lvc_t_roid.
Note new RTTI functionality allows field detail retrieval
at runtime for dynamic tables.
data: wa_element type s_elements ,
wa_data type s_elements,
c_index type sy-index,
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.
field-symbols: <dyn_table> type standard table,
<actual_tab> type standard table,
<fs1> type ANY,
<FS2> TYPE TABLE.
data: grid_container1 type ref to cl_gui_custom_container.
class lcl_grid_event_receiver definition deferred.
data: g_event_receiver type ref to lcl_grid_event_receiver.
data: ls_modcell type LVC_S_MODI,
stab type ref to data,
sdog type s_elements. .
class lcl_grid_event_receiver definition.
public section.
methods:
handle_data_changed
for event data_changed of cl_gui_alv_grid
importing er_data_changed,
toolbar for event toolbar of cl_gui_alv_grid
importing e_object
e_interactive,
user_command for event user_command of cl_gui_alv_grid
importing e_ucomm.
endclass.
*implementation of Grid event-handler class
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.
perform check_data using er_data_changed.
endmethod.
Method for handling all creation/modification calls to the toolbar
method toolbar.
data : ls_toolbar type stb_button.
Define Custom Button in the toolbar
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.
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.
endclass.
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.
methods: constructor, disp_tab.
endclass.
need this now to instantiate object
as we are using subclass rather than the main cl_gui_alv_grid.
class zcltest implementation.
METHOD constructor.
CALL METHOD super->constructor
exporting i_appl_events = 'X'
i_parent = grid_container1.
endmethod.
method disp_tab.
FIELD-SYMBOLS: <outtab> TYPE STANDARD TABLE.
break-point 1.
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
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.
endclass.
data :
ok_code like sy-ucomm,
save_ok like sy-ucomm,
i4 type int4,
Container Object [grid_container]
now created via method constructor
in the subclass zcltest.
Control Object [grid]
grid1 type ref to zcltest,
Event-Handler Object [grid_handler]
grid_handler type ref to lcl_grid_event_receiver.
start-of-selection.
call screen 100.
module status_0100 output.
now display it as grid
if grid_container1 is initial.
create object grid_container1
exporting
container_name = 'CCONTAINER1'.
create object grid1.
break-point 1.
create object grid_handler.
set handler:
grid_handler->user_command for grid1,
grid_handler->toolbar for grid1,
grid_handler->handle_data_changed for grid1.
perform create_dynamic_fcat.
perform create_dynamic_itab.
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.
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 the Data entered and the ENTER is pressed by
*raising an event.
Control then returns to method handle_data_changed.
endmodule.
form create_dynamic_fcat.
get structure of our user table for building field catalog
Use the RTTI functionality
lr_rtti_struc ?= cl_abap_structdescr=>describe_by_data( wa_data ).
Build field catalog just use basic data here
colour specific columns as well
loop at lr_rtti_struc->components 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-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.
endform.
form create_dynamic_itab.
Create dynamic internal table and assign to field sysmbol.
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>.
endform.
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.
form check_data USING P_ER_DATA_CHANGED
TYPE REF TO CL_ALV_CHANGED_DATA_PROTOCOL.
Get altered data back
ASSIGN p_er_data_changed->mp_mod_rows TO <FS1>.
stab = p_er_data_changed->mp_mod_rows.
ASSIGN STAB->* TO <FS2>.
LOOP AT <FS2> INTO sdog.
ALV grid display with altered data is now in <fs2>.
do any extra processing you want here
endloop.
now display new table
call method grid1->disp_tab.
endform.
form exit_program.
call method grid_container1->free.
call method cl_gui_cfw=>flush.
leave program.
endform.
form refresh_disp.
call method grid1->refresh_table_display.
endform.
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.
form set_input.
i4 = 1.
call method grid1->set_ready_for_input
exporting
i_ready_for_input = i4.
endform.
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.
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.
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.</b>Hi there
IE7 doesn't give me the add new page option and I get 404 error when trying to access the "How to contribute" section.
I'll load up Firefox later (this browser usually works when IE7 doesn't always work properly).
I'll copy the stuff to the wiki when I've got the browser sorted out.
Cheers
jimbp -
SQL from Table Column with Dynamic URL Problem
This is the SQL I'm attempting to save to a table column via the Object Browser;
select
"a"."PBR_BRIEF_ID" "Brief ID",
"a"."PROJECT_NUMBER" "Project",
"b"."DESCRIPTION" "Description",
"b"."ACTUAL_END_DATE" "Actual End",
"b"."RFS_DATE" "RFS",
"b"."LOCATION_CODE" "Location",
''||"b"."ESA_CODE"||'' "ESA",
"b"."PROJECT_USER_STATUS" "Status",
"b"."PROJECT_TRIGGER" "Trigger"
from
UPT1TRIAL.FUND_PLAN_BRIEF_LINK_CCR@NDSD "a",
UPT1INTEGRAL.INT_PROJECT_DATA@NDSD "b"
where
"a"."PBR_BRIEF_ID" = :P3_BRIEF_ID and
"a"."PROJECT_NUMBER" = "b"."PROJECT_DEFINITION_NUMBER"
The intesting bit is the following, where a URL is return behind a particular column;
''||"b"."ESA_CODE"||'' "ESA",
It's interesting because when I click on "Apply Changes" in the Object Browser, the text that appears in the column is as follows, i.e. with APP_ID and SESSION populated;
''||"b"."ESA_CODE"||'' "ESA",
Why would that happen??
The full SQL above is used in an application page with a SQL Query (PL/SQL function body returning SQL query). The basic SQL works OK but because of what the Object Browser is doing, the link does not.
Message was edited by:
Damian - apologies for lack of formatting!!
Message was edited by:
DamianDamian,
Use
& lt;
for your < tags and then the message will appear in the proper format.
If you are using dynamic sql to generate an url with APP_ID and SESSSION you could:
a) create page items (P1_APP_ID and P1_SESSION)
b) compute those page items to the actual APP_ID and SESSION_ID
c) use the value of those items while generating your dynamic sql (instead of APP_ID and SESSION)
Then, your links will show the right APP_ID and the right SESSION.
Denes Kubicek -
Dynamic entry list used in a table column
On a form, we noticed a dynamic entry list will limit which values a user may enter by validating against the entry list values. We need to have the same validation occur when a dynamic entry list is used in a table column. Has anyone had success in getting the dynamic entry list to validate the cell values in a table column?
Hey Dan,
You are right.... Its a bug... we are also using VC CE 7.1 SP 05....
When I try in form (with combo box) its working fine...I mean its giving error saying "Character string "4" does not exist in the allowed set of values and its not forwarding any values...
but when I use it in table, its not giving any error.
I saw some demos where it was working fine... but those are older sp versions of CE 7.1...
Try to contact SAP VC team on this....
PradeeP
Edited by: pradeep bondla on Oct 6, 2010 12:06 AM -
How to control internal table columns dynamically based on input
i have 2 fields in the selection screen - user and tcode
we can give any number of tcodes as in put
based on requirement i need to display all the tcodes belongs to one user in one row
in other words
the out put table columns should increase dynamically based on number of tcodes entered
in the input
how to do this?
Edited by: tummala swapna on Apr 7, 2009 11:55 AMThis may be useful to you..
FIELD-SYMBOLS : <FS_TABLE> TYPE ANY TABLE.
DATA: DREF TYPE REF TO DATA,
WA_DREF TYPE REF TO DATA,
DY_LINE TYPE REF TO DATA,
ITAB_TYPE TYPE REF TO CL_ABAP_TABLEDESCR,
WA_TYPE TYPE REF TO CL_ABAP_STRUCTDESCR,
STRUCT_TYPE TYPE REF TO CL_ABAP_STRUCTDESCR,
ELEM_TYPE TYPE REF TO CL_ABAP_ELEMDESCR,
COMP_TAB TYPE CL_ABAP_STRUCTDESCR=>COMPONENT_TABLE,
COMP_FLD TYPE CL_ABAP_STRUCTDESCR=>COMPONENT,
OTAB TYPE ABAP_SORTORDER_TAB,
OLINE TYPE ABAP_SORTORDER.
BEGIN DYNAMIC STRUCTURE FOR FINAL INTERNAL TABLE @@@@@@@@@@@@@@@@@@
STRUCT_TYPE ?= CL_ABAP_TYPEDESCR=>DESCRIBE_BY_NAME('table or structure name').
COMP_TAB = STRUCT_TYPE->GET_COMPONENTS( ).
STRUCT_TYPE = CL_ABAP_STRUCTDESCR=>CREATE( COMP_TAB ).
ITAB_TYPE = CL_ABAP_TABLEDESCR=>CREATE( STRUCT_TYPE ).
CREATE DATA DREF TYPE HANDLE ITAB_TYPE.
ASSIGN DREF->* TO <FS_TABLE>.
END DYNAMIC STRUCTURE FOR FINAL INTERNAL TABLE @@@@@@@@@@@@@@@@@@
Maybe you are looking for
-
Here's a little history with the problem I'm having. At first (about 1 year ago) my fire wire ports became intermittent. They would work one second, then they wouldn't. I took my Mac in to be serviced, at the time it was still under warranty, but the
-
An old time Windows user in a Mac world ...
As you can guess, I just got my first iMac, and wow, what a beauty! The interface and new way of doing things took me about ... 5 hours to get use to, but I find the simplest tasks in Apple to be the hardest. I know some of these questions may be dup
-
Same output file in multiple directories.
Hi, I am working on a Proxy to File scenario where a target csv file is generated by PI. The requirement is that PI needs to generate a csv file and post that file in 4 separate directories of a same FTP server. I intend to do that using single comm
-
Resizable form what form property need to set?
I had created a user form, i want it to be resized by the user. No matter what ever BoFormBorderStyle i set (fbs_Sizable,fbs_Floating) in the runtime i could not resize it. I tried by setting in screen painter, and also in the code like oForm.BorderS
-
Airdrop iPad/iPhone vs macbook pro 2013
Hi all I have read a lot of discussion but I haven't found a solution. I have : - iPhone 5S - iOS 8.1.2 - iPad mini 2 (Retina) - iOS 8.1.2 - Macbook Pro early 2013 (Retina) - Yosemite 10.10.1 Handoff works on the all devices. So I am able to receive