cancel
Showing results for 
Search instead for 
Did you mean: 

Error message not displayed - Downloading files in a table

Former Member
0 Kudos

Hi!!!

I'm following the guide to download files onDemand in a table, you can find that guide at:

https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/b0e10426-77ca-2910-7eb5-d7d8982c...

If found a problem with the guide: What would happen if there's an error while downloading or somenthing else? There the author doesn't explain how to show an error in the view.

What I'd like to do is to show a error message in the view where the table is.

I tried to add some code, but it doesn't finally show the error message.

I have a method that generates the file and returns the path of the file in the context, so I can read it. It return boolean (true if the file was generated, false on the contray). That method is called executeZgav_Sf_Formulario_Sv_Input(nroEmpleado, nroViaje, morei, datosEspejo); and is working fine.

I also have a static class that reads a file and returns the byte[] called: ManejoArchivos.getByteArrayFromResourcePath(wdContext.currentOutput_FormularioSVElement().getP_Path(), true);

But if for example, the parameters are incorrect and the file cannot be generated, the method is supposed to show an error but is not displayed on the screen.

I have some code after that which validates if the file could be read or not and returns the bytes of a prewritten PDF file with an error message.

-


Added code:

byte[] r = null;

boolean continuar =

this.executeZgav_Sf_Formulario_Sv_Input(nroEmpleado, nroViaje, morei, datosEspejo);

if (continuar)

try {

r =

ManejoArchivos.getByteArrayFromResourcePath(

wdContext.currentOutput_FormularioSVElement().getP_Path(),

true);

} catch (FileNotFoundException e) {

wdComponentAPI.getMessageManager().reportMessage(

IMessageData.ARCHIVO_NO_ENCONTRADO,

null,

true);

} catch (IOException e) {

wdComponentAPI.getMessageManager().reportMessage(IMessageData.PROBLEMA_IO, null, true);

}

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

I tried so, but it still doesn't work!!

Does it have somenthing to do with the version?? I'm using NW04s Stack 06.

Former Member
0 Kudos

Now i ahve almost the newest stack, but it still doesn't work... what can i do?? i don't want the application trying to open a file with errors!

Former Member
0 Kudos

Hi,

While Catching the FileNotFound Exception, try printing the message directly instead of using the Message designed in Message Pool. You can so this by:

wdComponentAPI.getMessageManager().reportException("Your Message", false);

OR

wdComponentAPI.getMessageManager().reportWarning("Your Message");

Regards,

Alka.

Former Member
0 Kudos

Thanks for the reply.

No, it didn't work! I think the messages are being displayed by the window that opens when the file is downloaded.

Is there a way to do something like a flush of data, but with the messages. I mean, show all the messages and continue with the work?

Former Member
0 Kudos

Hi,

As I understand,

A window open ups when File Download action is fired, and the error messages

should be shown in this window.

If so, then in the View that is rendered in the pop-up window, you can place a Message Area UI Element, in the visible part of view. Message Area is used to

dispaly all error messages (both from message pool and direct one's) in a fixed

area on the View.

Regards,

Alka.

Former Member
0 Kudos

I cannot place a message area on the window that's been opened because it opens automatically without any design... it is just a pdf file which opens from the download file ui element.

former_member751941
Active Contributor
0 Kudos

Hi Alejandro,

Try This.

try

{

......

}

catch (FileNotFoundException e) {

wdComponentAPI.getMessageManager().reportException("Given FileNotFoundException : "+e.getMessage(),true);

}

catch (IOException ex) {

wdComponentAPI.getMessageManager().reportException("Given IOException : "+ex.getMessage(),true);

}

Regards,

Mithu