on 09-19-2007 8:55 AM
Hi, i´m doing an application, i create a new model, select Import Adaptative RFC Model, select the bapi function... After, i create a new view, i put an input field, in the propertie value select an attribute of the context. I execute the application and the input field appear as readonly, why?
Thanks,
I find the solution.
I create a new element attribute in the context in customcontroller, and in the property value in searchview i write this attribute.
I delete all wddoinit in customcontroller, and in the method executeBapi_Material_Input:
public void executeBapi_Material_Input( )
{
//@@begin executeBapi_Material_Input()
Bapi_Material_Getbatches_Input input = new Bapi_Material_Getbatches_Input();
wdContext.nodeBapi_Material_Input().bind(input);
input.setMaterial(wdContext.currentContextElement().getValue1());
try {
wdContext.currentBapi_Material_InputElement().modelObject().execute();
wdContext.nodeOutput().invalidate();
} catch (Exception e) {
e.printStackTrace();
}
//@@end
}
Now work fine...
Thanks,
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I see the problem, the problem is in this method:
public void wdDoInit()
{
//@@begin wdDoInit()
Bapi_Material_Getbatches_Input input = new Bapi_Material_Getbatches_Input();
wdContext.nodeBapi_Material_Input().bind(input);
<b> input.setMaterial(new String());</b>
//@@end
}
If i write previous appear the error, but if i write input.setMaterial("201311630A08000011"); work fine...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
U mean you can bind that variable with the UI element Inputfiled and send the value through screen then the output is comoing.
But here u are testing for single input valueonly.
when binding with Inputfiled MaterialNo then dynamically u can pass the value and write the execute method in the Action of the button.
then it will work.
thanks,
Lohi.
I do these steps:
I create an action, and in the method onActionSearch that it´s in SearchView:
public void onActionSearch(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
{
//@@begin onActionSearch(ServerEvent)
wdThis.wdGetJCOCustController().executeBapi_Material_Input();
//@@end
}
In the custom controller:
public void wdDoInit()
{
//@@begin wdDoInit()
Bapi_Material_Getbatches_Input input = new Bapi_Material_Getbatches_Input();
wdContext.nodeBapi_Material_Input().bind(input);
input.setMaterial(new String());
//@@end
}
public void executeBapi_Material_Input( )
{
//@@begin executeBapi_Material_Input()
try {
wdContext.currentBapi_Material_InputElement().modelObject().execute();
wdContext.nodeOutput().invalidate();
} catch (Exception e) {
e.printStackTrace();
}
//@@end
}
When i execute the application and write in the input, appear de previous error.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
In SeacrhView, in layout, i click apply template... select form and after there is an attribute only... i select and create the label and the inputfield...
I rebuild the project, create archive and deploy...
I go to http://<server>:<port>/webdynpro/welcome and configure the application.
After execute the application, and the input is as readonly...
What happend?
Thanks,
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
In ResultView, in the context, i create a model node: Material, click in edit model binding and add only two attribute:
<a href="http://img212.imageshack.us/my.php?image=searchjf7.jpg" target="_blank"><img src="http://img212.imageshack.us/img212/2059/searchjf7.th.jpg" border="0"/></a>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
In SearchView and ResultView i add the JCOCust in properties.
In SearchView, in the context, i create a model node: Bapi_Material_Input, click in edit model binding and add only one attribute:
<a href="http://img212.imageshack.us/my.php?image=searchjf7.jpg" target="_blank"><img src="http://img212.imageshack.us/img212/2059/searchjf7.th.jpg" border="0"/></a>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Project name: JCO
Application: JCOApp
Component: JCO
Custom Controller: JCOCust
Views:SearchView and ResultView
Create Model:
Import Adaptative RFC Model, Name: MaterialModel, package: com.sap.model, model instance: WD_MATERIAL_MODELDATA_DEST, RFC metadata: WD_MATERIAL_RFC_METADATA_DEST. I connect with R3 and select the bapi: BAPI_MATERIAL_GETBATCHES and finish.
In the component select used models and add the model MaterialModel.
In the JCOCust, in context --> new model node Bapi_Material_Input. After, edit Model Binding, select Bapi_Material_Getbatches_Input and select (in the image):
<a href="http://img233.imageshack.us/my.php?image=custdc9.jpg" target="_blank"><img src="http://img233.imageshack.us/img233/6902/custdc9.th.jpg" border="0" alt="Free Image Hosting at www.ImageShack.us"; /></a>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
This is my model:
<a href="http://img462.imageshack.us/my.php?image=diagrambw4.jpg" target="_blank"><img src="http://img462.imageshack.us/img462/3435/diagrambw4.th.jpg" border="0"/></a>
Is it wrong? Delete de model node in custom controller? How map it?
Message was edited by:
Victor Capi
Message was edited by:
Victor Capi
Victor,
In NWDS, Right Click on your Component Name and select Open Data Modeler
Select create a delta link in the selection tool bar on the left and strech it from controller to your model. Now it will ask you to map the nodes and attributes. Select the input model node and now the same node structure would be available in your controller.
Similarly now map from controller to view.
Regards,
Murtuza
Now i have something very strange. I have data link:
- SearchView and CustomController
- SearchView and UsedModel
- ResultView and CustomController
- ResultView and UsedModel
- CustomController and UsedModel
Delete all and create:
- CustomController and UsedModel
- SearchView and CustomController
- ResultView and CustomController
Ok?
Thanks,
Ok, now i can write in the inputfield, but when i press search appear this error:
com.sap.tc.webdynpro.progmodel.context.ContextException: DataNodeInfo(SearchView): cannot modify Material because it is mapped and there is no active NodeElement to take the value
at com.sap.tc.webdynpro.progmodel.context.MappedAttribute.getDataPointer(MappedAttribute.java:82)
at com.sap.tc.webdynpro.progmodel.context.MappedAttribute.setObject(MappedAttribute.java:117)
at com.sap.jco.app.wdp.IPrivateSearchView$IContextElement.wdSetObject(IPrivateSearchView.java:152)
at com.sap.tc.webdynpro.progmodel.context.AttributePointer.setObject(AttributePointer.java:240)
at com.sap.tc.webdynpro.clientserver.data.DataContainer.transportPendingUserInput(DataContainer.java:1258)
... 29 more
Don´t work... Now i write all my steps... I delete the project and i write all steps...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I put a new image:
<a href="http://img221.imageshack.us/my.php?image=aplicacion2ho5.jpg" target="_blank">!http://img221.imageshack.us/img221/3262/aplicacion2ho5.th.jpg|alt=Free Image Hosting at www.ImageShack.us|src=http://img221.imageshack.us/img221/3262/aplicacion2ho5.th.jpg|border=0!</a>
I think that it´s all good... no?
In the custom controller i have:
public void wdDoInit()
{
//@@begin wdDoInit()
Bapi_Material_Getbatches_Input input = new Bapi_Material_Getbatches_Input();
wdContext.nodeJco_input().bind(input);
input.setMaterial(new String());
//@@end
}
All correct? It continues without working
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hey Capi,
Follow these steps.
In your custom /Component controller u defined your modenodes from your Model.
Then in the init method of the custom/component controller u add the following code.
Wddo init()
{
BAPI_Material_GetBatches()_input input = new BAPI_Material_GetBatches_Input();
wdContext.nodeBAPI_Material_GetBatches_input().bind(input);
input.setMaterialNo("10000"); //here hard code the value
try{
Wdcontext.currentBAPI_Material_GetBatches_inputElement().ModelObject().execute();
Wdcontext.nodeOutput().invalidate();
}
catch(Exception)
{
e.printstacktrace());
}
}
In the output node u have any of node contains output table that create as first View with talbe binding with your outputnode.
it might helps you.
Try this code in your end mi
Thanks,
Lohi
Hi,
Expand your component controller context I mean allnodes and nodeelements needs to be displayed in the screen shot.
show me once such that I will give you the solution.
<b>I am not able to open your image Send that componentsontrollercontext screen shot </b>
Thanks,
Lohi.
Message was edited by:
Lohitha M
Message was edited by:
Lohitha M
Hi Victor,
There are 2 options:
1. Change the cardinality of the input node to 1:n from 0:n
2. Instantiate an input node element in wdDoInit()
<bapi_inputnode> ele = new <bapi_inputnode>();
wdContext.node<bapi_inputnode>().addElement(ele);
Regards,
Murtuza
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
if you are binding your elements with a node of your context say " MyNode "
import like this
import yourpackage.IPrivateYourView;
import yourpackage.IPrivateYourView.IMyNodeElement;
and
in your WdDoint()
I<MyNode>Element node=wdContext.create<MyNodeElement>
node.set<MyElement1>()="";
node.set<MyElement2>()="";
wdContext.node<MyNode>.addElement(node);
Regards
Abhijith YS
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I write this:
Ijco_inputElement node = wdContext.createjco_inputElement
node.setMaterial();// ex to set name node.setName("HI");
wdContext.nodejco_input.addElement(node);
The model node in context is jco_input and the model attribute in model node is material.
The inputfield is material... Is the previous code good?
Thanks,
Hi,
U need to instantiate the BAPI in your WDdoinit() method of your first screen ro Component/custom controller.
For suppose your FNM name is BAPI_FLIGHTLIST
BAPI_FLIGHTLIST input = new BAPI_FLIGHTLIST();
wdcontext.nodeBAPI_FLIGHTLIST().bind(input);
And bind the currect Value attribute to UI element.
Then it should be visible.
Thanks,
Lohi.
Message was edited by:
Lohitha M
HI
have you added the element to the node
are you Using <b>Component Cotroller Node</b> --> <b>Apply Template</b> --><b>Form</b> (Wizard)
in this case you need to manually add the element to the node,like
I<your node name>Element node=wdContext.create<your node name>Element
node.set<yout attribue>();
wdContext.node<your node name>.addElement(node);
Regards
Chaitanya.A
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
If the model context is null then the input field will be readonly.
For example if you have a model node as Data and inside that there is a context say Name. Then unless the node Data is populated with values and Name cotains value, the UI element which is bound with Name will be readonly.
Ashu
User | Count |
---|---|
76 | |
9 | |
8 | |
7 | |
6 | |
5 | |
5 | |
5 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.