cancel
Showing results for 
Search instead for 
Did you mean: 

processing single row selection tables

Former Member
0 Kudos

Hi,

I have a search screen which displays master data from a RFC web service after the user enters some search criteria.

After the master data is displayed,I need to get the detail data of the record(table row) selected by the user.

My question is :how to get the data that is currently selected in the table?If my master table contains columns col1,col2,col3,how to get the corresponding values of these fields so that they can be passed to another RFC to get the details data.

thanx in advance,

Bhupesh

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Bhupesh,

1. For the table that you are displaying the output, change the selection property of the table to none.

2. In the table insert a new column.

3. Right click the new column and select the insert table celleditor and choose check box.

4. Assign a value attribute of type boolean to the column that was added.

For getting the data of the seected row. Give the following code in the implementation.

if(wdContext.<node ele>().get<checkbox att>())

{

wdContext.<node ele>().get<att name that u want>()

}

By the above code structure u can select the row element that u want.

For getting the master table corresponding elements u can just execute the rfc and get the particular element as given for row selection.

Hope it helps,

Regards,

Nagarajan.

Former Member
0 Kudos

Thanx Vijaya and Nagarajan.Those were certainly helpful.

regds,

Bhupesh

Former Member
0 Kudos

I can't figure out where to pass the values to the RFC fetching the details record.Any help would be welcome.

The situation is like this:

a)I have a search screen which has input boxes(bound to the input parameters of the RFC(say RFC1).

b)When the user presses the 'search button',RFC1 fetches master data and diaplays it in a table.

So far it is working fine.

Now depending on the row selected,I need to call(RFC2) to get the detail data.RFC has import params.

The problem is:

While I can get the data out of the current selected row of the table,where do i write the stuff to pass these vales to the RFC2?Unlike the search screen,I cannot bind the table rows to the model represeting RFC2.

Please help.

thanx,

Bhupesh

Former Member
0 Kudos

Bhupesh,

If you want the RFC2 to be executed on selection of a row in the table, then declare a new action and associate it to the "onLeadSelect" event of the Table and write the suitable code to get the details from RFC2.

Bala

vijayakhanna_raman
Active Contributor
0 Kudos

Hi bupesh,

Get the values of the populated table by the on action lead select and follow the steps below.

Steps:

1. First create an instance for bapi and bind the instance to the bapi node.

Z<bapi name> zb=new Z<bapi name>();

wdContext.nodeZ<bapi name>. bind(zb);

2. Then if u have the import parameter u have to set them by using

The instance of the above bapi.

Zb.set<import parameters>;

3. If the bapi has a import table parameters then the structure for the table parameters will also be imported

In the model class.

4. Set the table parameters by creating the instance for that structure and using this instance set it.

Z<Struct>itm tab=new Z<Struct>();

Tab.set<table parameters>

5. Then add the structure instance to the bapi instance.

Zb.add(Tab);

6. Then Execute the bapi after setting the import parameters.

7. If there is any export parameters, then get the values after execution.

Regards,

Vijay

Former Member
0 Kudos

I managed to do it like this:

In the event handler for the event onLeadSelect,I call the executeRFC2 method of the controller.Before that I pass the values to the RFC2 by using these lines:

String str = wdContext.current<Node>Element().getXXX();

wdThis.wdGet<MyComponent>Controller().wdGetContext().current<Node>Element().setXXXX(str);
wdThis.wdGet<MyComponent>Controller().executeRFC2().

Not sure if this is the currect way.It works alright though.Let me know if there is any alternative way.

Thanx for your answers.

Bhupesh

vijayakhanna_raman
Active Contributor
0 Kudos

Hi Bupesh,

What u have done is correct u need not write the execute code in the controller only. U can write in the on action lead select also.

Set the paramaters by creating the instance of Bapi and then

instance.set<>;

Regards,

Vijay

Former Member
0 Kudos

Hi Vijay,

Correct me if I am wrong:

If I write the execute rfc method on the action lead select and NOT in the component controller,that would mean a violation of the MVC design pattern as I would be calling the model(the RFC) directly from the view controller.

regds,

Bhupesh

vijayakhanna_raman
Active Contributor
0 Kudos

Hi Bupesh,

Yes u will be violating it, but the thing why we are writing in component controller is any view can call the execute method if it is in controller .

If this is not ur case then u can write it in the view itself.

Regards,

Vijay

vijayakhanna_raman
Active Contributor
0 Kudos

Hi,

write the code in ur onAction LeadSelect of ur table,

wdContext.current<Nodename>Element.get<ColumnAttribute>();

Regards,

Vijayakhanna Raman