on 11-27-2006 8:33 AM
Hi all
I've a scenario. I want to display a table in a view. But the no of columns in that table depends on the number of columns in the corresponding database table. I'm fetching data from an R/3 system.
Can i use a static table for this by controlling the visibility of the columns or do i have to use dynamic table. If dynamic how i'll do that? How i'll get the no of columns?
Hi
Christophe Benoit
I'm fetching data from a table with fixed no of columns. But the thing there is a chance that it's number of columns may increase. I've to consider that also. I cannot say how many columns will be added later. This is my problem
Hi Monalisa Biswal
Thank u very much for your help. My problem is half-solved.
Hi Dipankar Saha
I found your reply very helpful. I haven't tried dynamic content creation before. You provided all the helpful links.
OfCourse I'll give u points! Hoping that you'll be answering all my questions.
I think I'm the first one to do so.(Treat is required )
Hi Monalisa Biswal
I'm not using a structure binding for the value node.
In this case how i'll get the no of fields in the node as well as the fieldnames?
Thanks & Regards
Aparnna
Message was edited by:
aparnna prasad
Hi Aparnna,
You can use dynamic context binding to achive this. You can add the table control to the view at design time, but bind the context at run-time. See the following articles for more details:
1) Dynamic Programming in Java Webdynpro :
2) Table handing in Webdynpro :
/people/harsh.chawla/blog/2005/03/08/table-handling-in-webdynpro
3) Dynamic Table
4) Dynamic table Creation
Also if yoy are fetching data from a R/3 system you can use the Adaptive RFC model in Java webdynpro, which will automatically define the model structure and from whcih you can specify the table columns at design-time as well.
Thanks & Regards,
Dipankar
[P.S. Award points if you feel this is helpful]
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank u Abhilash for your help
I got my problem solved
Regards
Aparnna
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Monalisa Biswal
I'm not using a structure binding for the value node.
In this case how i'll get the no of fields in the node as well as the fieldnames?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Aparna,
In order to get all the attributes in a node, use the following code:
IWDNodeInfo nodeInfo = wdContext.node<Nanme>().getNodeInfo();
java.util.Iterator iterator = nodeInfo.iterateAttributes() ;
while(iterator.hasNext())
{
IWDAttributeInfo attribInfo = (IWDAttributeInfo)iterator.next();
if(attribInfo != null)
{
String name = attribInfo.getName();
//do whatever u want...
}
}
See the API for more details..
<a href="https://media.sdn.sap.com/javadocs/NW04/SPS15/wd/com/sap/tc/webdynpro/progmodel/api/IWDAttributeInfo.html">IWDAttributeInfo</a>
Regards
Abhilash
Hi Aparnna,
My thoughts:
If you are fetching data from one table with a fixed number of columns and you want to hide empty columns. Use a static table.
If you are fetching data from different tables with all different columns. Use a dynamic table.
Regards,
Christophe
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Archana,
If your BAPI is returing a table parameter you can fetch attribute list dynamically using the following method:
IWDNodeInfo nodeInfo = wdContext.nodeName().getNodeInfo();
IStructure structure = nodeInfo.getStructureType();
int NoOfFlds =structure.getNumberOfFields();
for (int count = 0; count < NoOfFlds; count++) {
IField field =structure.getField(count);
if (field != null)
{
String fieldName = field.getName();
}
}
Hope it helps!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.