cancel
Showing results for 
Search instead for 
Did you mean: 

How display only necessary rows from the Bapi-Table?

Former Member
0 Kudos

Hello,

I’ve created a Table as Result of BAPI_EMPLOYEE_GETDATA with 5 Colums Firstname, Lastname, Birthday, Birthmonth, Birthyear.

I would like to display only rows with actually Birthmonth.

Can anyone please help me?

Thanks in advance,

Raissa

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi,

I think ur requirement will be acheived if u put that remove element in the else part of the code instead of the IF part.

Otherwise create one more value node.

then

for(int i = 0;i<wdCOntext.node<new node>.size();i++)

{

if(wdContext.node<binded node>.getElementat(i).current<binded node elemtn>.getBirthmonth().equals("")

{

IPrivate<viewname>.I<node element name> elem = wdContext.node<new node>.create<nodeelement name>;

elem.set<attr>();

wdCOntext.node<new node>.bind(elem);

}

}

Regards

Bharathwaj

Former Member
0 Kudos

Hi,

small modofication in Bharathwaj's post.

Instead of using bind method in if statement, use addElement(<element>) method of value node.

So, it allows you to add multiple values.

corrected code is given below.

for(int i = 0;i<wdCOntext.node<new node>.size();i++)

{

if(wdContext.node<binded node>.getElementat(i).current<binded node elemtn>.getBirthmonth().equals("")

{

IPrivate<viewname>.I<node element name> elem = wdContext.node<new node>.create<nodeelement name>;

elem.set<attr>();

wdCOntext.node<new node>.addElement(elem);

}

}

Regards,

Bhavik

Former Member
0 Kudos

Thanks,

but where can i give condition to check birthmonth

Former Member
0 Kudos

if you are using a value node, then give condition while u r assigning rowelements to this node.

Else if you are directly binding the modelnode to the table give the condition after you have called the RFC.

Ex

for(int i=0;i<wdContext.nodeCompanycode_List().size();i++)

{

if(wdContext.nodeCompanycode_List().getCompanycode_ListElementAt(i).getComp_Code().equals("0001"))

{

wdContext.nodeCompanycode_List().removeElement(wdContext.nodeCompanycode_List().getCompanycode_ListElementAt(i));

}

}

Former Member
0 Kudos

Hi Raissa,

If u want to display only birth month u can right click on the container UI element ,select Apply Template -> Table-> select the context attributes u want.

In case if u want a row to be displayed only if it has a birth month ..

then bind the table with a value node and create a element of the value node and set value for it only if

wdContext.nodeData.currentDataElement.getBirthmonth() == <to the value u need>

is satisfied.

Regards

Bharathwaj

Former Member
0 Kudos

When you do create binding for the table, select only those fields that u need to display in the table.

And give condition to check whether birthmonth contains a value or null and display accordingly.

If you are using a value node, then based on the condition (if null) you may display them, and if you use modelnode, then you can remove the elements that contain null values for birthmonth, using "removeElement" method.