Dynamic Tables: TableCellEditor depending on Context node value
Dear community,
I'm creating a dynamic table containing all the neccessary fields to display my context node in Java code but I have one requirement that I can not resolve by myself:
Depending on the value of a cell the TableCellEditor should be of type IWDTextView or LinkToURL. So if the context node value is e.g. the String "abc" I want to display a LinkToUrl containing a Target - such as http://www.abc.com - depending on the value, if the context node value is "def" I want to do nothing but display the value in a TextView.
As I am creating the dynamic table in advance and binding my Context node to it later, I don't know how to change the TableCellEditor at that point of time.
Right now I have the choice to either display all cells of the column as LinkToUrl TableCellEditor or display all cells as TextView - the dynamic table generation itself is no problem for me.
Does anyone have an idea on how to do that? Maybe it is not possible in WDJ right now?
regards,
Christian
Hi Christian
Try this:
IWDTable theTable=(IWDTable)view.createElement(IWDTable.class,"table");
IWD TableColumn aColumn=(IWDTableColumn)view.createElement(IWDTableColumn.class,"col");
if(str.equal("abc"))
IWDTextView aField=(IWDTextView)view.createElement(IWDTextView.class,"TextView");
aField.bindText(str);
aColumn.setTableCellEditor(aField);
else if(str.equal("def"))
IWDLinkToURL aField=(IWDLinkToURL)view.createElement(IWDLinkToURL.class,"LinkToURL");
aField.bindtarget("http://www."str".com");
aColumn.setTableCellEditor(aField);
theTable.addColumn(aColumn);
Best regards,
Sangeeta
Similar Messages
-
Dynamic image displays depending on yes / no value
Dynamic image displays depending on yes / no value
I´d like to have a image showing, depending on a specific value (y/n)
..sorry need some help.
I can´t get it workin.....
<img <?php $status="n";
if ($status == "y") {
echo 'src="stecker_on.png" alt="yes"';
} else {
echo 'src="stecker_off.png" alt="no"';
} ?> height="71" width="101" />
The image ist not showing... ideas ?
All I get ist some text showing:
height="71" width="101" />
MANY THANKS !!!!Presumably you mean this -
http://mediaconsults.de/1test/steckertest.php
And it's not clear what that is going to show me. Looking at the code on the page -
<html>
<head>
<title>Unbenanntes Dokument</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_reloadPage(init) { //reloads the window if Nav4 resized
if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
MM_reloadPage(true);
//-->
</script>
</head>
<body background="test%20png.png">
<div id="Layer1" style="position:absolute; left:1290px; top:246px; width:95px; height:112px; z-index:1"><img src="stecker_off.png" alt="no"height="101" width="71" /></div>
</body>
</html>
I would advise you the following:
1. Put a valid and complete doctype on that page!
2. Get rid of the resize if NN4 javascript - it hasn't been needed for nearly a decade.
3. Fix your image code (note the missing space after "no"!
4. 1290px is way too wide unless you want lots of people scrolling right to see things. -
Table View with Multiple Context Nodes
I want to create a table-view consisting of an object composition, e.g. multiple business objects. The chtml:configCellerator -tag supports just one context node which corresponds to just one business object.
How do you create a table composed by different objects, i.e. BTAdminH and BTAdminI ?
Edited by: romanglass on May 18, 2010 4:07 PMHi,
I would suggest to create a new component and not to disturb the standard ones. Because the super class of the header context node (BTAdminH in your case) must be inherited from CL_BSP_WD_CONTEXT_NODE_DTV - Deep table view.
The dependent nodes must be passed to return parameter rt_result of method GET_SUB_CNODE_DEFINITIONS.
This cant be done via wizard. I just tried to replicate your scenario. Below are the steps,
1. create a view with context node BTADMINH as tableview. Then change the super class of the context node to CL_BSP_WD_CONTEXT_NODE_DTV.
2. Add another context node BTADMINI and mark it as dependent to BTADMINH.
3. Now change the super class of context node BTADMINI to CL_BSP_WD_CONTEXT_NODE_TV (Table View).
4. Redefine method GET_SUB_CNODE_DEFINITIONS in context node BTADMINH.
In the view layout you should use cellerator and pass an iterator with interface IF_THTMLB_CELLERATOR_ITERATOR. The interface has a method RENDER_DEPENDANT_OBJECTS which returns the table of dependant objects.
Regards,
Arun
Edited by: Arun Kumar on May 19, 2010 1:01 PM -
CRM 7.0 WEB IC - context node values are not seen in webIC
Hi
can anyone help me in resolving my problem in CRM WEB IC.
Actually i have added a new context node Using wizard , by right clicking the context nodes. i have four custom fields in that node, these i have to show on the View Account overview and the context node for this is Account where i have to fetch data based on the BP_number i have in Account, i have to display custom fields from the context node BALANce which i have created .
I gave all my coding in do_prepare_output method. But the values are not passing to my custom fields as a result the view in WEB IC dissappears saying
&NBSP;
Cannot display view IUICOVW/AccInfo of UI Component IUICOVW
An exception has occurred Exception Class CX_SY_REF_IS_INITIAL - Dereferencing of the NULL reference
Method: ZL_IUICOVW_ACCINFO_IMPL=>DO_PREPARE_OUTPUT
Source Text Row: 82
Edited by: nelachinni on Dec 16, 2010 10:04 PMHi,
Could you please share what are you trying to access at line 82 in do_prepare_output ? sharing code snippet might help in understanding the issue.
Cheers,
Sumit Mittal -
Dynamic table rows created based on input value
I've been searching the forum for either a tutorial or input
on how to create a table where the number of rows are based on a
user input value. I can't seem to find anything on this.
Here's what I'm trying to do. I have site where people are
charged based on the number of items they register. So if they want
to register 2 items. They would input the number 2 for quanity and
I would display a dynamic table with 2 rows. The user will input
their data for the 2 items and I insert this into an
itemsRegistered table. If they entered 4 I would give them 4 rows
for input. I am using dreamweaver with PHP and MySql database. Can
anyone point me in the right direction. Any help would be
appreciated!Not exactly. The items are all the same but have a different
registration number (like a serial number). So if the user wants to
register 2 items. They would input the number 2 on the form. Then 2
rows would appear on the table, one for each registration number.
When they finish entering the data it would be inserted into the
database as 2 records.
So for example if item 1 has registration number 10000 and
item 2 has registration number 11000. The registration numbers are
unique. The table would look like this :
CustomerID (links to customer table)
RegistrationID (Unique in this table)
ItemColor
ItemShape
I don't know if I've explained this well but thanks for even
attempting to answer this! I really appreciate it! -
How to access a dynamic created attribute in a context node?
<i>Hello,</i>
<i>who could help? I can't set a value for a dynamically created attribute which is bind to a table.</i>
<i>My context of the view looks as follow (is defined in NetWeaver):</i>
- Context
- Availability (Node)
- vctxService (Attribute)
- vctxServiceDesc (Attribute)
- ... (further predefined attributes)
- ... (some have to be set dynamically as follows)
<i>Then I have added attributes dynamically in the wdDoModifyView(...) - method, as follows:</i>
for (int i = 0; i < max; i++) {
// some code to dynamically create table columns
// adding attributes dynamically
IWDAttributeInfo attrInfo = wdContext.nodeAvailability().getNodeInfo(). addAttribute("vctxAvailability_" + i, "ddic:com.sap.dictionary.string");
tv.bindText(attrInfo); // bind to TextView in table
<i>In the method onPlugFrom... I tried to set the values for the attributes "vctxAvailability_ + i" as follows:</i>
for (int i = 0; i < max; i++) {
IAvailabilityElement newAvailNodeElement = wdContext.createAvailabilityElement();
// some values will be set for the
// predefined attributes of AvailabilityNode
// newAvailNodeElement.set...( value );
// newAvailNodeElement.setVctxService( xy.getServ() );
// now the values of dynamically created and added
// attributes in AvailabilityNode will be added
// THIS DOESN'T WORK
newAvailNodeElement.setAttributeValue ("vctxAvailability_" + i, "value" + i);
<i>It would be great if someone could help me.
Thanks in advance.
Kind regards,
Carsten</i>Carsten,
Here is a sample code that creates context attributes dynamically and also sets values:
//Creates a node
IWDNodeInfo nodeInfo = wdContext.wdGetAPI().getRootNodeInfo().addChild("TestNode", null, true, true, false, true, false, true, null, null, null);
//If you want to bind the node to a model node then the
//second argument to the above method should be the
//model class.
//Creates an attribute under the node just created.
IWDAttributeInfo testAttrib = wdContext.wdGetAPI().getRootNodeInfo().getChild("TestNode").addAttribute("testAttrib", "ddic:com.sap.dictionary.string");
IWDNodeElement testNode = wdContext.getChildNode("TestNode", IWDNode.LEAD_SELECTION).getCurrentElement();
IWDNode testNode2 = wdContext.getChildNode("TestNode", IWDNode.LEAD_SELECTION);
//Now you can bind testNode with the Model Node
//You can also set a value to the newly created attribute
testNode.setAttributeValue("testAttrib", new String("Value"));
Hope this helps.
Shakeel -
Gurus : READ dynamic table in an OO context ?
OK, so the following form of the READ statement is obsolete :
READ TABLE itab WITH KEY dobj
It used to be I could pass a left-aligned character field as dobj. This was perfect for a dynamic scenario, because a type-c field containing key contents could be calculated at runtime easily.
Currently, In my OO-code I do the following:
1. Pass the name of a transparent table to a method
2. Create a dynamic internal table of this transparent table
3. Fill the internal table with some data
Later on, I wish to READ this internal table to find a specific entry based on the key of the referenced transparent table. This would be possible using the form :
READ itab FROM wa.
However, this does not work because the table key is not defined when the cl_alv_table_create=>create_dynamic_table method is used, and hence non-key fields are considered during the read.
Does anyone have a suggestion ?
Regards,
RogerActually, I am thinking of writing a blog article on the code anyway. When I do, I'll post a link here.
Essentially, you can use CL_ABAP_TABLEDESCR=>Create( ) to create the dynamic internal table, in this method call you have the opportunity to specify a table of key fields. The resulting internal table respects the table key during a READ statement of the form:
READ TABLE itab FROM wa
Where "wa" is a structure defined like a line of the itab.
Regards,
Roger
Regards,
Roger -
Sql queries from internal tables based on context node
Hi experts,
I want to select from my inetrnal table which is based on the context node, the rows which do not appear in another internal table based on the context node.
I have this data:
data lt_item_level type table of wd_this->element_item_level INITIAL SIZE 0.
data lt_item_level_cp type table of wd_this->element_item_level INITIAL SIZE 0.
data lt_po_items TYPE table of wd_this->element_po_items INITIAL SIZE 0.
I want to do this:
select * into CORRESPONDING FIELDS OF TABLE lt_item_level_cp from lt_item_level WHERE lt_po_items-po_number NE lt_item_level-item_number.
But i get an error:
"LT_ITEM_LEVEL" is not defined in the ABAP Dictionary as a table,
Is there a way to do it with select or should i loop over my internal tables?
thank u very much!!hi,
You cannot use Select queries on internal table. do like this :
loop at itab into wa where wa-F1 NE wa-F2.
append wa to itab1.
endloop.
Here itab1 will have all the records as per your requiement.
I hope it is clear.
Edited by: Saurav Mago on Oct 26, 2009 5:37 PM -
How to map XML to Web Dynpro context nodes?
Hi All,
Could anyone tell how xml string can be bound to context nodes ? In my requirement i need to serialize context nodes value to string and deserialize it back to nodes for implementing back naviagtion between views.
I didnt see much threads achieving this giving details on class cl_wdr_xml_convert_util and methods if_wd_client_conversion_util~string_to_struct.
I am using wd_context->to_xml to convert into xml.
From this format, i want to bind it back to context node.
When i use this below approch i get short dumb.
Serialization to xml:
lv_data_string = wd_context->to_xml( ).
Deserialization:
DATA lv_typedescr TYPE REF TO cl_abap_typedescr.
FIELD-SYMBOLS:
<fs_data> TYPE ANY TABLE.
CALL METHOD cl_abap_typedescr=>describe_by_object_ref
EXPORTING
p_object_ref = wd_context
RECEIVING
p_descr_ref = lv_typedescr
EXCEPTIONS
reference_is_initial = 1
OTHERS = 2.
try.
CALL METHOD cl_wdr_xml_convert_util=>if_wd_client_conversion_util~string_to_struct
EXPORTING
in = lv_data_string
typedescr = lv_typedescr
IMPORTING
data = <fs_data>
CATCH cx_wdr_conversion_exception into lo_err .
lv_exp = lo_err->get_text( ).
ENDTRY.
wd_context->bind_table( values = <fs-data>.
Using this way, i get a short dumb as assert statement is failed as value for typedescr->type_kind is '*'.
method if_wd_client_conversion_util~string_to_struct.
assert typedescr->type_kind = cl_abap_typedescr=>typekind_struct1
or typedescr->type_kind = cl_abap_typedescr=>typekind_struct2.
raise exception type cx_wdr_conversion_exception
exporting textid = cx_wdr_conversion_exception=>illegal_type.
On debugging changing this value to required also made no difference, as no value could be assigned to the field symbol.
Suggest a soution to do this.Hi Thomas,
Thanks for your replies.
I have corrected it, but the field symbol is empty and while debugging it says data type is incorrect.
code:
FIELD-SYMBOLS:
<fs_data> TYPE ANY TABLE.
data: lsbp type ZXBPCENTRAL,
go_ref type ref to data.
CALL METHOD cl_abap_typedescr=>describe_by_data " ( before it was describe_by_object_ref)
EXPORTING
p_data = lsbp
receiving
p_descr_ref = lv_typedescr.
try.
CALL METHOD cl_wdr_xml_convert_util=>if_wd_client_conversion_util~string_to_struct
EXPORTING
in = lv_data_string
typedescr = lv_typedescr
IMPORTING
data = go_ref "<fs_data>
CATCH cx_wdr_conversion_exception into lo_err .
lv_exp = lo_err->get_text( ).------> Here the error says " Invalid data type and hence, there is no data.
ENDTRY.
assign go_ref->* to <fs_data>.
I am still looking for solution and thanks a lot .... -
How to create Dynamic Table Control
Hi
How to create Dynamic Table control , The field names and values to be displayed in table control are to be fetched from Add-on Tables.
Regards
PrasathHi Jonathan,
Actually the columns to be displayed are not constant . It will be increased based on the database values, Anyhow it will not exceed 100.
Please confirm my understanding.
1. In this case I have to create 100 custom columns and make it visible / invisible based on my requirement and I can set the title at runtime.
2. How can i assosicate / reassociate the datadictionary reference for the columns that i use. Because I need to show the search help values for the
dynamic columns.
Your opinion on this will be helpful.
Regards
Prasath -
Bind Dynamic Table To a Context Node
Hello,
I created an internal dynamic Table. I want to show this table in an ALV-Table. So I want to bind it to a context node.
I create the context node attributes by this:
lr_node_info ?= lo_nd_template_exp->get_node_info( ).
*Type of table type and context type have to be the same
LOOP AT lt_plchar INTO ls_plchar.
clear lv_text.
lv_text = ls_plchar-plchar.
TRANSLATE lv_text TO UPPER CASE.
ls_fieldcatalog-fieldname = lv_text.
ls_fieldcatalog-inttype = 'C'.
ls_fieldcatalog-intlen = '10'.
APPEND ls_fieldcatalog TO lt_fieldcatalog.
ls_attribute-name = lv_text.
ls_attribute-type_name = 'CHAR10'.
lr_node_info->add_attribute( EXPORTING attribute_info = ls_attribute ).
ENDLOOP.
So I create a fieldcatalog and the attributes at once.
Then I generate the table with this:
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = lt_fieldcatalog
IMPORTING
ep_table = <fs_data>
EXCEPTIONS
generate_subpool_dir_full = 1
OTHERS = 2 .
IF sy-subrc <> 0.
ENDIF.
* So now points to our dynamic internal table.
ASSIGN <fs_data>->* TO <fs_1>.
* Next step is to create a work area for our dynamic internal table.
CREATE DATA new_line LIKE LINE OF <fs_1>.
* A field-symbol to access that work area
ASSIGN new_line->* TO <new_line>.
Data: copy_table type ref to data.
field-symbols: <copy_table> type standard table.
create data copy_table like table of <new_line>.
assign copy_table->* to <copy_table>.
ok, nice. when i now bind the table to <copy_table> to lo_nd_template_exp it all works fine. But i also want to but the data into the table.
This also works. When I debug, I can see the table filled with the values. But then there's always this error:
Invalid operand type for the MOVE-CORRESPONDING statement.
Ok, I have read, that the types may be not fit. But I don't know why and how i can solve it.
Do you have any ideas?Hi,
I've the same problem: I must create all attribute of my node at run-time and then create alv.
I use the method:
DATA lo_cmp_usage TYPE REF TO if_wd_component_usage.
DATA lo_interfacecontroller TYPE REF TO iwci_salv_wd_table .
lo_cmp_usage = wd_this->wd_cpuse_alv( ).
IF lo_cmp_usage->has_active_component( ) IS INITIAL.
lo_cmp_usage->create_component( ).
ENDIF.
Pass context node to ALV
lo_interfacecontroller = wd_this->wd_cpifc_alv( ).
lo_interfacecontroller->set_data( node_lenght ). " node_lenght is my dynamic node
But I receive this message error:
Invalid operand type for the MOVE-CORRESPONDING statement.
Method: IF_WD_CONTEXT_NODE~GET_STATIC_ATTRIBUTES_TABLE of program CL_WDR_CONTEXT_NODE_VAL=======CP
Method: GET_REF_TO_TABLE of program CL_SALV_WD_DATA_TABLE=========CP
Method: EXECUTE of program CL_SALV_BS_SERVICE_MNGR_TABLE=CP
Method: EXECUTE of program CL_SALV_WD_SERVICE_MANAGER====CP
Method: APPLY_SERVICES of program CL_SALV_BS_RESULT_DATA_TABLE==CP
Method: REFRESH of program CL_SALV_BS_RESULT_DATA_TABLE==CP
Method: IF_SALV_WD_COMP_TABLE_DATA~MAP_FROM_SOURCE_DATA of program CL_SALV_WD_C_TABLE_V_TABLE====CP
Method: IF_SALV_WD_COMP_TABLE_DATA~MAP_FROM_SOURCE of program CL_SALV_WD_C_TABLE_V_TABLE====CP
Method: IF_SALV_WD_COMP_TABLE_DATA~UPDATE of program CL_SALV_WD_C_TABLE_V_TABLE====CP
Method: IF_SALV_WD_VIEW~MODIFY of program CL_SALV_WD_C_TABLE_V_TABLE====CP
What can I do??? My node doesn't static attribute....
Thank,
Federica. -
Using Search Help with ALV and Dynamic context node
The topic subject already describes my situation.
I have to create, populate and remove context nodes at runtime, and bind them to an ALV, to let user display the data or modify the data. The nodes I create are always typed with a table name, but the table name is of course, dynamic.
This is all working: what's not working is help for entries inside the ALV; since the table has foreign keys and domains with check tables or fixed values, I expected that search helps were detected and managed by the framework.
Instead, no help search is displayed except the input help based on data-type of the one "Date" input fields.
I think I have to work on the dynamic node creation, and not on the ALV itself, since the latter only takes the node/attributes information, but i could be wrong. I tried with both the two following codings:
CALL METHOD lo_nd_info_root->add_new_child_node
EXPORTING
static_element_type = vs_tabname
name = 'SAMPLE_NODE_NAME'
* is_mandatory = abap_false
* is_mandatory_selection = abap_false
is_multiple = abap_true
is_multiple_selection = abap_false
* is_singleton = abap_false
is_initialize_lead_selection = abap_false
is_static = abap_false
RECEIVING
child_node_info = lo_nd_info_data .
cl_wd_dynamic_tool=>create_nodeinfo_from_struct(
parent_info = lo_nd_info_root
node_name = 'SAMPLE_NODE_NAME'
structure_name = vs_tabname
is_multiple = abap_true ).
The result is the same...is there any way to let the ALV know what search helps it has to use, and doesn't force me to manually build a VALUE_SET to be bound on the single attributes? There are many tables, with many fields, and maintaining this solution would be very costly.I have checked with method GET_ATTRIBUTE_VALUEHELP_TYPE of interface IF_WD_CONTEXT_NODE_INFO, on an attribute which i know to have a search help (Foreign key of a check table).
The method returns 'N', that is the constant IF_WD_VALUE_HELP_HANDLER~CO_VH_TYPE_NO_HELP. So, the framework was not able to find a suitable search help.
Using method GET_ATTRIBUTE_VALUE_HELP of the same interface, on the same attribute, returns me '111', which is constant C_VALUE_HELP_MODE-AUTOMATIC.
Therefore, the WD framework knows it has to automatically detect a value help, but fails to find one.
Also, this means in my opinion that the ALV and the dynamic external mapping are not the culprits: since node creation, no help is detected for any attribute but the date. Honestly, I don't have a clue on what's happening. -
Dynamic creation of context nodes and ui elements
Hi,
I have created context nodes dynamically. And i also want to create UI elements dynamically wherein i want to bind the attribute from the context node to it. For example i want to create a drop down by index and bind one of the attributes in the context nodes that i have earlier created dynamically to it. I do not know how to get the path to the attribute as i get IF_WD_CONTEXTNODE_INFO when i say get_child_node(). And the IF_WD_CONTEXTNODE_INFO does not have any method where in i can get IF_WD_CONTEXT_NODE from where i can get the path by get_meta_path( )
Here is the code. The problem is to get the path which is the i/p to cl_wd_dropdown_by_idx=>new_dropdown_by_idx( ) method.
DATA:
lo_root_ui_elmnt TYPE REF TO cl_wd_uielement_container,
lo_drpdwn_by_idx TYPE REF TO cl_wd_dropdown_by_idx,
lo_txt_vw TYPE REF TO cl_wd_text_view,
lo_qstn_node TYPE REF TO if_wd_context_node,
lo_optn_node_info TYPE REF TO if_wd_context_node_info,
lv_optn_data_source_name TYPE string,
lt_child_nodes TYPE wdr_context_child_map,
lo_qstn_el TYPE REF TO if_wd_context_element,
lo_optn_el TYPE REF TO if_wd_context_element,
lv_text TYPE string,
lo_qstn_node_info TYPE REF TO if_wd_context_node_info.
FIELD-SYMBOLS:
* <ls_qstn> LIKE LINE OF wd_this->mt_questions.
<ls_child_node> LIKE LINE OF lt_child_nodes.
lo_root_ui_elmnt ?= io_view->get_root_element( ).
lt_child_nodes = wd_context->get_child_nodes( ).
LOOP AT lt_child_nodes ASSIGNING <ls_child_node>.
lo_qstn_node = <ls_child_node>-node.
lo_qstn_el = lo_qstn_node->get_element( index = 1 ).
lo_qstn_el->get_attribute(
EXPORTING
name = 'QUESTION_TEXT'
IMPORTING
value = lv_text ).
lo_txt_vw = cl_wd_text_view=>new_text_view( view = io_view ).
lo_txt_vw->set_text( value = lv_text ).
lo_qstn_node_info = lo_qstn_node->get_node_info( ).
lo_optn_node_info = lo_qstn_node_info->get_child_node( 'OPTIONS' ).
* lv_optn_data_source_name = lo_optn_node_info->get_meta_path( withoutcontroller = abap_true ).
* CONCATENATE lv_optn_data_source_name '.' 'OPTION_TEXT' INTO lv_optn_data_source_name.
lo_drpdwn_by_idx = cl_wd_dropdown_by_idx=>new_dropdown_by_idx(
bind_texts = lv_optn_data_source_name
view = io_view ).
lo_root_ui_elmnt->add_child( lo_txt_vw ).
lo_root_ui_elmnt->add_child( lo_drpdwn_by_idx ).
ENDLOOP.
Regards,
Madhura Lobo
Edited by: Suhas Saha on Aug 2, 2011 11:04 AMHi Madhura,
Please check this thread and find Baskaran answer...
create new child-node in supply-function
Re: Creating Dynamic Node and Table
Cheers,
Kris. -
Adding dynamic attributes to static context node
Hi All,
I have defined a context node LINES with several attributes. This is done staticly during developmenttime.
During run-time node LINES is extended with several attributes dynamicly. See below:
10 HEADER_GUID ->
11 DETAIL_GUID ->
12 EXTERNAL_ID ->
13 OBJECT_TYPE ->
14 IN_OUT_PLAN ->
15 TRAFFIC_LIGHT_1 ->
16 TRAFFIC_LIGHT_2 ->
17 TRAFFIC_LIGHT_3 ->
18 TRAFFIC_LIGHT_4 ->
19 _LOCATION \TYPE=STRING ->
20 _ZZTOPGROUPING \TYPE=STRING ->
21 _STATUS \TYPE=STRING ->
22 _100000200 \TYPE=STRING ->
19..22 are added dynamicly.
I have an internal table that matches de new context. This <fs_tb_tree_new> I want to bind like:
*&- bind table
lr_node->bind_table( new_items = <fs_tb_tree_new>
set_initial_elements = abap_true ).
In <fs_tb_tree_new> the dynamicly added attrbutes contains values e.g. (the static attributes also have values via <fs_tb_tree_new>):
_LOCATION _ZZTOPGROUPING _STATUS _100000200
5 Africa 0002 Reporting Entity 0.000
6 Russia, CIS 0003 Identify 0.000
An ALV presents the values of the attribute. But.... only the values of the static part are presented, not the dynamic attributes added during runtime.
Please advise what I forget or do wrong .
Thanks in advance.
JohnI solved the issue:
If you use a combination of static attributes added with dynanic attributes (during runtime) for dynamic ALV, I advise to create a new node and bind the values to this new created node:
Cheers, John
wd_this->extend_context( EXPORTING im_struc_descr = lr_cl_abap_structdescr
IMPORTING ex_node = lr_node_alv ).
Method:
*&- Create new dynamic context LINES_DYN
Node for alv-table
lr_node_info = wd_context->get_node_info( ).
CALL METHOD lr_node_info->add_new_child_node
EXPORTING
name = 'LINES_NEW'
static_element_rtti = im_struc_descr
is_static = abap_true
is_multiple = abap_true
is_multiple_selection = abap_false
RECEIVING
child_node_info = lr_subnode_info.
lr_node = lr_subnode_info->get_parent( ).
lr_node = wd_context->get_child_node( 'LINES_NEW' ).
ex_node = lr_node.
*&- bind table for alv
lr_node_alv->bind_table( new_items = <fs_tb_tree_new>
set_initial_elements = abap_true ). -
Dynamic table with dynamic drop-down list values
Hi,
I need to display a dynamic table with 2 columns on an interactive form.
My Context is defined as below:
Root
StudentData 0..n
StudentName
StudentCourses 0..n
Text
Value
The 1st column should display student name, 2nd column should display student courses. The courses will be different for each student. I populated the context properly. I checked it by printing them. My DDL is bound to "Student Courses".
When there is one row -> The DDL is populated with the courses of student 1 (as there is only one).
When there are more rows -> The DDLs for all the students are populated with all the courses of all the students.
I want to see the data populated like:
TEXTFIELD DROP-DOWN LIST
Student 1------Student1-Course1
Student1-Course2
Student1-Course3
Student 2------Student2-Course1
Student2-Course2
Student2-Course3
I tried to do this in plain web dynpro using SVS.. it is also working similarly.
I have set the singleton property of nodes "StudentData" and "StudentCourses" to false.
Could any one tell me where I am going wrong?
Thanks
RamRam,
I'm not sure how much this will help, but I know I had the same problem as you when I tried to get a similar thing working, but I can't remember which of the many changes I made fixed the problem, so I'll just show you my code and perhaps you can see if anything is different than yours.
Here's where I'm creating my dropdown - in my case EastNew_RegOut is the same as your StudentData, and RateTypeDropValues is the same as your StudentCourses (the comments in the code are not meant to sound bossy to you, this is actually an example piece of code that other developers in my company "steal", so I have to put very specific instructions in there!):
int nodeSize = wdContext.nodeEastNew_RegOut().size();
for (int i = 0; i < nodeSize; i++) {
//create an element called "table", that's the element at i. So, basically it's a row. Maybe I should have
//called it "row" instead of table.
IPublicDeviceExchange.IEastNew_RegOutElement table = (IPublicDeviceExchange.IEastNew_RegOutElement)wdContext.nodeEastNew_RegOut().getElementAt(i);
//this line of code just executes an rfc that finds out what rates need to be in the dropdown for this particular row
executeRateTypeDropdown(rateCategory, table.getNum(), wdContext.currentEastNew_MeterOutElement().getReggrp());
//clear out what's already in there before we re-populate it.
table.nodeRateTypeDropValues().invalidate();
//now, I'm looping through all the values in the *actual* rate type dropdown (the one that's an RFC, populated by the above "execute" method)
for (int j = 0; j < wdContext.nodeEastRatetype_DropdownOut().size(); j++) {
//for each element in the *actual* Rate type dropdown, I'm going to create an element in my node that I created
//and set the values from the *actual* one as the values in my node.
IPublicDeviceExchange.IRateTypeDropValuesElement element = wdContext.createRateTypeDropValuesElement();
IPublicDeviceExchange.IEastRatetype_DropdownOutElement rateTypeOut = (IPublicDeviceExchange.IEastRatetype_DropdownOutElement)wdContext.nodeEastRatetype_DropdownOut().getElementAt(j);
element.setText(rateTypeOut.getText());
element.setValue(rateTypeOut.getRatetype());
//here's another key - notice how I don't say wdContext.nodeRateTypeDropValues() - it's the one that's
//directly off that table I created earlier - the thing that's essentially a row in my newReg table.
//So, what I'm doing here is adding that new element I created to the dropdown FOR THAT ROW!
//(btw, if you're trying to duplicate this, and this method does not exist for your "table" object, it's
//probably because you didn't listen to me above and you didn't create your node with the singleton property
//set to false.)
table.nodeRateTypeDropValues().addElement(element);
As for my layout... my table is bound to the EastNew_RegOut node, and the column with the dropdown is bound to RateTypeDropValues.Value (that's probably obvious, but there you have it anyway)
Finally, in my context, EastNew_RegOut is singleton = true (I was surprised about this, actually, I would have assumed it was false) with a selection of 0..1 and RateTypeDropValues has singleton set to false with a selection of 0..1
I hope that helps to some degree!
Jennifer
Maybe you are looking for
-
Error while creating snapshot with OEL6.5 guest in VMware.
While creating snapshots we are getting the following kernel messages: ------------[ cut here ]------------ WARNING: at fs/ext4/super.c:341 ext4_journal_start_sb+0x129/0x140 [ext4]() Hardware name: VMware Virtual Platform Modules linked in: autofs4 i
-
Cant get 60 hz hdmi output to panasonic plasma tv
hello i am trying to get tv out from my laptop and desktop pc to panasonic 42" plasma tv .. i can only take 1920x1080 1080p/50hz display . i tried everythink but i cant get work kms line in my grub menu .. all i need is 1080p/60 hz display from grub
-
Rented movie from atv back to computer
I read an article from apple insider that said you can't sync a movie from the apple tv to you computer. I spoke with an apple representative that said that is not true the movie will sync to the computer otherwise how could you put the movie onto yo
-
FAQ: Crystal Reports を使用した Windows フォームアプリケーションが原因でシャットダウンできない
[タイトル] Tip: Crystal Reports を使用した Windows フォームアプリケーションが原因でシャットダウンできない [詳細/質問] Visual Studio がインストールされた環境にて.Crystal Reports を使用したアプリケーションを閉じる際に次のようなエラーが発生する. "Title: Microsoft Visual C++ Runtime Library Runtime Error! Program: u2026\TestReport.vshost.
-
how to include structures in a report to get data from that structure. and also tell how to retrive data frm the structure thanx