on 10-09-2009 12:21 PM
Hi,
I am not able to add text for radiobutton groups. Like
I have created one Radio Button Group. In public void wdDoInit() i am wrote code like this but it's not effecting...
public void wdDoInit()
{
wdContext.createRADIOGROUPElement().setEBELN("Red");
wdContext.createRADIOGROUPElement().setEBELN("Blue");
wdContext.createRADIOGROUPElement().setEBELN("Green");
}
But its shoing empty in radiobuttongroupbyindex element in my Webdynpro Layout. I am using SAP NetWeaver Developer Studio.
But i am able to do this in SE80 tcode using WebDynpro ABAP.
Here i am not getting how to do this.
Plz any guidance on this...
Regards,
Shankar.
Hi Shankar,
Are you using the code shown exaclty? or posted the simplified code.
public void wdDoInit()
{
wdContext.createRADIOGROUPElement().setEBELN("Red");
wdContext.createRADIOGROUPElement().setEBELN("Blue");
wdContext.createRADIOGROUPElement().setEBELN("Green");
}
If you are using exactly the same code, change and try with this .
public void wdDoInit()
{
IPrivate<View>.IRADIOGROUPElement element1 = wdContext.createRADIOGROUPElement();
element1.setEBELN("Red");
wdContext.nodeRADIOGROUP().addElement(element1);
IPrivate<View>.IRADIOGROUPElement element2 = wdContext.createRADIOGROUPElement();
element2.setEBELN("Blue");
wdContext.nodeRADIOGROUP().addElement(element2);
IPrivate<View>.IRADIOGROUPElement element3 = wdContext.createRADIOGROUPElement();
element3.setEBELN("Green");
wdContext.nodeRADIOGROUP().addElement(element3);
}
Feel free to revert in case of any issues.
Regards,
Siva
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
I am using same code which i posted.
And i tried as you given,
IPrivateStartView.IRADIOGROUPElement element1 = wdContext.createRADIOGROUPElement();
element1.setEBELN("Red");
Here StartView is view name. In above code when we type
IPrivateStartView.
it will show a list to choose. In the same way when i type element1.
it's nothing is showing.And it's showing the error like this.
IPrivateStartView.IRADIOGROUPElement cannot be resolved or is not a type
Regards,
Shankar.
Hi,
use the following code in your wddoinit()
IPrivateStartView.IRADIOGROUPElement EL1 = wdContext.nodeRadioButton().createRADIOGROUPElement();
EL1.setEBELN("red");
wdContext.nodeRADIOGROUP().addElement(EL1);
IPrivateStartView.IRadioButtonElement EL2 = wdContext.nodeRadioButton().createRADIOGROUPElement();
EL2.setEBELN("BLUE");
wdContext.nodeRADIOGROUP().addElement(EL2);
IPrivateStartView.IRADIOGROUPElement EL3 = wdContext.nodeRadioButton().createRADIOGROUPElement();
EL3.setEBELN("GREEN");
wdContext.nodeRADIOGROUP().addElement(EL3);
if you are getting that error
IPrivateStartView.IRADIOGROUPElement cannot be resolved or is not a type
then right click and select organise imports.
and yeah one more thing texts property of radiobuttongroupbyindex UI element should be bound to EBELN context attribute.
Hope this will solve your problem.
Sarbjeet Singh Gill
Hi,
I wrote code like this. It's worked.
String[] rbop = new String[]
{
"Red", "Green", "Blue"
};
for(int i = 0; i < rbop.length; ++i)
{
IPrivateStartView.IRadioGroupElement el = wdContext.nodeRadioGroup().createRadioGroupElement();
el.setEBELN(rbop<i>);
wdContext.nodeRadioGroup().addElement(el);
}
And, Now my dought is, Why it's not worked when i wrote code like this...
String[] rbop = new String[]
{
"Red", "Green", "Blue"
};
for(int i = 0; i < rbop.length; ++i)
{
wdContext.nodeRadioGroup().addElement(rbop<i>);
}
Plz can you tell me the difference....
Regards,
Shankar.
HI
The other method is not working because in that you are trying to add a string varibale inplace of element type which is not possible.
AddElement( ) is method related to context node which will except only IWDNodeElement type of argument. Here you are trying to pass string which is not correct.
So thats why first you have to create an element and then set what ever attribute you want to set and then add it to the node.
Hope it is clear.
regards,
sarb
Hi,
Thank you very much sarbjeet singh , Actually i am trying this concept as
There will be 3 Radio Button options. When ever i select any radio button that corresponding option text has to display in
TextView element.
I tried in this way but it's not working.
public void onActionSELECTITEM(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
{
String seloption;
int i;
i = wdContext.nodeRadioGroup().getLeadSelection();
seloption = wdContext.nodeRadioGroup().currentRadioGroupElement().getEBELN(i);
}
I am new to JAVA coding concepts Plz guide me....
Regards,
Shankar.
Hi
use the following code
public void onActionSELECTITEM(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
{
String seloption = wdContext.currentRadioGroupElement().getEBELN();
}
it will directly put the current selected value of EBELN in the string Seloption.
Then you can use it to display in the textview.
regards,
Sarbjeet Singh,
Hi,
I got it. I wrote like this code and it's working fine.
public void onActionSELECTITEM(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
{
String seloption;
int i;
i = wdContext.nodeRadioGroup().getLeadSelection();
seloption = wdContext.nodeRadioGroup().currentRadioGroupElement().getEBELN().toString();
wdContext.currentContextElement().setVIEWTEXT(seloption);
}
Thanks for all your Guidence.....
Regards,
Shankar.
Verify that you have bound the "texts" property of RadioButtonGroupByIndex to attribute "EBELN" and that you have added the context elements to the "RADIOGROUP" node. Your code only creates context elements but doesn't add them to the node.
Armin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Shankar,
You may do this like -
1. Go to Dictionaries -> Data Types -> Simple Types
2. Create a simple type, say RadioOptions.
3. Under Enumerations, do the enteries as you require. In values - you need to write there id & In Discription - Text you want in GUI.
4. Create a context, say X (cardinality - 1:n & Type - select simpletype "RadioOptions" created in above step)
5. In your properties view - Add child RadioButtonByKey / Index
6. Map SelectedKey / texts property with context X
Its done....deploy & enjoy.
Best Regards
Chander Kararia
Edited by: Chander Kararia on Oct 9, 2009 5:35 PM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Create a context, say X (cardinality - 1:n & Type - select simpletype "RadioOptions" created in above step)
In this Type- Select Simpletype from where we have to do this. In properties tab i didnt find any property Type
So i have created a ValueNode and ValueAttribute.
For Value Node i have set the properties like this.
Cardinality 1:n
For Value Attribute i have set the properties like this.
Type com.sap.examples.welcome.RadioOptions
In Output it's showing only one radiobutton with out description .
Regards,
Shankar.
User | Count |
---|---|
79 | |
9 | |
9 | |
7 | |
7 | |
7 | |
6 | |
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.