cancel
Showing results for 
Search instead for 
Did you mean: 

adding a message to the message pool and displaying it

Former Member
0 Kudos

hi

I am creating an application in web dynpro calling a BAPI from backend.

And I want to display a message when no records are being found in the backend, as "No Records Found" in the initial search page itself,without going to the next screen.Now how can I add this to the message pool and get it displayed in the screen where the search is happening.

I mean where we are calling a BAPI.

Thank and regards

kris

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

closing the thread

Yashpal
Active Contributor
0 Kudos

Hi,

create a method in component controller which execute BAPI and it return boolea value .write code accordingly by checking the model node which contains return data .if it contains then set boolean value .

if ur view have any button fire this method in ur action event handler check the boolean value returned by BAPI executer method . if condition is for no data call

messsage manager

code

wdConponentAPI.getMessageManager.reportWarning("no data found');

else

fire a plug to other view .

Thanks ,

Yashpal

Former Member
0 Kudos

hi Yashpal

Thanks for your response.

I have done the same but I require the message to be picked up from the message pool, that means I have to define the "No Records Found" in the Message pool and the message has to be picked from that pool.

can you please tell me how to proceed.

thanks and regards

kris

Former Member
0 Kudos

hi gopi,

after you call the bapi and the size of the model node is 0 then you can use the following code

i think you have created message pool containing all the messages .if

not you can do it by right clicking the message pool under the

component.

Then follow the code:-

IWDMessageManager <message manager name> =

wdThis.wdGetAPI().getComponent().getMessageManager();

if there are any parameters then specify them as below

Object[] <object name> = {new Integer(variable1),new

Integer(variable2),new String(variable3)};

messman.reportMessage(IMessage<project name>.< key of the message>

,<object name>,true);

This "true" is used when all steps in navigation are to be cancelled on displaying the error message.

regards

Rohit

Former Member
0 Kudos

Hi Gopi,

Follow these steps:

1. Open your message editor by right clicking on the Message Pool for your component.

2. Add a new message and note the key. Select the message type from the options provided.

3. Include the following line in your code,

IWDTextAccessor textAccessor = wdComponentAPI.getTextAccessor();

4. Use this code to access your messages through the key:

String message = textAccessor.getText("your_key");

5. Note that this key is the same key as was mentioned in step 2.

That should do it. Assign points for helpful answers.

Regards,

Satyajit.

Former Member
0 Kudos

hi Satyajit

Thanks for your response.

I have tried this code, anyhow where do I have to implement this code.

I have implemented the same code in the execution of BAPI, is that the right place to implement or somewhere else we have to implement.

Kindly let me know.

thanks

kris

Former Member
0 Kudos

Hi Kris,

You can write the declaration in the "other" part. I mean between the "//@@begin others...//@@end" tags. So basically your code will look like

//@@begin others

IWDTextAccessor textAccessor = wdComponentAPI.getTextAccessor();

...

//@@end

Then after the BAPI executes, you can check if the return structure is empty or not. Based on that, you can make a call to the message pool.

All said and done, whatever you have done is also correct technically, but having a general declaration gives you a broader access to the textAccessor.

Award points if the replies help you.

Regards,

Satyajit.

Former Member
0 Kudos

hi Satyajit

Thanks for your response.

So the code should be something like this.the code is showing some error when I am keeping that in the //@@begin.

can we include the particular code in the execute Bapi method itself.

something like this:

public void executeZ_Vf_CustomerResults( )

{

//@@begin executeZ_Vf_CustomerResults()

try

{

// Calls remote function module Customer OrderList

wdContext.currentZ_Vf_Customer_Orderstatus_List_InputElement().modelObject().execute();

// Synchronise the data in the context with the data in the model

wdContext.nodeOutput().invalidate();

//if(wdContext.currentOutputElement()== null)

IWDTextAccessor textAccessor = wdComponentAPI.getTextAccessor();

int i = wdContext.nodeSales_Order_List().size();

if(i == 0)

{

String message = textAccessor.getText("No_Records");

}

}

catch (Exception ex)

{

throw new WDRuntimeException(ex);

}

//@@end

}

comment on this whether it is appropriate or not.

I am not able to run the application currently so I am not able to see the output.

thanks

kris

Former Member
0 Kudos

Gopi,

here is your own thread with same problem.

Former Member
0 Kudos

Hi Kris,

what is the error that you are getting when you write the declaration in the "//@@begin others...//@@end" block?

From the code that you have posted, it looks fine to me. This should work.

Regards,

Satyajit.