on 08-30-2005 2:03 PM
Hi All,
I have 1 input field and 1 button.I've defined a model node and inside that model attribute in my view.If I enter something in the Input field the value should go to the particular model attribute I defined.How to pass that input parameter.I have a action like this....
public void onActionGetDateDetails(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
{
//@@begin onActionGetDateDetails(ServerEvent)
wdThis.wdGetGetDateDetailsCustController().execute_Bapi_Get_Date_Details("");
// while executing the above method I have to pass the input parameter typed in the input field.
Structure of my context :
Bapi_Date_Details
-
>Network List(Model Node)
|
-->Network (Model Attribute)
//@@end
}
Help me to solve this.
Thankx in advance.
Regards,
Karthick.K.E
Hi Karthick,
Have you bound your input field with model attribute?
If no then do it. If yes, and still giving problem then check your code with following.
Bapi_Get_Date_Details model = new Bapi_Get_Date_Details();
model.set<Network List>(new <type of Network List>); // This step is missing in your case i guess.
ipublic<component>.iBapi_Get_Date_Detailselement ele = wdcontext.createBapi_Get_Date_DetailsElement(model);
wdcontext.nodeBapi_Get_Date_Details().bind(ele);
You also have to assign memory/instantiate object for your node located inside main node.
Regards,
Bhavik
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
The input field is disabled because there is no storage area to recieve the user input.
So create a element as Noufal suggested and it will work.
By the way why you are passing parameter through the execute_Bapi_Get_Date_Details method.
Hope this helps.
Regards,
Vijith
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Vijith,
I want to make the input field as mandatory.So while calling the execute_Bapi_Get_Date_Details method I want to get the entered value in the input field and I want to pass it to check Mandatory method.How to do that?help me plz.Now I implemented thegiven ideas and those are working fine.But without entering anything in the input field if the user tries to click the button I want to give the error message.
Regards,
Karthick
Hi,
If you have input field bound to your model node try this
wdContext.current<Modelname>element().get<attribute name>();
The above code will give you the value in the input field.Check whether this is empty and print out a message using message manager like wdComponentAPI.getMessageManager().reportException("Message to be printed",true);
Hope this helps
Regards,
Vijith
Hi Karthick,
You can associate an input field's value to a BAPI in two ways:
1) binding the input UI element's 'value' directly to the BAPI's input attribute that you want to set. This is the methos Noufal suggested. In this method, make sure you initialize the attribute through the following lines of code in the doInit() method, else, the input field will be disabled.
<b><Bapi_name>Input input = new <Bapi_name>Input();
input.set<Attribute_name>(new <dataType>);</b>
2) The second method is settting the input's 'value' to some other attribute(say 'abc') and giving this value to the input parameter just before calling the RFC.
input.set<Attribute_name>(wdContext.currentContextElement.getAbc());
Hope this helps,
Best Regards,
Nibu
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Nibu,
As you told I tried
input.set<Attribute_name>
(wdContext.currentContextElement.getAbc());
But for me the "abc" -is not a value attribute.Its a model attribute which is under modelnode and the model node is under another model node.How to get that model attributes value?
Other ideas given by you are working fine.
Regards,
Karthick
Hi,
How to get the value of the input given.But the input is binded with the model attribute which is under model node.
Can anyone help me in this.
Regards,
karthick
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Bind the inputField to the model attribute to which you need the value inserted.
In the WDDoInit() of the component controller write the following code.
BAPI<name> inp=new BAPI<name>();
wdContext.nodeBAPI<name>().bind(inp);
inp.set<attribute>(new <dataType>());// for eg. new String()
Now on click of the button call the method you have defined.
in the method
try{
wdContext.currentBAPI<name>element().modelObject().execute();
}catch(Exception e){
}
wdContext.nodeOutput().invalidate();
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.