on 03-06-2009 9:08 AM
Hi ,
I want to populate the list of countries in the Dropdown by key. I am able to do this using simple types from Local Dictionary. But the list is very small as i have not added all countries. So please tell me any alternative to populate list of all passible countries.
Hi
Use this java code
for (Locale locale : Locale.getAvailableLocales())
{
final String contry = locale.getDisplayCountry();
if (contry.length() > 0)
{
// Take All Data in one Node Point 1
wdComponentAPI.getMessageManager().reportSuccess(("Country = " + contry + ". ISO code: " + locale.getISO3Country());
}
}
and Populate all data in SimpleType, as
//Node which contain All Country
IPublicAdminComp.IReturnGetAllDistrictElement district;
IWDNodeInfo nodeinfo_dist = wdContext.nodeRegionDetails().getNodeInfo();
//Attribute which will bind to DropdownByKey
IWDAttributeInfo attributeInfo = nodeinfo_dist
.getAttribute(IPublicAdminComp.IRegionDetailsElement.COUNTRYCODE);
ISimpleTypeModifiable districtYype = attributeInfo.getModifiableSimpleType();
IModifiableSimpleValueSet valueSet_dist = districtYype.getSVServices().getModifiableSimpleValueSet();
valueSet_dist.clear();
// Retrieve all Data from Point 1
for (int i = 0; i < wdContext.nodeReturnGetAllDistrict().size(); i++)
{
district = wdContext.nodeReturnGetAllDistrict().getReturnGetAllDistrictElementAt(i);
valueSet_dist.put(district.getSalesOrgCode(), district.getSalesOrgName());
}
Best Regards
Satish Kumar
Edited by: satish jhariya on Mar 6, 2009 2:47 PM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ok
Follow
1. If u have some standard RFC/EJB/WebService for this then use it and populate it through the second code which I provided.
2. If u dont have any RFC/EJB/WebService , In this case user the first Code to populate all the country
in one particular node say CountryDataNode.
For this
a. Create one Method say getAllCountry,create one Context Node say CountryDataNode.
b. instead of writing
for (Locale locale : Locale.getAvailableLocales())
{
final String contry = locale.getDisplayCountry();
if (contry.length() > 0)
{
IPrivateGenCompView.ICountryDataNodeElement counEle = wdContext.createAndAddCountryDataNodeElement();
counEle.setCountryName(contry);
//
}
}
wdComponentAPI.getMessageManager().reportSuccess(wdContext.nodeCountryDataNode().size() +" Size");
3. Now all the country are availabe in CountryDataNode ,
4. Create one SimpleType and now u have to populate all the values from CountryDataNode to this simpleType
4. Now Follow from Second Node I have commented their all the thing
Hope it help u now
Best Regards
Satish Kumar
This is how i have achieved the list of countries to be populated in Dropdown
Create a Node - Country
and Node Element - List
public void CountryList( )
{
//@@begin CountryList()
Locale local[] = Locale.getAvailableLocales();
int len =local.length;
IPrivateDemoView.ICountryNode node = wdContext.nodeCountry();
for(int i =0;i<len;i++)
{
final String country = local<i>.getDisplayCountry();
if(country.length()>0)
{
IPrivateDemoView.ICountryElement countryelem = wdContext.createCountryElement();
countryelem.setList(country);
node.addElement(countryelem);
}
}
//@@end
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Satish,
I am able to Display the countries in the DropDown thanks for help.
but now i want to populate the list of states of selected country in
other dropdown.
Please help me.......
Regards
Abhay.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Abhay
For populating the list of states of selected country u have to take help from database guys.what they will do for u is
1. They Create some standard service either on EJB/ WebServices or Simple java class
2. Service will look like this getAllState(String countryName)
3. Once u selected the Country internally getAllState(String countryName) will be called and gives u the all state comes under that country in other dropdown (Code is there how to populate Data in dropdown right ).
4. Abhay keep in mind for production use u have to do these all exercise from services only ,but if this is just a learning exercise then u can do this all with the help of java class
Best Regards
Satish Kumar
Hello all,
Please tell me the Java code whill will solve my problem. If from Dropdown which i want to populate by list of countries user selects perticular country then appropriate list of states should come into the otner dropdown
regards,
abhay
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
One good alternative for ur requirements is , u can have a Services which gives u list of countries .
instead of dropdownby key , use drop down by index and display the list of countries in dd by executing the model in web dynpro.
Thanks and Regards
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi
use dropdownbyindex , and there is a stansard RFC which will have of all the countryies in
dropdown.
So please ask your ABAPER to find the RFC and get integrate it with WebDynpro .
And i hope thats a good approach .
murali
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
91 | |
10 | |
10 | |
9 | |
9 | |
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.