cancel
Showing results for 
Search instead for 
Did you mean: 

Using the Check Boxes in Tables

Former Member
0 Kudos

Hi

Is there any solution to the following condition:

A)There is table in R/3 server which has two columns:

first mentioning the list of items and the second column consisting of check boxes. Depending upon they were checked or not by the previous user, on calling the table, it will display the list of items and their present unchecked status.

B)After obtaining the status user can check or uncheck the check boxes.

My question:

A) Is how i'm gonna display the first scenario which i have to display the items in first column and second column present status of check boxes.

B)how to send the updated status of check boxes back to table.

Thanks in advance

Srikant

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Venkat,

After importing the RFM and mapping with the component.

Create a value node name CheckNode having three attribute Type(type String) Check1(Type Boolean) Check2(Type Boolean)

Create a method in your component say executeRFM

Now in that write this code


Z<your RFM name>_Input input = new Z<your RFM name>_Input();

wdContext.node<your RFM name>_Input().bind(input);
try
{
wdContext.current<your RFM name>_InputElement().modelObject().execute();
		wdContext.node<your RFM name>.invalidate();
}
catch (WDDynamicRFCExecuteException e)
{
wdComponentAPI.getMessageManager().reportException(e.toString(),true);
}  
	   
for(int i = 0; i<wdContext.node<your RFM name>_Input().nodeOutput().node<internal table name>().size(); i++)
{
	I<component name>.ICheckNodeElement checkElement = wdContext.createCheckNodeElement();
    	wdContext.nodeCheckNode().addElement(checkElement);     
    	checkElement.setType(wdContext.node<your RFM name>_Input().nodeOutput().node<internal table name>().get<internal table name>ElementAt(i).getType());

       if(wdContext.node<your RFM name>_Input().nodeOutput().node<internal table name>().get<internal table name>ElementAt(i).getValue()==0)
{
  checkElement.setCheck1(false);
  checkElement.setCheck2(false);
}
       else if(according to ur condition for value 1,2 and 3)
}

Now got to your view.java. Do mapping between component and view. Create a table. Select create binding in menu of table and select your valueNode.

In the wdDoInit() call this method


wdThis.wdGet<your component name>Controller().ExecuteRFM()

This will do.

Regards,

Jaydeep

Former Member
0 Kudos

Hi Jaydeep,

<b>I<component name>.ICheckNodeElement checkElement = wdContext.createCheckNodeElement();</b>

wdContext.nodeCheckNode().addElement(checkElement);

checkElement.setType(wdContext.node<your RFM name>_Input().nodeOutput().node<internal table name>().get<internal table name>ElementAt(i).<b>getType());</b>

I was not able to get the getType method while typing the code.

if(wdContext.node<your RFM name>_Input().nodeOutput().node<internal table name>().get<internal table name>ElementAt(i).<b>getValue()==0</b>)

Also here i didnt get the getValue method.Instead i am gettin the getAttributeValue().

Thanks

Answers (8)

Answers (8)

Former Member
0 Kudos

Hi Venkat,

Please write the cod you have written in the wdDoInit of the component. I told you to create a method in the component using the methods tab. Have you done that. And in the view where you are displaying the table you should call this method in wdDoInit().

Regards,

Jaydeep

Former Member
0 Kudos

Hi Venkat,

Value(check box value) and Type(list of items) are the columns of your internal table in the R/3. See the internal table structure coulumns and accordingly choose the correct get method for type and value of your .

Regards,

Jaydeep

Former Member
0 Kudos

Hi Jaydeep

well thanks for the code u provided but i'm getting following error.

<i>java.lang.IndexOutOfBoundsException: Index: 0

at java.util.Collections$EmptyList.get(Collections.java:2147)

at com.sap.tc.webdynpro.progmodel.context.Node$ElementList.getElement(Node.java:2087)

at com.sap.tc.webdynpro.progmodel.context.Node.getElementAtInternal(Node.java:671)

at com.sap.tc.webdynpro.progmodel.context.Node.getElementAt(Node.java:678)

at com.sap.table.comp.wdp.IPublicTable1Component$ILi_SubscriptNode.getLi_SubscriptElementAt(IPublicTable1Component.java:661)

at com.sap.table.comp.Table1Component.wdDoInit(Table1Component.java:111)

at com.sap.table.comp.wdp.InternalTable1Component.wdDoInit(InternalTable1Component.java:162)

at com.sap.tc.webdynpro.progmodel.generation.DelegatingComponent.doInit(DelegatingComponent.java:95)

