cancel
Showing results for 
Search instead for 
Did you mean: 

Count files and clean a table?

Former Member
0 Kudos

Hi, i have in a View a table that it´s refill with a table of sap when i press search... Now i want that if i press search and there aren´t rows... appear an popup: "There aren´t element" and... when i press other button (clean) the table clean it...

In short i want know count the rows in the table and clean the table...

Anybody can help me?

Thanks,

Accepted Solutions (1)

Accepted Solutions (1)

former_member185029
Active Contributor
0 Kudos

1. appear an popup: Use IWDWindow object

2. press other button (clean) the table clean it... : Call invalidate method of the node which is bound with the table,

3. want know count the rows in the table and clean the table: Use size function of the node element bound to the table.

Ashu

Former Member
0 Kudos

How use IWDWindow???

Former Member
0 Kudos

Hi,

IWDWindow window = createModelWindow(<WindowName>, "title" ,400, 200);

if(window != null)

{

//Store the window handle in context for later use.

wdContext.currentContextElement().setWindowHandle(window);

window.show();

}

Regards

Ayyapparaj.

Former Member
0 Kudos

Error, don´t find createModelWindow...

I import:

import com.sap.tc.webdynpro.services.session.api.IWDWindow;

Message was edited by:

Victor Capi

Former Member
0 Kudos

Use this code:

IWDWindow window = wdComponentAPI.getWindowManager().createModalWindow(..parameters..)

Former Member
0 Kudos

hi,

Sorry I missed the function

private IWDWindow createModelWindow(String windowName, String title, int width, int height)

{

IWDWindowManager windowManager = wdThis.wdGetAPI().getComponent().getWindowManager();

IWDWindowInfo modelWindowInfo = wdThis.wdGetAPI().getComponent().getComponentInfo().findInWindows(windowName);

IWDWindow modelWindow = windowManager.createModalWindow(modelWindowInfo);

if(modelWindow != null)

{

modelWindow.setTitle(title);

modelWindow.setWindowSize(width, height);

modelWindow.setWindowPosition(WDWindowPos.CENTER);

}

return modelWindow;

}

Regards

Ayyapparaj

former_member185029
Active Contributor
0 Kudos

I think <a href="http://help.sap.com/saphelp_nw70/helpdata/en/b0/184540631d6f13e10000000a1550b0/frameset.htm">this</a> link might help you.

Ashu

Message was edited by:

Ashutosh Moharir

Former Member
0 Kudos

Hi Ayyapparaj KV, i write this:

IWDWindow window = createModelWindow("aviso", "title" ,400, 200);

if(window != null)

{

window.show();

}

private IWDWindow createModelWindow(String windowName, String title, int width, int height)

{

IWDWindowManager windowManager = wdThis.wdGetAPI().getComponent().getWindowManager();

IWDWindowInfo modelWindowInfo = wdThis.wdGetAPI().getComponent().getComponentInfo().findInWindows(windowName);

IWDWindow modelWindow = windowManager.createModalWindow(modelWindowInfo);

if(modelWindow != null)

{

modelWindow.setTitle(title);

modelWindow.setWindowSize(width, height);

modelWindow.setWindowPosition(WDWindowPos.CENTER);

}

return modelWindow;

}

but when i execute, appear this error:

com.sap.tc.webdynpro.services.exceptions.WDRuntimeException: Parameter windowInfo must not be null.

Thanks,

Former Member
0 Kudos

Hi Ashutosh Moharir, in this link, when i write:

IWDControllerInfo controllerInfo = wdControllerAPI.getViewInfo().getViewController();

appear an error in getViewInfo()...

Thanks,

former_member185029
Active Contributor
0 Kudos

Hi,

I later modified my post.

Please check the latest post above

Ashu

Former Member
0 Kudos

Hi,

Does this window "aviso" exists in the Windows.

Did you create this window?

Regards

ayyapparaj

Former Member
0 Kudos

No, "aviso" don´t exists, what should be it?

Thanks,

former_member751941
Active Contributor
0 Kudos

Hi Victor,

Try this.

