cancel
Showing results for 
Search instead for 
Did you mean: 

Performing multiple updates through a grid

Former Member
0 Kudos

I'm pretty green as far as Dynpro goes so please forgive me if this is an easy one.

Basically I have a table (grid) which allows a user to view and edit pricing information.

The data is retrieved and updated through .NET web services.

The pricing values are edited through an InputField contained in one of the columns of the grid. This InputField is, in turn, bound to a property in the response from the web service in my view context.

Lets say a user edits one price, hits the down arrow on the keyboard and edits another field and then hits Enter.

Somehow, I need to identify in my "OnEnter" event handler, exactly which rows were edited so I can then pass the pertainent data to the web service for processing.

I don't think I can use the typical "getLeadSelected" and "isMultiSelected" scenario that you would for deleting a row.

I really don't want to have to create a separate view for editing individual grid lines one at a time and relegate the grid to being a simple read only selection control.

Any suggestions?

-Sheldon

Accepted Solutions (1)

Accepted Solutions (1)

srinivasa_raghavachar
Participant
0 Kudos

Hi Sheldon,

If you are using ABAP webdynpro, you could use ALV and the event ON DATA CHANGE automatically gives changed rows.

If you have to use tables, I guess there is no such event available for table. Instead you could use context events.

In ABAP webdynpro, interface IF_WD_CONTEXT provides methods ENABLE_CONTEXT_CHANGE_LOG( ) and GET_CONTEXT_CHANGE_LOG( and_reset ) provide similar functionality.

Regards,

Srini.

Former Member
0 Kudos

Thanks Srini,

I'll play around with the context events today. I am hoping I can iterate through the nodes and use the .isChanged() property to detect any changes.

FYI, I am using Dynpro for Java.

Answers (1)

Answers (1)

Former Member
0 Kudos

Ended up solving this one today. Wasn't too bad once I got a good handle on tranversing the Context and using the .isChangedByClient() property. (Like I said, I'm pretty new to Dynpro)

For completeness I am including my solution with this post. (sorry for the exceedingly long names)

______________________________________

public void onActionUpdatePricing(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )

{

//@@begin onActionUpdatePricing(ServerEvent)

//Find out how many records we have

int n = wdContext.nodeRequest_EmployeeSalesServicesSoap_getAllProductPrices().nodeProductPrice_Response().nodeProductPrice_Result().size();

// create an instance of the update web service class

Request_EmployeeSalesServicesSoap_updatePrice reqUpdPrice = new Request_EmployeeSalesServicesSoap_updatePrice();

wdContext.nodeRequest_EmployeeSalesServicesSoap_updatePrice().bind(reqUpdPrice);

//temporary storage for a single element as we iterate through them

IWDNodeElement PriceElement;

for (int i = 0; i <= n - 1; i++)

{

//Get an element

PriceElement = wdContext.nodeRequest_EmployeeSalesServicesSoap_getAllProductPrices().nodeProductPrice_Response().nodeProductPrice_Result().getElementAt(i);

//Check to see if it has been modified

if (PriceElement.isChangedByClient())

{

//If it has been modified then call the update function in the component controller. This

// method will, in turn, call the web service class with the appropriate parameters

//

// TO DO: error checking for update failure.

wdThis.wdGetMainmenuController().UpdatePrice(Integer.parseInt(PriceElement.getAttributeAsText("priceID")),Float.parseFloat(PriceElement.getAttributeAsText("productSellingPrice")));

}

}

//After we are done updating, reset the Context changed bit for all items

wdContext.getContext().resetChangedByClient();

//@@end

}