on 01-12-2006 10:41 AM
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
closing the thread
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
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
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.
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.
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
User | Count |
---|---|
80 | |
9 | |
9 | |
7 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.