Access to an attribute of a value node of a component controller
Hello experts,
I'm new to the area of SAP CRM Web Client UI development. My problem is probably very simple and you will surely smile about it.
I have created my own component with the value node FILE (that consists of five atributes) in the component controller. Unfortunately I have not figured out yet how I can access the value of an attribute.
The first thing I do not know is where I can find the controller-ID.
In addition, I get an syntax error Field "TYPED_CONTEXT->FILE->COLLECTION_WRAPPER->GET_FIRST(" unknown in the line with "lo_entity = me->comp_controller->typed_context->file->collection_wrapper->get_first( ).".
Currently no functionality is included in my code, because firstly I want to understand the basics.
method OP_FILEUPLOAD.
data lo_entity type ref to if_bol_bo_property_access.
data lv_file_name type string.
data lr_file_content type ref to data.
field-symbols <lv_file_name> type string.
IF ( comp_controller is INITIAL ).
get_controller( 'xxxx' ).
ENDIF.
lo_entity = me->comp_controller->typed_context->file->collection_wrapper->get_first( ).
while lo_entity is bound.
lv_file_name = lo_entity->get_property_as_string( 'FILE_NAME' ).
lr_file_content = lo_entity->get_property( 'FILE_CONTENT_STRING' ).
assign lr_file_content->* to <lv_file_content>.
lo_entity = me->typed_context->file->collection_wrapper->get_next( ).
endwhile.
endmethod.
I hope that I will manage my "problem" with your help!
Sebastian
Edited by: Sebastian Lenz on Jun 27, 2011 2:35 PM
Hi Sebastian,
The issue is in the following line of your code:
lo_entity = me->comp_controller->typed_context->file->collection_wrapper->get_first( ).
The 'typed_context' belongs to your own component controller class and not the standard framework superclass. So, you need to replace this single line of code with something as follows (assuming that your component controller class is ZCL_CUSTOM_BSPWDCOMPONENT_IMPL):
DATA lr_coco TYPE REF TO ZCL_CUSTOM_BSPWDCOMPONENT_IMPL.
lr_coco ?= me->comp_controller.
lo_entity = lr_coco->typed_context->file->collection_wrapper->get_first( ).
The me->comp_controller reference will refer to the standard framework superclass of all component controllers and this does not have any typed_context attribute with it. The real component controller that gets created when you create a BSP component will have this attribute. That is why you need to first cast it to your own reference type before trying to access its typed_context.
And if your value node will have only single values, then you can as well do the following to access the attribute ATTRIB1 of context node node1:
DATA lv_value TYPE string.
lv_value = lr_coco->typed_context->node1->get_attrib1( attribute path = '' ).
Basically all attributes can be accessed by above code by using the right getter method.
Regards,
Shiromani
Similar Messages
-
Access a value attribute under a value node
Hi guys,
Could you please help me on this one. I need to access value attributes that are under a value node?. I use the following codes and I always have the error "java.lang.NullPointerException ".
1) wdThis.wdGetContext().currentMyValueNodeElement().getMyAttribute();
2) wdContext.currentMyValueNodeElement().getMyAttribute();
Thanks in advance
FranckHEre is an example where I'm pulling a value from a value attribute where the Node is a table. "Ytdsl" is the actual value attribute name.
// Get the total from the last line of the table
String sx =
wdContext
.nodeChannelList()
.getElementAt((wdContext.nodeChannelList().size() - 1))
.getAttributeValue("Ytdsl")
.toString();
Regards,
Rich Heilman -
How to populate a Value Attribute of a Value Node inside Model Node
Hello
I have my context like this.
Context
.. - ModelNode
.... - Model Attr1
.... - Model Attr2
.... - Model Attr3
.... - Model Attr4
.... - Value Node
...... |
...... - Value Attr1
Model Node is of Cardinality 0..N
Value Node is of Cardinality 1..1
I want to create multiple records in my Model Node and one record for every Model Node in Value Node.
How to do this?
All good suggestions are welcome.
Regards,
ShubhamHi Shubham,
With your context structure the code will be
for(int i = wdContext.nodeModelNode().size()-1 ; i>=0 ; i--)
IPublic<comp name>.IModelNodeElement ele = wdContext.nodeModelNode().getModelNodeElementAt(i);
IPublic<comp name>.IValNodeElement valEle = wdContext.nodeModelNode().nodeValNode().createValNodeElement();
valele.setValAttr("");
ele.nodeValNode().addElement( valEle);
Your val node should be non singleton (singleton property = false)
Regards,
Jaydeep -
Mapping one node in a view context to many nodes in the component controlle
Hi guys,
I need to map an element (attribute) of a node in the View Context to an attribute of multi nodes of the same type:
Context View:
customer_no
|
| -> KUNNR
Component Controller Context having two nodes:
- Node1
RFC1
|
|->KUNNR
- Node2
RFC2
|
|->KUNNR
Above I need to map the (KUNNR) in customer_no node to KUNNR in the RFC1 RFC2 before i execute the two RFCs services.
Note:
if this is not possible would you mention another solution.
Thanks,Hi,
As per MVC you cannot map context from view controller to component controller.Mapping can happen from component
controller to view controller.
You cannot create mapping for context attributes. You can map nodes if both source node and destination node both has same structure and same number of attributes. If they dont contain same number of attributes the extra attributes from the source node gets copied to the destination node.
In your case before the RFC execution you can read the value of attribute Kunnr from view and set it the RFC attribute Kunnr before the Function module execution.
Regards
Bala Baskaran.S -
How to set Value Attribute (under valu node) at run time
Hi,
This is my View context.
wbsElement (Value Attribute of Type String)
This is my Component Controller Context.
Project_info (Value node)->Wbs_Info (Value Node)-WBS(Value Attribute).
Initially I want to set some dummy values to wbsElement(view attribute),sothat I can show that in drop downby key.
On selecting of wbsElement I want to pass the selected value to component controllers ValueAttribute - WBS (this Value attribute is under 2 nodes-see the structure I've given).
I tried this way which is not working fine.
IWDNodeElement element = wdContext.createWBSElement();
wdContext.nodeWBS().addElement(element);
wdContext.currentWBSElement().setWBS(wbsElement);
Can anyone tell me which is the correct way to do this?
This is very urgent.plz help me in this.Thankx in advance.
Regards,
KarthickHi Karthick,
try this code.
IPublic<compcontrolllername>.IWbc_infoElement obj = wdThis.wdGet<Componentcontrollername>Controller().wdGetContext().createWbc_infoeElement();
obj.setWBS(wdcontest.currentContestElement.getwbsElement());
wdThis.wdGet<Componentcontrollername>Controller().wdGetContext().nodeWbc_infoElement().addelement(obj);
set the cardinality of Project_info to 1:n or 1:1
test this one
if you find any problem let em know
regars
Naidu -
Cannot access Created Context Attribute from Component Controller
Hello All,
I have added a new attribute to a node in my component controller 'LOGONUID' and I cannot access it within my windows within the WDA application.
DATA lo_nd_url_param TYPE REF TO if_wd_context_node.
DATA ls_workset TYPE wd_this->element_workset.
"DATA ls_logonuid TYPE wd_this->element_logonuid.
I get an error as soon as I try to activate this code in my method in my W_MAIN
In my component controller I do not see it reference in the SAP generated code in my WD_THIS IF_COMPONENTCONTROLLER?
* Intf.: ig_componentcontroller
* Purp.: programming interface for access of this controller within
* other controllers of the same component
* controller: <COMPONENTCONTROLLER> of
* component: <zhr_wd_mss>
* UDate: 20111207 145441
*=====================================================================*
interface ig_componentcontroller.
interfaces: ziwci_hr_wd_mss .
constants:
wdctx_context type string value `CONTEXT`.
constants:
wdctx_cuifcontext type string value `CUIFCONTEXT`.
types:
begin of Element_cuifcontext,
USERID type String,
LASTEVENTOPERATION type String,
end of Element_cuifcontext,
Elements_cuifcontext type
standard table of Element_cuifcontext
with default key.
constants:
wdctx_messages type string value `MESSAGES`.
types:
Element_messages type ZHR_S_MESSAGE,
Elements_messages type
standard table of Element_messages
with default key.
constants:
wdctx_workset type string value `WORKSET`.
I want it to be declared as the constant 'WORKSET'
thank you
Edited by: Keith Warnock on Dec 7, 2011 8:55 PM
Edited by: Keith Warnock on Dec 7, 2011 8:56 PM> I have added a new attribute to a node in my component controller 'LOGONUID' and I cannot access it within my windows within the WDA application.
>
>
>
> DATA lo_nd_url_param TYPE REF TO if_wd_context_node.
> DATA ls_workset TYPE wd_this->element_workset.
> "DATA ls_logonuid TYPE wd_this->element_logonuid.
>
>
>
This declaration is not right. There is no element logonuid, you have the attribute inside a node. workset is a node and thats why you can declare that way.
easiest way is to declate
data lv_logonuid type <ddic type> or
data lv_logonuid type wd_this-><node name>-logonuid.
You can also use the code generator in (CTRL +F7 ) to get/set attributes. -
[ETL]Could you please help with a problem accessing UML stereotype attributes ?
Hi all,
Could you please help with a problem accessing UML stereotype attributes and their values ?
Here is the description :
-I created a UML model with Papyrus tool and I applied MARTE profile to this UML model.
-Then, I applied <<PaStep>> stereotype to an AcceptEventAction ( which is one of the element that I created in this model ), and set the extOpDemand property of the stereotype to 2.7 with Papyrus.
-Now In the ETL file, I can find the stereotype property of extOpDemand as follows :
s.attribute.selectOne(a|a.name="extOpDemand") , where s is a variable of type Stereotype.
-However I can't access the value 2.7 of the extOpDemand attribute of the <<PaStep>> Stereotype. How do I do that ?
Please help
Thank youHi Dimitris,
Thank you , a minimal example is provided now.
Version of the Epsilon that I am using is : ( Epsilon Core 1.2.0.201408251031 org.eclipse.epsilon.core.feature.feature.group Eclipse.org)
Instructions for reproducing the problem :
1-Run the uml2etl.etl transformation with the supplied launch configuration.
2-Open lqn.model.
There are two folders inside MinimalExample folder, the one which is called MinimalExample has 4 files, model.uml , lqn.model, uml2lqn.etl and MinimalExampleTransformation.launch.
The other folder which is LQN has four files. (.project),LQN.emf,LQN.ecore and untitled.model which is an example model conforming to the LQN metamodel to see how the model looks like.
Thank you
Mana -
Dear friends,
When I create a value node in the context controller why should I change its cardinality to 1..1 and not to keep it as the default one 0..n? And what will happen if I leave it unchanged?
I really want to understand that from the runtime data point of view.
regards,Hi Hisham,
Cardinality:
Any node or attribute that has the context root node as its immediate parent, is known as an independent node or attribute.
Any node or attribute that has some other node as its immediate parent, is known as a dependent node or attribute.
All context nodes are collections.
A node collection is composed of elements, where an element is an aggregation of the nodes immediate children (attributes and/or other nodes).
The cardinality property controls the number of elements a node collection may hold at runtime.
Every context node has a property called Cardinality. This property is composed of two values that taken together, describe the maximum and minimum number of elements the node collection may hold
at runtime.
Therefore, there are four possible cardinality values (specified as <Min>..<Max>)
0:1: At most one element can be selected
1:1: Exactly one is selected
0:N: Any number of elements can be selected
1:N: At least one ...
The first two values define a node with single-selection. The second two values define a node with multi-selection.
Like if you have input field , in that case if you are binding it with the value node then you need cardinality as 1:1/1:n.
The reason is that it will create an element always for you so that you can give some input in this element.
If you set the cardinality to 0:1/0:n then it will disable the input field and user will not be able to enter the data.
Thanks n Regards,
Jhansi Miryala -
How to populate context node of component controller
Dear People,
Is there any way i could access my custom context node of component controller in the context node class of my custom controller.
I am navigating from one component to another, Upon initial launch everything is working fine, however if i go to home page and come back. the assignment block is coming empty.
In WD_USAGE_INITIALIZE i m binding my custom controllers context node with the component controller's context node of the other component and it works fine when i load the UI. however if i go to home page and come back. the assignment block is coming empty.
Following code is in method of DO_VIEW_INIT_ON_ACTIVATION of the other componenet.
METHOD do_view_init_on_activation.
DATA: lv_btstatus_parent TYPE REF TO cl_crm_bol_entity,
lv_comp_ctrl TYPE REF TO cl_btstatus_bspwdcomponen_impl.
CONSTANTS:
lc_us_header TYPE crmt_relation_name VALUE 'BTStatusHUserAll',
lc_us_item TYPE crmt_relation_name VALUE 'BTStatusIUserAll'.
lv_comp_ctrl ?= me->comp_controller.
check if relationname has been passed from outside
gc_relation_name = lv_comp_ctrl->get_relation_name( ).
IF gc_relation_name IS INITIAL.
check type of parent to determine relationname
*lv_btstatus_parent ?= lv_comp_ctrl->typed_context->btstatusparent->collection_wrapper->get_current( ).*
check lv_btstatus_parent is bound.
CASE lv_btstatus_parent->get_name( ).
WHEN 'BTStatusH'.
gc_relation_name = lc_us_header.
WHEN 'BTStatusI'.
gc_relation_name = lc_us_item.
ENDCASE.
ENDIF.
CALL METHOD super->do_view_init_on_activation.
ENDMETHOD.
Here lv_btstatus_parent is bound during initial launch, however after navigating back to the same page, its blank leading to exception.
any suggestions would be helpful.
regards,
pradeepsolved myself
-
Problem in accessing attribute of a context node
Hi All,
I have a context node called REFE and an attribute named REF to the node REFE. I am trying to get access to the attribute REF, so that i can dynamically set properties. But i am getting NULL Object error. I am successfully getting access to node REFE.
Here is the code.
lo_nd_refe = wd_context->get_child_node( name = wd_this->wdctx_refe ).
lo_el_refe = lo_nd_refe->get_element( ).
lo_el_refe->set_attribute(
EXPORTING
name = `REF`
value = 'http://sapsndbp.sbic.co.za:8011/sap/bc/webdynpro/sap/zzdm_audit_report' ).
Regards,
RAviHi,
What is the cardinality of the node.
If it is 1:1 then you can get teh reference of the context element directly.
If it 0:N or 1:N then you need to pass the index of the context element you are trying to get.
Use the method get_element of the context node and pass the index value.
Always check the element is initial or not before you process further for better coding.
Regards,
Lekha. -
Attributes iteration of a value node bound to a structure invalid?
A context value node bound to a structure always delivers all attributes of the structure bound instead of the attributes, which were selected from the available structure attributes.
For example, if structure S has the attributes A, B and C and the value node V is bound to S, but "inherits" attribute A only, the code
wdContext.nodeV().getNodeInfo().iterateAttributes()
delivers an iterator which loops 3 times and returns A, B and C as attribute infos.
Is this a wanted behaviour? I would expect that only the attributes, which are bound to the corresponding structure attributes (A in the sample) are returned.
Regards
Stefan
Just to be a little bit more accurate: the term "structure" means a complex type defined unter "Structures" in the "Local Dictionary" for example. Attributes and nodes are Value Attributes/Nodes.
Message was edited by: Stefan KlenschYes, it is the intended behaviour. These <i>are</i> the attributes at run time. And I don't see why the additional structure attributes should be hidden from the application (besides the fact that iterateAttributes() is used internally, too).
If you are interested whether an attribute was originally declared or was automatically added due to the structure binding, look at IWDAttributeInfo.isDeclared(). -
How to make visible value attributes of a Search Node
Hi All,
We have a requirement to enhance the search context node SEARCH ( Dynamic Query Object SVYQ ) of component SVY_S.
But the enhancement category of Attribute Structure CRMST_QUERY_SVYIL is 'Can't be enhanced'.
So we are adding value attributes to this context node. How to make this value attributes available in view configuration tab?
Please suggest a better approach if there is any.
Thanks in adv.Hi Suchindra,
You assign these enhanced attributes to design layer. so you can see these fields in Config tab.
How to do:
IMG->Customer Relationship Management -> UI Framework -> UI Framework definition -> Maintain
design layer
Here include the enhanced attributes and then go to component work bench and in context attributes right click assign the desing layer, selct your attribute and in the bottom click on SAVE button.
Then check it in configuration tab your attributes will available in show available fields.
I hope this will solve your problem
Regards,
Sagar -
Access attribute of a context node in another context node of the same view
Hi all,
I want to acess value of an attribute PERNR of context node CUSTOMERS in another context node AUTHENTICATION of the same view. A sample syntax would be helpful .
Thanks,You didn't specify your version of Oracle so here are two options. If 10.2 or greater, use XMLTable, else use the ExtractValue option.
-- The WITH simply simulates your existing table that I do not have.
WITH fake_tab AS
(SELECT XMLTYPE('<?xml version="1.0" encoding="ISO-8859-1"?>
<Settings>
<Setting Name="A1" Value="N"/>
<Setting Name="A2" Value="N"/>
<Setting Name="A3" Value="SOMEVALUE"/>
<Setting Name="A4" Value="N"/>
<Setting Name="A5" Value="Y"/>
<Setting Name="A6" Value="N"/>
</Settings>
') tab_col
FROM dual)
-- For 10.2 and higher use this SELECT
SELECT a5
FROM fake_tab,
XMLTABLE('/Settings'
PASSING fake_tab.tab_col
COLUMNS
a5 VARCHAR2(10) PATH 'Setting[@Name="A5"]/@Value');
-- For 10.1 and before
SELECT ExtractValue(tab_col, '/Settings/Setting[@Name="A5"]/@Value')
FROM fake_tab; -
How to pass value node attributes to transaction launcher?
Hallo,
I want to pass some parameters to transaction launcher.
Im using a url-transaction.
My context node is a value node.
Can i enhance a handler class?Hello,
Did you have a look at this thread ?
WebClient Transaction Launcher Parameters
Regards,
Nicolas. -
Binding value nodes to component in a view
Hi,
What is the use of these value nodes and value attributes? How can I bind them to, say a inputfield in my view? Can any change to the value node dynamically affect the inutfield?Thanks to Peter Conrad for the answer. The answer's in a different post. I have included his reply below.
From a binding perspective there's no difference between value or model nodes/ attributes. you can always bind using the syntax
//<contextnode/attribute to the value attribute of the tag.
And yes, for accessing the value the SET_<attribute> and GET_<attribute> methods should be used in this case.
Peter
Edited by: Arun Prakash Karuppanan on May 15, 2008 10:24 PM
Maybe you are looking for
-
Is there an app for video playback on external screen from ipad mini which avoids mirroring?
I want to play fullscreen video from ipad mini to external screens with a clean look and without without showing playback controls etc. I need to be able to play, pause, change the order of video tracks without affecting the external display as it's
-
Error in Form Personalization....
I did the following: Action Type : Builtin ,Builtin Type : Execute Procedure, Argument ='declare BEGIN user_resp_single_signon ; END' -- This is running fine. When I try to pass parameter as below: ='declare BEGIN user_resp_single_signon_p('Test'); E
-
i was updating my phone and and the connect to itunes sign has come on and wont go? now my phone is wont come on and if i try the same connect to itunes sign comes up
-
Multiple size of db_block
using oracle 10g on solaris. I have a query with lots of join and some table scan with lob object. when i execute that with 8K block size..then after executing 3 times ,I got physical read 0. but I moved them in a 16K block size.and physical read is
-
I am facing random troubles on my spanking new MacBook Pro 17".
Hello! I recently bought an Apple MacBook Pro 17" and I am facing a few problems every now and then: 1. Sometimes, clicking on the trackpad with two fingers stops invoking the right-click function and it only starts doing so on the next reboot. 2. So