cancel
Showing results for 
Search instead for 
Did you mean: 

Explanation regarding terms and code

Former Member
0 Kudos

hi

i am new to webdynpro for java, i cant understant the terms used in the below coding.

1. wdcontext

2. iwdmessagemanager

etc, can any one explain me in detail wats happening in the below code.

Request_SendEmail requestMO = wdContext.currentRequest_SendEmailElement().modelObject();

requestMO.wdSetInvocationLogEnabled( logger.beDebug() ? true : false);

try {

// call Email Web Service and update dependent // model node 'Response'

wdContext.currentRequest_SendEmailElement() .modelObject().execute();

wdContext.nodeResponse().invalidate();

BigDecimal returnCode =

wdContext.currentSendEmailResponseElement().getReturnCode();

String msg = "Email Web Service returned " + returnCode.toString();

if (returnCode.intValue() == 0) {

msgMgr.reportSuccess("Your email was successfully sent (" + msg + ")!");

} else {

msgMgr.reportWarning(

"Your email was not successfully sent (" + msg + ")!");

}

} catch (CMIException ex) {

msgMgr.reportException(ex.getLocalizedMessage(), true);

this.logWSInvocation(requestMO, ex);

}

//@@end

thanks in advance

rick

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Ricky..

Here,

1.wdcontext

< wdcontext refers that the values tht are in the context shold be retrieved to the node element in the application.

<So tht we can access the values in UI elements thru context.

For Example,

wdcontext.currentRequest_SendEmailElement().modelObject.execute();

This line indicates tht the user trying to execute the node element in the context.

2.IWDMessageManager

<This is used to generate the messages tht are exist in the message editor.

For more details Pls refer the following link..

http://help.sap.com/saphelp_nw04s/helpdata/en/99/34be5f4ee2974a8e7e127c4aeacd9b/content.htm

https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webdynpro/wd%20jav...

Urs GS

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi Ricky..

By using InvocationLogEnabled.. We can obtain the content of web services. For this , Its flag must be set. So tht the server knw wherether model object is enabled or not.

For BigDecimal Pls refer this page..

http://java.sun.com/j2se/1.5.0/docs/api/java/math/BigDecimal.html

beDebug

public boolean beDebug()Same as beLogged()-> This is used to check for the debug mesages.

Urs GS

Former Member
0 Kudos

hi sathish

Thanks for the timely reply, i was able to understand most of the terms.

can you explain me a bit more in detail about

1. bedebug method-- wat is the use of it, wat happens when it is set as true and false.

2. InvocationLogEnabled-- wat is it and a bit more details

3. wat is big decimal type

//ur checking beDebug()method is true or false according to that InvocationLogEnabled value is set.

requestMO.wdSetInvocationLogEnabled( logger.beDebug() ? true : false);

can you explain a bit more about these terms and how are they use in the above code.

sorry for not assingin you points, i new to sdn, can u tell me how to assign points

Thanks in advance

Rick

Former Member
0 Kudos

Hi,

1.wdcontext is a refrence to IContextNode which's an Internal static class extends the Node.At runtime it is used for persistence since the server roundtrip is stateless.

2.MessageManager can be used to display message at runtime both messages stored in the Message pool and custom string messages generated at runtime.

In the code here you have the webservice Model.

"requestMO" is the Model object.

"requestMO.wdSetInvocationLogEnabled( logger.beDebug() ? true : false);"

This basically enables the debug data to written in the log file.

"wdContext.currentRequest_SendEmailElement() .modelObject().execute();"

execute method triggers the request from the current model object.

"wdContext.nodeResponse().invalidate();"

Refreshes the context node with the new Response

msgMgr.reportSuccess("Your email was successfully sent (" + msg + ")!");

you can get the message Manager Object through wdComponentAPI.getMessageManager() and can print custom user messages in the given conditions.

Former Member
0 Kudos

Hi ricky,

According to ur program

context is a virtual memory it is used to store value of the ui element.

iwdmessagemanager is used to print some error messages from message pool(or)if we want to know the values we can use that as print statemant like (Sys.out.print) in java(report success is used for that)

//creating model object for Request_SendEmail

Request_SendEmail requestMO = wdContext.currentRequest_SendEmailElement().modelObject();

//ur checking beDebug()method is true or false according to that InvocationLogEnabled value is set.

requestMO.wdSetInvocationLogEnabled( logger.beDebug() ? true : false);

try {

// call Email Web Service and update dependent // model node 'Response'

//here ur executing the model so that the values r initilized.

wdContext.currentRequest_SendEmailElement() .modelObject().execute();

//invalidate() is used to clear the values.that is ur clearing the response node values.

wdContext.nodeResponse().invalidate();

//here ur accessing SendEmailResponse ReturnCode that is to be stored as BigDecimal type.

BigDecimal returnCode =

wdContext.currentSendEmailResponseElement().getReturnCode();

//ur adding returnCode value to the string

String msg = "Email Web Service returned " + returnCode.toString();

//According to the return code ur printing messages whether it is successful or not.

if (returnCode.intValue() == 0) {

msgMgr.reportSuccess("Your email was successfully sent (" + msg + ")!");

} else {

msgMgr.reportWarning(

"Your email was not successfully sent (" + msg + ")!");

}

} catch (CMIException ex) {

msgMgr.reportException(ex.getLocalizedMessage(), true);

this.logWSInvocation(requestMO, ex);

}

//@@end