int noOfRows = wdContext.node<put the node name here> ().size ();

if (noOfRows == 0)

{

String dialog = "No of Rows in Table:" + noOfRows ;

IWDConfirmationDialog confDialog = wdComponentAPI.getWindowManager().createConfirmationWindow(dialog,wdThis.wdGetAPI().getViewInfo().getViewController().findInEventHandlers("OK"),"OK");

confDialog.setTitle("RollUp Window");

confDialog.setWindowPosition(200,100);

confDialog.setWindowPosition(WDWindowPos.LEFT);

confDialog.show();

}

Regards,

Mithu

Former Member
0 Kudos

Create a window under the window . and add the view as part of the window.

Former Member
0 Kudos

When i write this

int noOfRows = wdContext.node...

Thanks,

former_member751941
Active Contributor
0 Kudos

Hi Victor,

It will be <b>wdContext</b> you r typing <b>wdcontext</b> that’s why option is not coming.

Regards,

Mithu

Former Member
0 Kudos

I write this:

if(wdContext.node().size()==0)

but in wdContext not appear node...

Because it´s in other view... i import:

import com.sap.pruebas.jco.wdp.IPrivateResultView;

How can accede to the node...??

Thanks,

Message was edited by:

Victor Capi

former_member751941
Active Contributor
0 Kudos

Hi Victor,

if(wdContext.nodeOutput().size() ==0)

After weContext give a dot(. ) .Then type node and give control space from keyboard. It will give you the option to choose the node name. Select the output node name whose rows you want to count.

Make sure you are writing the code inside the method that is in view .

If your output node is not in the view.

Then use

int noOfRows =

wdThis.wdGet<put your component name here>Controller ().wdGetContext().nodeOutput().size();

if (noOfRows == 0)

{

…..

}

Or In Diagram view you can do the mapping between the component controller and View also.

Regards,

Mithu

Former Member
0 Kudos

Hi, i write wdcontex and . (dot), i press ctrl + space, and don´t appear nodeoutput...

Can be because the nodeoutput is in other view?? I import the other view too, but continue without appear nodeOutput.

Message was edited by:

Victor Capi

Answers (2)

Answers (2)

Former Member
0 Kudos

I find the solution... I have to map the node...

Former Member
0 Kudos

Hi Victor,

1. For popup when there are no rows in a table:

In NWDS>View>Methods(tab)>ADD>eventHandler-->name it as OK

Write in the action of the search button

IWDConfirmationDialog dialog = wdComponentAPI.getWindowManager().createConfirmationWindow("There are no rows in the table.",wdControllerAPI.getViewInfo().getViewController().findInEventHandlers("OK"),"OK");

dialog.show();

2. For clearing the content of the table write in the action of the Clear button

wdContext.nodeCol1().invalidate();

Regards,

Murtuza

Former Member
0 Kudos

Appear this error when i press the button:

java.lang.NullPointerException

Former Member
0 Kudos

Hi Victor,

In the above code the nodecol1 would be the node binded to your table.

Also send the line that is causing this error.

Regards,

Murtuza

Former Member
0 Kudos

Sorry, i don´t understand you before...

I explain me... I have a button that have this code:

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

{

//@@begin onActionBuscar(ServerEvent)

wdThis.wdGetJCOCustController().ejecutar_Bapi();

//@@end

}

Refill the table with the data...

I wil want that, when execute wdThis.wdGetJCOCustController().ejecutar_Bapi(); count the number of rows, and if it´s zero, appear the popup...

If i create a new eventhandler, i can´t do this... no?

Thanks,

Former Member
0 Kudos

Hi Victor,

Write the code i explained just after this

wdThis.wdGetJCOCustController().ejecutar_Bapi();

Check the node of the output node

if(wdContext.node<outputnode>().size()==0)

{

// open confirmation dialog.

}

Regards,

Murtuza

Former Member
0 Kudos

But i create the eventhandler too??

Former Member
0 Kudos

Victor,

That eventhandler is just for the Ok button on the confirmation dialog which won't perform any task and will return back to the main window once you click on the button.

Regards,

Murtuza