at com.sap.tc.webdynpro.progmodel.controller.Controller.initController(Controller.java:215)

at com.sap.tc.webdynpro.progmodel.controller.Controller.init(Controller.java:200)

at com.sap.tc.webdynpro.clientserver.cal.ClientComponent.init(ClientComponent.java:346)

at com.sap.tc.webdynpro.clientserver.cal.ClientApplication.init(ClientApplication.java:352)

at com.sap.tc.webdynpro.clientserver.task.WebDynproMainTask.execute(WebDynproMainTask.java:593)

at com.sap.tc.webdynpro.clientserver.cal.AbstractClient.executeTasks(AbstractClient.java:59)

at com.sap.tc.webdynpro.clientserver.cal.ClientManager.doProcessing(ClientManager.java:249)

at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doWebDynproProcessing(DispatcherServlet.java:154)

at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doContent(DispatcherServlet.java:116)

at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doGet(DispatcherServlet</i>

where i'm going wrong??

Thanks

Srikant

Former Member
0 Kudos

Hi Venkat,

Please clarify the following:

<b>I have 3 cols and several rows,1st col contains Types and the oher 2 contain the chk boxes corresponding to the specific type.</b>

What is other check box column for?

Here the value corresponds to the chk boxes & can have <b>values 0-3 depending on no. of boxes checked</b> for each type.Thus, each row will have a different return variable( which maybe 0,1,2 or 3)

But you have only two checkboxes for each type right; then how it will have value of 3.

Please clarify.

Regards,

Jaydeep

Former Member
0 Kudos

Hi Jaydeep,

1.There are 2 chk boxes as there are 2 modes of subscription for each type(product). So each row(corresponding to a particular product type) will have 2 chk boxes.

2.Now for a particular type of product, the user may not select any of the boxes,check either of the boxes or both. So when he does any 1 of these a corresponding return value of 0,1,2 or 3 is obtained.

Thanks

Former Member
0 Kudos

Hi,

Currently checkbox will take boolean values only.

May be you can write some code to convert 0/1s to true/false before populating the table !!

But i suggest to modify the FM so that it will return boolean values .

Regards, Anilkumar

Former Member
0 Kudos

Hi Venkat,

Create a value node with two attributes string and boolean. Now create a table and in the binding give this node. Now depending on the value received from model node set the values accordingly in the table through value node.

Try this approach.

Regards,

Jaydeep

Former Member
0 Kudos

Hi Jaydeep,

I cannot change the RFM as Anil had suggested.

I think the Value node might be worth a shot but am unable to get the exact method of going about this. Could you please ellaborate.

  • I have 3 cols and several rows,1st col contains Types and the oher 2 contain the chk boxes corresponding to the specific type.

  • Now in the RFM i have 2 return variables -type & value. Here the value corresponds to the chk boxes & can have values 0-3 depending on no. of boxes checked for each type.Thus, each row will have a different return variable( which maybe 0,1,2 or 3)

Now if i were to create value nodes/attributes as you suggested, how do i go about doing it. I am confused!

thanks

Former Member
0 Kudos

Hi,

I think the BAPI should return boolean value "true/false" to check /uncheck the checkboxes in webdynpro !!!

Regards, Anilkumar

Former Member
0 Kudos

Hi Anil,

Let me be more clear with problem:

I have Bapi with Two columns:

1. Stating the event 2. Value of the event(0,1) being the only values allowed).

I want to retrieve these values and want to display a table with 2 columns:

1. stating the event 2. a check box.

now check box according the value of the event gonna show the checkboxes as checked/unchecked.

I know the checkboxes can have boolean values only. Here instead of those values as (0,1) i want them to get displayed as checkboxes. How to I do that?

Thanks in advance

Srikant

Former Member
0 Kudos

Hi,

If its a table in R/3 side you have to write a remote enabled FM which takes care of all this selections <i>(and u cant call a table directly !)</i> and has the table structure as input and output parameter.

All depends on how you write the RFC.

regards

Bharathwaj

Former Member
0 Kudos

Hi Srikant,

Just bind the modelnode containg the two attributes to a table.

When you bind the table you can see the checkboxes for the "selected" proprty and Inputfield for listofItems.

Regards, Anilkumar

Former Member
0 Kudos

Hi Anilkumar,

After binding i will get the checkboxes in the table. But my question is:

In case i have a value returned through a BAPI which maybe 0/1, depending on this value i need the checkbox to be checked/unchecked after final deployment.

How do i achieve this? Is there some code i would have to insert stating that when value is 0/1 do something? If yes, what exactly is the code?

thank you