cancel
Showing results for 
Search instead for 
Did you mean: 

Why appear as readonly?

Former Member
0 Kudos

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,

Accepted Solutions (0)

Answers (12)

Answers (12)

Former Member
0 Kudos

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,

Former Member
0 Kudos

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...

Former Member
0 Kudos

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.

Former Member
0 Kudos

I don´t understand..... I don´t know very english....

What are you say me that change? I want that the value of the inputfield in the searchview find the values in sap/r3

Former Member
0 Kudos

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.

Former Member
0 Kudos

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,

Former Member
0 Kudos

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>

Former Member
0 Kudos

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>

Former Member
0 Kudos

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>

Former Member
0 Kudos

Hi Victor,

Why are you creating a new model node in JCOCust. Just goto navigation modeler and map the model context to the model context.

Regards,

Murtuza

Former Member
0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos

Sorry, i don´t undertand... I don´t know very english...

Are you see my image? Delete all datalinks? You say that i create a datalink between SearchView and Used Model or Custom Controller?

Former Member
0 Kudos

Victor,

Data link between your model and controller and then between controller and view.

Sorry, but your image is blocked here and I won't be able to have a look at it.

Regards,

Murtuza

Former Member
0 Kudos

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,

Former Member
0 Kudos

Yes victor,

you are going right now.

<b>Delete all and create:

- CustomController and UsedModel

- SearchView and CustomController

- ResultView and CustomController</b>

Regards,

Murtuza

Former Member
0 Kudos

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

Former Member
0 Kudos

Don´t work... Now i write all my steps... I delete the project and i write all steps...

Former Member
0 Kudos

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

Former Member
0 Kudos

Hi Victor,

Add this line:

wdContext.nodejco_input.addElement(input);

Regards,

Murtuza

Former Member
0 Kudos
public void wdDoInit() 
{ 
//@@begin wdDoInit() 
Bapi_Material_Getbatches_Input input = new Bapi_Material_Getbatches_Input(); 
wdContext.nodeJco_input().bind(input); 
input.setMaterial(new String()); 
wdContext.nodeJco_input().addElement(input); // add this line 
//@@end 
}

Regards

Chaitanya.A

Former Member
0 Kudos

Where?

Former Member
0 Kudos

Appear an error that say: addElement(IWDNodeElement) in the type Node is not applicable for the arguments (Bapi_Material_GetBatches_Input)...

I change the cardinality too and don´t work...

Message was edited by:

Victor Capi

Former Member
0 Kudos

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

Former Member
0 Kudos

Error, say that the method currentBAPI_Material_GetBatches_inputElement() is undefined for the type IPublicJcocust.IContextNode...

Former Member
0 Kudos

try these

wdContext.nodeJco_input().addElement(wdContext.createJco_input());

wdContext.nodeBapi_Material_GetBatches_Input().bind(new nodeBapi_Material_GetBatches_Input());

Regards

Chaitanya.A

Former Member
0 Kudos

but where? In the controller custom or in the view?

Former Member
0 Kudos

Component Controller's <b>wdDoinit()</b>

Regards

Chaitanya.A

Former Member
0 Kudos

Appear this error: the method currentBAPI_Material_GetBatches_inputElement() is undefined for the type IPublicJcocust.IContextNode...

Former Member
0 Kudos

Hi Victor,

Write this:

IPrivate<viewname>.IBapi_Material_Getbatches_InputElement ele = wdContext.nodeBapi_Material_Getbatches_Input().createBapi_Material_Getbatches_InputElement(new Zbapi_Getemployee_Input());

wdContext.nodeBapi_Material_Getbatches_Input().addElement(ele);

Regards,

Murtuza

Former Member
0 Kudos

Appear an error: IPrivateJCOView.IBapi_Material_Getbatches_InputElement cannot be resolver or is not a type

Former Member
0 Kudos

have your tried ORAGANIZE IMPORTS . is any import statement missing?

Regards

Chaitanya.A

Former Member
0 Kudos

Hi Victor,

Right click on that and select organize imports.

Regards,

Murtuza

Former Member
0 Kudos

No add more... I have this:

import com.sap.pruebas.jco.rfc.Bapi_Material_Getbatches_Input;

import com.sap.pruebas.jco.wdp.IPrivateJCOView;

import com.sap.pruebas.jco.wdp.IPrivateJcocust;

Message was edited by:

Victor Capi

Former Member
0 Kudos

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

Former Member
0 Kudos

Right click on the error(red line) select <b>SOURCE</b>-><b>ORGANIZE IMPORTS</b>

regards

Chaitanya.A

Former Member
0 Kudos

Not import nothing...

Former Member
0 Kudos

import com.sap.pruebas.jco.wdp.IPublicJCOView;

import com.sap.pruebas.jco.wdp.IPublicJcocust;

add these two import statements and try

Regards

Chaitanya.A

Former Member
0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos

The node of my context say jco_input, but when i go to implementation in the view... when i write import com.sap.pruebas.jco.wdp.IPrivateJCOView.Ijco_inputElement;

Appear an error, not exist Ijco_inputElement... not existe nothing when y press cr+space in IPrivateJCOView...

Former Member
0 Kudos

Hi Victor

Don type that import statement

first write the code in the<i> wdDoinit()</i> and finally use <b>ORGANISE IMPORTS</b> option it will be automatically add that import statement

Regards

Chaitanya.A

Former Member
0 Kudos

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,

Former Member
0 Kudos

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

Former Member
0 Kudos

Yes . that is correct,

Regards

Chaitanya.A

Former Member
0 Kudos

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

Former Member
0 Kudos

In rootUIElementContainer i select apply template, select form, select the attribute of the context (there is one only), and appear the label and the input correct. I execute the application and appear as readonly...

Former Member
0 Kudos

then use this code

I<your node name>Element <b>node</b>=wdContext.create<your node name>Element
node.set<yout attribue>();// ex to set name node.setName("HI");
wdContext.node<your node name>.addElement(node);

Regards

Chaitanya.A

former_member185029
Active Contributor
0 Kudos

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