cancel
Showing results for 
Search instead for 
Did you mean: 

Writing WdDoModifyView and File Download Code from Java to ABAP

Amey-Mogare
Contributor
0 Kudos

Hi,

I am re-writing a WD JAVA application into WD ABAP application.

In WD java application I have a button as a table cell editor and on click of it, I get reference of selected element in action handler method.

I have written this code for this:-


public static void wdDoModifyView(IPrivatePKmView wdThis, IPrivatePKmView.IContextNode wdContext, com.sap.tc.webdynpro.progmodel.api.IWDView view, boolean firstTime)
  {
    //@@begin wdDoModifyView

	if(firstTime){
		IWDButton l_btnDownload = (IWDButton) view.getElement("btn_DownloadTableCell");
		l_btnDownload.mappingOfOnAction().addSourceMapping("nodeElement", "p_kmFolderEle");
	}
    //@@end

And this how the action handler looks like:-


  public void onActionaDownloadTableCell(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent, com.sap.tc.webdynpro.progmodel.api.IWDNodeElement p_kmFolderEle )
  {
    //@@begin onActionaDownloadTableCell(ServerEvent)
    IPrivatePKmView.ICtx_vn_KmFolderDataElement l_kmFolderDataEle = (IPrivatePKmView.ICtx_vn_KmFolderDataElement)p_kmFolderEle;
    wdThis.wdGetPLdaCompController().mTableCellDownload(l_kmFolderDataEle.getLinkName(), l_kmFolderDataEle.getLinkValue());
    //@@end
  }

How do I achieve this in WD ABAP?

Thanks and regards,

Amey

Accepted Solutions (1)

Accepted Solutions (1)

ChrisPaine
Active Contributor
0 Kudos

In pretty much the same way!

create a button in your table

assign an action to it - when you create the action - ensure you tick the "pass UI parameters" checkbox.

the action is created with a parameter "CONTEXT_ELEMENT".

this has a reference to the context element of the table row in which you button was pressed. Use this to get the attributes of the element. (the code wizard can help you with some lovely unwieldy code to do just this.)

of course us mere mortal who don't ahve the joy of NW7 EhP2 can't get away with the method contatenation that Java offers - so you'll probably have to define a large handful of helper variables.

But in the end it is very similar!

You'll find even the bad bits of WD Java made it over into WD ABAP - like two different ways of handling trees (one for tree control, one for hierarchical table). So you should get too lost!

Cheers,

Chris

Amey-Mogare
Contributor
0 Kudos

Hi Chris,

Thank you pretty much descriptive reply.

I am not able to see any check-box "pass UI parameters" anywhere when I am creating action.

I can only see input field for action name, description and drop-down for outbound plug.

Also, do I have to write any code for this in wdDoModifyView method?

If yes, what is the ABAP code for it?

With regards,

Amey

ChrisPaine
Active Contributor
0 Kudos

Hi,

no need for additional code to link the parameters to the event - this is actually an improvement from WD Java (there all you doubters - note I actually said it...

If you're not seeing the checkbox - I'm pretty sure it should be there - but nevermind - go to the actions tab of the view.

there is a little square box on one of the buttons on the tool bar

Tooltip - "Parameter from UI Event".

select your event from the list and click this button - it should then allow you to select the various possible parameters that can be linked to the event - that's nicer that the Java method! the parameter will automatically be added to the action handler method.

Cheers,

Chris

Former Member
0 Kudos

Hi Chris,

Thanks for the explanation. Yes it's (Parameter from UI Event) there. Thanks for your nice explanation.

Amey-Mogare
Contributor
0 Kudos

Thank you Chris!

Answers (0)