on 07-24-2006 8:55 AM
Hi
My Requirement is.... i have to get the material numbers from the back end database and i have to add this material number to DropDown List dynamically.....
Once i select the number and click on the GO button all the information related to that material number has to display on front end page
please help me
Thanks & Regards
Ravi Shankar B
Hi,
Here i am getting data from R/3 System..... for this how to get the connection.... i know how to get the connection for oracle..sql. but i dont know how to do here.... i dont know the connection parameters.....how to know the JNDi name which has given in lookup() method
can u suggest me?
Thanks & Regards
Ravi shankar b
Message was edited by: RaviShankar B
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi ravi,
Sorry for my assumption that you are using database
IPrivate<view>.<node> Node node=wdContext.Node<node>;
node.invalidate();
First Execute the BAPI and find out the output node's size,say size;
then you can use any loop
for(int j=0;j<size;j++)
{
int matno=wdContext.node<Outputnode>().get<Outputnode
>ElementAt(i).get<Attribute>();
IPrivate<view>.<node> element ele=wdContext.Create<node>element
ele.set<attribute>(matno);
node.addElement(ele);
}
Regards,
Saravanan K
}
Hai Ravi,
Create a model of type adaptive RFC model, here you give required information to connect to r/3
after wards add this model to controller,
add code like this,
wdContext.currentrequestXXXX.setXX();//give any inputs that reuire to execute abapi
wdContext.currentrequestXXXX.modelObject.execute();
wdContext.nodeResponse().invalidate();
int size=wdContext.nodeResult.size();//find out the size of result.
bind this result to dropdownbyindex Element.
regards,
Hi,
How to load the values using ResultSet and Statement....
help me...
Thanks & Regards
Ravi Shankar B.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Ravi,
After getting the connection, name it as conn,
Statement st=conn.createStatement();
Resultset rs=st.executeQuery("Query");
IPrivate<View>.I<Context>Node mnode=wdContext.node<Context>();
mnode.invalidate();
while(rs.next()){
IPrivate<View> melement=wdContext.create<Node>Element();
melement.set<parameter>(rs.getInt("field in database"));
mnode.addElement(melement1);
}
P.S:
You can get the connection using
InitialContext initialContext = new InitialContext();
DataSource dataSource = (DataSource)initialContext.lookup("jdbc/Alias name");
java.sql.Connection conn = dataSource.getConnection();
Regards, Saravanan K
Hello,
I assume that you have somewhere all Material information : ID and Desc
The below code deals with a DropDownByKey (I know it is not your request, but... have a look)
-
the shem you have to have in your mind is :
-----------
+
Key | value |
-----------
+
AA11 | Hammer |
-----------
+
... | ... |
-----------
+
In your <b>context</b> :
-> <i>Material4DropDownByKey</i> type <i>String</i>
Your<b> initialization methode</b> :
<i>//Get access to data type instance to be modified at runtime
ISimpleTypeModifiable myType=wdThis.wdGetAPI().getContext().getModifiableTypeOf("Material4DropDownByKey");
//Set valid values for this data type
IModifiableSimpleValueSet values=myType.getSVServices().getModifiableSimpleValueSet();
values.put("AA11","Hammer");
(...)
wdContext.currentContextElement().setMaterial4DropDownByKey("AA11");</i>
Then map to your IUElement.
regards
Hi Ravi,
If you want store lot of information releated to material number then you can create more attributes to particular node. When ever you select a particular material number you will get releated information.
Like consider all properties are String.
Step 1;
Create one static node name is 'NodeA'
IWDNodeInfo multiplenode = multipleinfo.addChild("MultiNode" , null, true, false, true, true, false, true, null, null, null);
multiplenode.addAttribute("material no", "ddic:com.sap.dictionary.string");
multiplenode.addAttribute("material name", "ddic:com.sap.dictionary.string");
multiplenode.addAttribute("material price", "ddic:com.sap.dictionary.string");
multiplenode.addAttribute("material stock", "ddic:com.sap.dictionary.string");
Step 2:
Assign values for Dropdown
IWDNode node1 = wdContext.nodeNodeA().getChildNode("MultiNode", IWDNode.NO_SELECTION);
IWDNodeElement elem1;
for(int s=0;s<5;s++){
elem1 = node1.createElement();
elem1.setAttributeValue("materialno","no"+s);
elem1.setAttributeValue("materialname","name"+s);
elem1.setAttributeValue("materialprice","price"+s);
elem1.setAttributeValue("materialstock","stock"+s);
node1.addElement(elem1);
}
Step 3:
Inside Domodifyview create IWDDropDownByIndex UI Element and Bind it.
IWDDropDownByIndex dropDownList = (IWDDropDownByIndex)view.createElement(IWDDropDownByIndex.class, "drop");
IWDAttributeInfo info = wdContext.getNodeInfo().getChild("NodeA").getChild("MultiNode").getAttribute("roles");
dropDownList.bindTexts(info);
dropDownList.setWidth("100");
Finally add this Dropdown into container. Like this you can create more Dropdown and add action to the dropdown as dynamically.
Kind Regards,
S.Saravanan.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Ravi,
First you have to load the number into dropdown by,
Load the values using Resultset and Statement,
Consider Resultset rs, and statement st,
IPrivate<View>.I<Context>Node mnode=wdContext.node<Context>();
mnode.invalidate();
while(rs.next()){
IPrivate<View> melement=wdContext.create<Node>Element();
melement.set<parameter>(rs.getInt("field in database"));
mnode.addElement(melement1);
}
then select the current dropdownelement and using that Query the database and store it in Resultset.
And display the format you want.
Regards,
Saravanan K
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I suggest reading the book "Inside Web Dynpro for Java" by Chris Whealy (assuming you are using WD Java).
Armin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
94 | |
11 | |
11 | |
10 | |
9 | |
8 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.