Attaching OVS to model attribute.
Hi,
Can I attach OVS to a model attribute in the view controller? I tried to do it but at runtime I got the error 'must not modify the datatype of a mapped attribute'. Any suggestions...Thanks.
Hi Guys,
i have also the same NullPointerException in a Webdynrpo App using a RFC Model.
Actually, i'm not a expert in this technology
@Kalpi
So, what you mean by reffering to parent element?
Can you give me an example?
Actually i fight with this problem until three days, and i've no solution.
I hope someone can help me! I became totally desperate.
Thanks
Best Regards,
Chris
Message was edited by: Christian Kleinschroth
Message was edited by: Christian Kleinschroth
Similar Messages
-
DropDownByKey UI Element and Model Attribute
Hi
The DropDownByKey UI Element can be linked to value attribute, which are simple types.
Now if i try to link them to model attribute which are simple types pertaining to some model classes, its not happening.
so my question is how to attach any DropDownByKey UI Element with Model attribute which will get data from model to which it is attached?
thanks
SrikantD.V.,
Whether or not DDK (DropDownByKey) works with model attribute depends on type of attribute (actually, type of model class property that stays behind this attribute)
If the type contains enumeration itself then DDK works.
So, you have the following options (dynamically populating values set will not work here):
1. Alter type on back-end to include enumeration
2. Use DDI (DropDownByIndex) as suggested here
3. Create sub-node with cardinality 1..1 (better keep singleton false), then add value attribute with the same basic type (string, int etc) and set it flag calculated to true. WD will generate getter / setter for this attribute -- just return / set original model attribute in this method. Next:
3.a Either create new simple DDIC type for calculated attribute and define enumeration here
3.b Or modify SVS of calculated attribute at run-time as suggested in this thread
Valery Silaev
EPAM Systems
http://www.netweaverteam.com/ -
Hello Friends,
To display the field on the View, we can create the field via 3 ways:
1) By creating the model attribute
2) By creating the model node using the GENIL object and using its attributes in view
3) Creating the field in Database structure using AET
But, i am not aware that in exactly what kind of business scenarios we use the above 3 methods to create the field.
Could you help me out to clarify the same.Hi Dev,
1). By creating the model attribute: we will use this option in case of the field is avaibla in stanadrd sap system. It might be in another under child context nodes and we will use BOL relations to access the attribute.
2). By creating the model node using the GENIL object and using its attributes in view: We will use this option incase of there is no standard provision to use. Means you want to create any custom assignment block with custom attributes then you can go for this option. More over we can use AET to create custom genil object. We have an option Create Table in AET.
3).Creating the field in Database structure using AET: We will use this option incase of there is no attribute in database relevant to your requirement then we will go for AET enhancement.
Hope this might give you little clarification..
Best Regards,
Dharmakasi. -
How to add customized value to drop down by index binded to model attribute
i have to Ui element Drop down by index to which i have binded model attribute for populating the values, now i want to add a customized value to it like "choose all".
how can i do this ??
Thanks and regards,
Aditya DeshpandeCreate a value node similar to model node. In value node you can add element at the index wherever you want to:
wdContext.node<nodename>().addElement(<index>,<element>);
Regards,
Murtuza -
Problem when mapping model attribute to dropdownbyindex
HI
I am mapping model attribute ( this is mapped to Model field of RFC ) to DropDownbyIndex.
Once i call BAPI the executed list of values populates into dropdown but it doesn't show first value, instead it puts one extra space in dropdown ( 1 blank by default + 1), when we try to select this blank value it gives error.
Pl help me solving this issue
Thanks!Hi Ravindra,
It might be write the all code in BAPI side only.
After writing the bapi code u can retrive thru only DropdownbyIndex.
What ever u created means Cusomecontroller or component controller in init() method u created BAPI instance and send input to the BAPI.
When you setting the paramaeters in init() megtod
U can do like this.
bapi input = nwe bapi();
input.setparametername("firstparameter displaying onthedropdownbox");
for example
input.setDoc_type("orders");
add like this.
Hope this will help
nageswara. -
SVS on model attribute bound to webservice from entity bean
Hi,
i want to use an SVS on a model attribute. The model comes from a session bean, that talks to an entity bean.
The problem is, that the model attribute has a type of longObject and i think that's the cause why SVS cant be used.
The entity bean belongs to an db table where i use a ddic simple type with enumeration. I think the pure j2ee part between the WebDynpro and the ddic is the problem, why the ddic information cant be transported to the WebDynpro, is it?
So how do i use SVS for a model attribute that is bound to a webservice, that comes from a session/entity bean?
Thanks in advance!
Oliverhii Sudheer,
The web service creation is getting fine for local project, but wat i want to do is to create a webservice for a session bean in EJB DC ....
So how can i change workspace of DC?? Its stuff goes into DTR rite?
how do u change the workspace of DC project??
regards,
Amey -
How to give Value set for model attribute?
Hi all,
How to give value set for model attribute?
plz explain me with some sample code.
Regards,
SrinuHi Srinivasulu,
An attribute (of basic data types like integer , string etc) holds a single values.
Please clarify by what you mean value set ?
Also, share the structure of context.
Regards,
Kartikaye -
GenIL Model Attribute Structure not getting updated with new fields added
Hi All,
I have modelled the service interface using GenIL Modelling in Duet Enterprise 1.0. Later, I added some fields to the read operation in the Enterprise Services Builder in the ESR system.
But in the Read Operation mapper method "/IWFND/IF_SRD_BOP_MAP_GET_OBJ~MAP_POST_GET_OBJECTS", when I try to define an object of type GenIL model Attribute Structure (ZMDLZPRGET_DETAIL), Iam unable to access the newly added fields in the read operation.
In transaction " GENIL_MODEL_EDITOR ", under Root Objects, when I open the Attribute Structure name, only the old fields are available, newly added fields are not updated.
But I was able to see the newly added fields in the READ OPERATION data types of Enterprise Services Browser in SE80.
Please help me how to update the new fields for GenIL Model Attribute Structure(ZMDLZPRGET_DETAIL).
Thanks,
KrisHi sap_wiz,
Thanks for your reply.
My problem solved,
Thanks
Kris -
Problem in setting a Model Attribute of type Time
Hi,
I have two model attributes of type time(I mean corresponding structure R/3 fields are of type time).
I do
wdContext.currentModel1().setTime(wdContext.currentModel2.getTime);
Till yesterday, this was working fine.
Today it assigns a "time+GMT Offset" to the Model1 timefield. (Yesterday it Model1.getTime gave 15:30:00
Today its gives 23:30:00, I am in Singapore 8+ time zone).
Any ideas why this is happening. And any solutions to prevent this. Also what are the places where we need to correct the time zones if any?
Regards,
ShubhamHi Bharathwaj,
I have debugging activated both in WebDynpro and R/3. Both places time is 23:30:00 after copy from model2 attribute that has 15:30:00
I will try to use your first suggestion.
Any ideas, time attribute in Context is depenedent on local PC or on the Server?
Regards,
Shubham -
Interface Controller context model attribute error
I am trying to create a controller interface as such: I created a DC that goes out and retrieves SAP ID using a RFC call. My controller context is bound to a RFC model. I'd like to expose the SAP ID that comes back from that call within a model attribute to other components. I try to create a model node and corresponding model attribute within the Interface Controller, setting the isInputElement = true. However, as soon as I do this I get a number of compile errors:
"The context model node has not been bound to a model class", "The context model attribute has not been bound to a model property".
Are you not allowed to map model nodes to an interface?Karla,
First, set isInputElement to false. Think again, you are exposint "result" outside but not collecting "input" from outer component.
Next, calculated attributes to the rescue here.
Say, in component controller you have 1..1 / 0..1 model node <i>SapIdQuery_Input</i> with 1..1/0..1 child <i>SapIdQuery_Output</i> that holds <i>System_Id</i> attribute, type <i>string</i>.
Now create in component controller context (right below root node) attribute <i>System_Id</i> of type <i>string</i>, set read-only to true and calculated to true. Switch to source editor and write the following for generated attribute "getter":
if (wdContext.currentSapIdQuery_InputElement() != null &&
wdContext.currentSapIdQuery_OutputElement() != null)
return (String)wdContext
.currentSapIdQuery_OutputElement()
.getAttributeValue("System_Id");
else
return null;
Now add controller usage (of component controller) in interface controller and map attribute in interface controller to calculated attribute in component controller.
If you expirienced problems with mapping, try to create calculated attribute in 1..1 subnode of root context node.
Valery Silaev
SaM Solutions
http://www.sam-solutions.net -
Binding model attributes disables UI elements
Hi ,
I have created a model. and did bind its attributes to the UI elements. RFC is working fine.
But in the runtime all UI elements are disabled bydefault when i bind these to the model attributes but to the same UI element if i bind it to the local attribute its working fine...
I have tried reimpor and recreating model , and also changing the cardinality but not working...
Would not it be possible to bind UI elements to model attributes ? By using model attributes how the UI elements can be enabled ?
Please help me out...
Regards
Sireesha.hi,
this occurs becoz u would have bound the i/p element to a model attibute whose value is null.
to solve dis,
1)create a context attribute in ur view
2)bind the i/p elements to that context attr
3)while executing the rfc , get the value of this context attr and set it to the model attr.
for example if u have a model attr 'name_mo ' which u have to bind to the i/p field element
create a context attr -
name_vn
bind name_vn to the i/p field element
while executind ur rfc,
Test_Input ip = new Test_Input();
ip.setName_mo(wdContext.currentContextElement().getName_vn());
Test_Input is the name of the model node that is bound from model to the view via comp.ctller
Regards
Jayapriya -
Setting "model" attribute from java
Hi!
I want to write this uix code in java:
< <table model="${bindings.DepartmentsView1}">
<contents>
<column>
<columnHeader>ss
</columnHeader>
<contents>
<textInput>
</textInput>
</contents>
</column>
</contents>
</table>
Can anybody tell me what should i write here?
table.setAttributeValue(table.MODEL_ATTR,???);
??? = ${bindings.DepartmentsView1}
Thanx in advance: Gabor Nyergessetting the model attribute in java is not supported.
The model attribute is a parse time property. At parse time it is resolved to individually bind the "real" properties. -
How to format model attributes
I have staffNumber attribute as model attribute which is of type IntegerObject(not premitive int) . In inputTextbox it appears as 3,172 instead of 3172 . How to format Integer object values so that I can display values without comma . I know that , we can create a simple type in dictionary , select format for premitive integer type in representation . However I don't want to do that .
Pl help
BhatI was fed-up and ultimately had to use this code at every integer attribute of model nodes
wdContext.nodeXXX.getNodeInfo().getAttribute("eoStaffno").getModifiableSimpleType().setFormat("##########");
I wanted a global function to change locale settings
like if I do
NumberFormat nf = NumberFormat.getInstance(Locale.getDefault());
nf.setGroupingUsed(false); -
Physical model attribute "Partition Scheme" not saved. (SS2000)
Hello,
I believe this is a bug report.
Scenario:
I have a physical model of a SQL Server database. The model contains partitioned tables, 1 partitioning function and 1 partitioning scheme. If I open the physical model properties of an index or a table, set the "Partition Scheme" attribute, save, close and re-open the model, the "Partition Scheme" attribute is lost. If I don't close out and just re-open the properties page, the attribute is retained. Some how, the attribute is lost in the persistence layer.
If there is a reason the attribute is being reset, please let me know.
Thank for your help, and all the great products you guys make,
Kurt
DataModeler v 3.1.1Hi Kurt,
If there is a reason the attribute is being resetUnfortunately there is a bug causing the problem. Fix will be available in next patch release.
Philip -
How to add a table (dynamic created) into a model attribute
i have dynamically created an internal table. Generally i use model-binding in a stateful MVC-Application.
Is there a possibiltity to transfer the dynamic table to a model. As far as i know generic attributes are not allowed in the modell class.
Every hint welcome
thx in advanceBy some miracle I do have this finally working. I will warn you up front that the code is not the cleanest (I have stuff copied in from all over the place. I probably have lots of unused variable references - but I am running out of time to clean it up further). Also I don't have all the logic to support all your different possible dynamic structure types. I always use SFLIGHT as my dyanmic structure. Therefore you will have to adapt the coding to lookup the actual structure type in use.
So I have a model that has an structure ITAB type ref to data. In my Model initialization I go ahead and dynamically redfine this to my specific type:
METHOD init.
SELECT SINGLE * FROM sflight INTO CORRESPONDING FIELDS OF isflight.
DATA: struct_type TYPE REF TO cl_abap_structdescr,
tabletype TYPE REF TO cl_abap_tabledescr.
struct_type ?= cl_abap_structdescr=>describe_by_name( 'SFLIGHT' ).
CREATE DATA me->itab TYPE HANDLE struct_type.
ENDMETHOD.
Then in my View I have the following:
<%@page language="abap" %>
<%@extension name="htmlb" prefix="htmlb" %>
<%@extension name="phtmlb" prefix="phtmlb" %>
<%@extension name="bsp" prefix="bsp" %>
<htmlb:content design="design2003" >
<htmlb:page title=" " >
<htmlb:form>
<phtmlb:matrix width="100%" >
<%
field-symbols: <wa> type any.
assign model->itab->* to <wa>.
* append initial line to <wa_itab> assigning <Wa>.
data: descriptor type ref to CL_ABAP_STRUCTDESCR.
descriptor ?= CL_ABAP_STRUCTDESCR=>describe_by_data( <wa> ).
data: flddescr type DDFIELDS.
flddescr = descriptor->GET_DDIC_FIELD_LIST( ).
field-symbols: <wa_field> like line of flddescr.
data: label type ref to cl_htmlb_label.
data: input type ref to CL_HTMLB_INPUTFIELD.
data: binding_string type string.
"Loop through each field in the structure Definition
loop at flddescr assigning <Wa_field>.
clear label.
clear input.
concatenate '//model/itab.'
<wa_field>-FIELDNAME
into binding_string.
label ?= cl_htmlb_label=>factory( _for = binding_string ).
input ?= cl_htmlb_inputfield=>factory( _value = binding_string ).
%>
<phtmlb:matrixCell row = "+1"
vAlign = "TOP" />
<bsp:bee bee="<%= label %>" />
<phtmlb:matrixCell col = "+1"
vAlign = "TOP" />
<bsp:bee bee="<%= input %>" />
<%
endloop.
%>
</phtmlb:matrix>
<htmlb:button id="Test" onClick="Test" text="Submit"/>
</htmlb:form>
</htmlb:page>
The key to making this work are custom getter/setters. In your model class, you can copy from the template methods (Like GETM_S_XYZ for the metadata structure method). Copy them and remove the _ on the front of the name. Then change XYZ to the name of the attribute you are binding for. The following are my custom methods.
method get_m_s_itab .
* uses ****************************************************************
* data ****************************************************************
* code ****************************************************************
* method is supposed to return either info about a specific component
* of a structure (component is not initial -> return ref to
* if_bsp_metadata_simple) or the complete structure
* (component is initial -> return ref to if_bsp_metadata_struct)
data: l_attribute_ref type ref to data,
l_attr_ref type ref to data,
l_exception type ref to cx_root,
l_ex type ref to cx_sy_conversion_error,
l_ex_bsp type ref to cx_bsp_conversion_exception,
l_ex2 type ref to cx_bsp_t100_exception,
l_type type i,
l_index type i,
l_name type string,
l_component type string,
l_getter type string.
data: l_field_ref type ref to data,
l_dfies_wa type dfies,
rtti type ref to cl_abap_elemdescr.
data: crap type string,
rest type string,
t_index(10) type c.
split attribute_path at '[' into crap rest.
split rest at ']' into t_index crap.
****Dummy Object to avoid dumps
create object metadata type cl_bsp_metadata_simple
exporting info = l_dfies_wa.
call method if_bsp_model_util~disassemble_path
exporting
path = attribute_path
importing
name = l_name
index = l_index
component = l_component
type = l_type.
data: l_dataref type string.
****Dynamically determine your actual structure - for this demo
****I just hardcode SFLIGHT
concatenate 'SFLIGHT-' l_component into l_dataref.
data: field type ref to data.
****Create a data object of the specified type
try.
create data field type (l_dataref).
catch cx_sy_create_data_error.
exit.
endtry.
rtti ?= cl_abap_typedescr=>describe_by_data_ref( field ).
l_dfies_wa = rtti->get_ddic_field( ).
clear metadata.
create object metadata type cl_bsp_metadata_simple
exporting info = l_dfies_wa.
endmethod.
method get_s_itab .
* uses ****************************************************************
* data ****************************************************************
* code ****************************************************************
* get the given value of the component of the struct, e.g.
* field-symbols: <l_comp> type any.
* assign component component of structure XYZ to <l_comp>.
* value = <l_comp>.
data: l_attr_ref type ref to data,
l_field_ref type ref to data.
data: l_attribute_ref type ref to data,
l_exception type ref to cx_root,
l_ex type ref to cx_sy_conversion_error,
l_ex2 type ref to cx_bsp_t100_exception,
l_type type i,
l_index type i,
l_name type string,
l_component type string,
l_getter type string,
rtti type ref to cl_abap_elemdescr.
field-symbols: <o_data> type any,
<n_data> type any.
*Test
call method if_bsp_model_util~disassemble_path
exporting
path = attribute_path
importing
name = l_name
index = l_index
component = l_component
type = l_type.
* get a field reference for the assignment
field-symbols: <wa> type any,
<l_comp> type any.
assign me->itab->* to <wa>.
assign component l_component of structure <wa> to <l_comp>.
get reference of <l_comp> into l_field_ref.
****Dynamically determine your actual structure - for this demo
****I just hardcode SFLIGHT
data: l_dataref type string.
concatenate 'SFLIGHT-' l_component into l_dataref.
data: field type ref to data.
****Create a data object of the specified type
try.
create data field type (l_dataref).
catch cx_sy_create_data_error.
exit.
endtry.
assign l_field_ref->* to <o_data>.
assign field->* to <n_data>.
move <o_data> to <n_data>.
* call conversion routine
try.
value = if_bsp_model_util~convert_to_string(
data_ref = field
attribute_path = attribute_path
no_conversion_exit = 0 ).
catch cx_sy_conversion_error into l_ex.
me->errors->add_message_from_exception(
condition = attribute_path
exception = l_ex
dummy = value ).
catch cx_bsp_t100_exception into l_ex2.
me->errors->add_message_from_t100(
condition = attribute_path
msgid = l_ex2->msgid
msgno = l_ex2->msgno
msgty = l_ex2->msgty
p1 = l_ex2->msgv1
p2 = l_ex2->msgv2
p3 = l_ex2->msgv3
p4 = l_ex2->msgv4
dummy = value ).
endtry.
endmethod.
method set_s_itab .
* uses ****************************************************************
* data ****************************************************************
* code ****************************************************************
* assign the given value to the component of the struct, e.g.
* field-symbols: <l_comp> type any.
* assign component component of structure XYZ to <l_comp>.
* <l_comp> = value.
data: l_attr_ref type ref to data,
l_field_ref type ref to data.
data: l_attribute_ref type ref to data,
l_exception type ref to cx_root,
l_ex type ref to cx_sy_conversion_error,
l_ex_bsp type ref to cx_bsp_conversion_exception,
l_ex2 type ref to cx_bsp_t100_exception,
l_type type i,
l_index type i,
l_name type string,
l_component type string,
l_getter type string,
rtti type ref to cl_abap_elemdescr.
field-symbols: <o_data> type any,
<n_data> type any.
*Test
call method if_bsp_model_util~disassemble_path
exporting
path = attribute_path
importing
name = l_name
index = l_index
component = l_component
type = l_type.
* get a field reference for the assignment
field-symbols: <wa> type any,
<l_comp> type any.
assign me->itab->* to <wa>.
assign component l_component of structure <wa> to <l_comp>.
get reference of <l_comp> into l_field_ref.
****Dynamically determine your actual structure - for this demo
****I just hardcode SFLIGHT
data: l_dataref type string.
concatenate 'SFLIGHT-' l_component into l_dataref.
data: field type ref to data.
****Create a data object of the specified type
try.
create data field type (l_dataref).
catch cx_sy_create_data_error.
exit.
endtry.
assign field->* to <n_data>.
move <l_comp> to <n_data>.
* call conversion routine
try.
if_bsp_model_util~convert_from_string(
data_ref = field
value = value
attribute_path = attribute_path
use_bsp_exceptions = abap_true
no_conversion_exit = 0 ).
catch cx_sy_conversion_error into l_ex.
me->errors->add_message_from_exception(
condition = attribute_path
exception = l_ex
dummy = value ).
catch cx_bsp_conversion_exception into l_ex_bsp.
me->errors->add_message_from_exception(
condition = attribute_path
exception = l_ex_bsp
dummy = value ).
catch cx_bsp_t100_exception into l_ex2.
me->errors->add_message_from_t100(
condition = attribute_path
msgid = l_ex2->msgid
msgno = l_ex2->msgno
msgty = l_ex2->msgty
p1 = l_ex2->msgv1
p2 = l_ex2->msgv2
p3 = l_ex2->msgv3
p4 = l_ex2->msgv4
dummy = value ).
endtry.
if <n_data> is initial.
clear <l_comp>.
else.
move <n_data> to <l_comp>.
endif.
endmethod.
I know that is a LOT of nasty code without too much explanation. I'm afriad there isn't time right now to expand on how it works too much. Between my day job and trying to finish the BSP book, there just isn't much time left. Like I said before there is a very large section in the book on this topic that hopefully explains it. The book will be out in December or early January - but perhaps I will get some time before then to write up something on SDN about this.
Maybe you are looking for
-
How do I Edit an Existing PDF Form Without Losing Form Functionality
I'm brand new to Acrobat but familiar and proficient with Flash, PhotoShop Premiere Pro, After Effects, Dreamweaver, Fireworks etc. The company I work for sells office supplies. We sell 57 distinct items. We have Acrobat 9. I am designing a PDF ord
-
Hi all got a new Macbookpro, how do i connect to my TV and what leads should i get. None in the box macbookpro Mac OS X (10.4.8)
-
ABAP HR leading zero's for PERNR
Hi, I am working on a report where I have select statements. When the pernr is given with out leading zeros its not taking it.. I need to make the pernr with leading zeros like if I hav pernr 35 its not getting data.. when i give 0000035 it gets.. so
-
I have two ejb's in the ear file that has been deployed. Now i want to include one more ejb in my application. Can I add that directly in the applications folder or should i generate the .ear file again.?
-
Permissions Change on startup normal or wrong?
Hello MacPeople... I've had a battle with Tiger after I loaded it a few months ago. To make this short, I ultimately found ONE bad block with TT 4.5.2., erased, zeroed the internal drive, cloned back from my FW. Now all seems hunky-dorey.... Here's t