cancel
Showing results for 
Search instead for 
Did you mean: 

adding seperate column in table

Former Member
0 Kudos

Hi,

How can add another column to table in run time which is already binded to BAPI data model node.

I would like to show month names in the first column of the table.i need to iterate through the table rows.

Thanks,

Damodhar.

Accepted Solutions (0)

Answers (10)

Answers (10)

Former Member
0 Kudos

Armin:

I have created a node inside data source node and set the singleton property to false as you specified, and seeting the value in the calculated attributes get method. Only the first rows values is getting repeated for all the rows.

Nidhideep,Aparna:

I have adaptive RFC as model node. And in runtime i have to show a new column which is the combination of the columns returned by the execution of RFC call. As my model is adaptive RFC model I am unable to create a value attribute in the model node, is there any other alternate way?

Former Member
0 Kudos

Hi Damodhar,

As Nidhideep suggested u can create a value attribute in model node itself. But this u cann't create from the context of ur component

1. Open the Datamodeller of ur component.

2. After mapping nodes from model to controller. In controller right click on the node and create new attribute.

3. And then map controller to view.

Now, in view u can directly bind ur model node with month value attribute to the table.

Based on ur condition set the month for that element of ur node:

eg code:

for(int i = 0; i<nodeBapiNode().size(); i++){

if(<condition>)

wdContext.nodeBapiNode().getBapiNodeElementAt(i).setMonth(<value>);

}

Former Member
0 Kudos

hi

You can create an value attribute in the model node.Create this value attribute in the component controller , while mapping or else it give error.Then map this model node to the view .Like this you get an attribute and hence a column in your table.

Regards

Nidhideep

Former Member
0 Kudos

Hi Damodhar, Maksim, Rashchynski:

I too have same/similar requirement.

The bapi returns Annual Rate, Hourly Rate etc columns, I have to add a new column where in I have to display Annual Rate and Hourly Rate in one column rather than two i.e. I have to display it some thing like this "Annual / Hourly Rate".

I have followed the steps suggested above and created a new column AnnulaHourlyRate and have set the calculated attribute to true and in the get method of calculated attribute, I am setting the value, I think I am making some mistake, the same value is getting set for all the rows. Please let me know how I can fix this problem.

Thank you

Regards

Yugandhar Reddy

Former Member
0 Kudos

The additional columns must be in a node that is

- singleton=false

- inside table data source node

Armin

Former Member
0 Kudos

Hi Armin,

I got it, i set readonly property to false.

i have one outof box question, can we include vacant rows in table between the data filled cloumns.

I want to seperate rows depends on the data type by vacant row.

Thanks,

Damodhar.

Former Member
0 Kudos

You do not need to set readOnly=false if you use the attribute only for display purpose. The method return value is the calculated attribute's value, no need to call any set-method.

Empty rows are not supported. Yes, you could insert empty node elements but these would show the initial value for each attribute which most probably is not what you want to achieve.

The NW04s table offers much more functionality in this regard.

Armin

Former Member
0 Kudos

HI Armin,

I did the same you suggested me, i am returning new value in getMonth(),but iam getting the following error.

com.sap.tc.webdynpro.services.exceptions.WDRuntimeException: attribute Month is read only

if we set the attribute property readonly to true, how can i set(return) the new value.

Thanks,

Damodhar.

Former Member
0 Kudos

Hi,

I did that, somehow i am not iterating throught the context node.

i did the same and binded the text property to MonthNode.MonthAttribute.

what would be the cardinality and selection, i took 1..1,1..1, false for MonthNode.

In the implementation i am iterating throught the node, but the last value december applying for all the rows.

i know i am making simple mistake but i couldn't able to find.

Thanks,

Damodhar.

Former Member
0 Kudos

Let "Rows" be the context node used as the table's data source.

Add under "Rows" a subnode "AdditionalColumns", cardinality=1:1, selection=1:1, singleton=false, with attribute "Month", type=string, readOnly=true, calculated=true.

Bind the table cell editor of the month column to attribute "AdditionalColumns.Month".

In the method "getMonth(IWDNodeElement element)" that is created for the calculated attribute, take the original value from "element" and return the formatted value. No need to loop over the node.

Armin

Former Member
0 Kudos

hi,

i am displaying the BAPI data in the table and one field has char length of 6, and returns like 200501,200502.

I want change that field to month name by checking last two chars.

I am overwriting the context element with month names but it is displaying first six chars because ABAP type is of char of length 6.

So i would like create a cloumn at design time and assign month names at run time.

i hope it gives some idea.

Thanks,

Damodhar.

Former Member
0 Kudos

Maksim already told what to do in the view context.

I suppose you have created the Table using the binding wizard.

To add an additional column, select the Table in the Outline view, open the context menu and select "Add Column" .

Now select the column, open the context menu and select "Set TableCellEditor". For display-only columns you may choose a TextView or a read-only InputField.

Bind the TextView.text property to the calculated context attribute.

Implement the get-method for the calculated attribute such that it returns the month name for the node element passed as parameter.

That's it.

Armin

former_member182372
Active Contributor
0 Kudos

Hi Damodhar,

Create node under datasource node (cardinality 1..1, selection 1..1, sigleton=false) (Attributes). Add new attribute: monthName (calculated). Implement calculation logic. In root of context create monthCoulumnVisibility attribute with type WDVisibility. Make it calculated or set the value in action handler. Create table column, bind visibility property to visibility property of column and bind monthName with appropriate property of celleditor.

Best regards, Maksim Rashchynski.

former_member182372
Active Contributor
0 Kudos

Hi Damodhar,

Why do you need to do this dynamically?

Best regards, Maksim Rashchynski.