Range validations in web dynpro
Hi experts,
can you please tell me How to perform Range validations in web dynpro applications ?
Advance Thanks,
Namrata.
Hi Namrata,
Create a Simple Type (Local Dictonary -> DataTypes -> SimpleTypes). Enter either Length constraints / value constraints in the simple type. Bind this simple type to the context attribute. Whenever you are performing an action framework generated error message will be displayed based on the constraints you designed in simple type.
Thanks
Madhu
Similar Messages
-
Client side validations in web dynpro
Hi experts,
can anybody tell me How we perform client side validations in web dynpro ?
Thanks,
Prasad.Hi Prasad,
Validations are generally required during some events or calls to a functions. So there are bascially two ways:
1) You do the validation is the onActionEvent of the UI element. However this is some time time is not a right approach (depends upon your scenario).
2) There is another method called wdDoBeforeAction(). Do all you validations for the actions in this method. read the java doc for the same functions, here:
* Hook method called for additional validation of user input. <p>
* @param validation Interface for reporting validation errors
You can catch the particualr action in this emthod and then can write you validation code before the action is called.
For gettiong the action use this code:
if(validation.getCurrentAction().equals(IPrivate<Your_View_Name>.WDActionEventHandler.<ACTION_NAME>)){
// write your validation code here.
I hope this will help you. Please revert back in case you have further issues.
Thanks and Regards,
Pravesh -
Validations in Web Dynpro Java
Hello,
I'm trying to create a lot of validations in a web dynpro App.
Examples:
- An inputfield must not pass 6 characters of length. (I can set the inputfield length of 6 characters but I can't force the inputfield to accept only 6 characters).
- Some fields (inputfield, textEdit, dropdownByKey) are mandatory. (I can see the property state = "required" but I don't know how it works)
- Some field are mandatory depending in a previous selection.
I'm finding that adding this validation logic to the form is very heavy and implies a lot of work. I want to ask if someone knows an easy and automatically way to add this validation logic to the app, or I can't escape of programing everything.
Please help.
Regards
SUHi SU,
I wrote the following code just to check if this method works or not. Well, this method does work.
Ceate a message in the message pool and use the following code
IWDNode node = null;
wdControllerAPI.checkAndReportRequiredFields(node ,IMessageNew1Comp.VALIDATION__MESSAGE, new Object[]{"test"});
" in my case the attribute bound to the input - whose state is required - is in root container.
"That's why I am passing null as first parameter.
Validation_Message is the message key
"test" is the message which you could pass to the passholder
I hope it helps.
Edited by: Arjun Singh Thakur on Dec 9, 2011 11:32 AM -
How to do the feild validations in web dynpro abap
dear all,
how to do the feild validations for the screen in web dynpro abap.
thanks,
jyothi.hi jyothi,
There are diffrent ways of doing validations for fields of screen in webdynpro abap depending on the requirements.
I am giving simplest way of doing this validation(it may fullfil your requirement also)
For e.g you want that without entering value in particular field user should not proceed to submit the data in screen.
DATA lo_message_manager TYPE REF TO if_wd_message_manager.
DATA lo_api_controller TYPE REF TO if_wd_controller.
lo_api_controller ?= wd_this->wd_get_api( ).
lo_message_manager = lo_api_controller->get_message_manager( ).
DATA var1 type string.
DATA: node TYPE REF TO if_wd_context_node.
node = wd_context->get_child_node( 'DATA' ).
node->get_attribute( EXPORTING name = ' VALUE'
IMPORTING value = var1 ).
IF var1 IS INITIAL.
CALL METHOD lo_message_manager->report_error_message
EXPORTING
message_text = 'Please enter the value'.
EXIT.
ENDIF.
Now in above code VALUE is the attribute with whome your input field is bound .So if user doesnt enter any value into it he will get above msg (u have to use message are ui element to use this method)
If you have any other doubt feel free to ask.
regards
Panky -
How to do date validation in Web Dynpro java
Hi
We have one requirement that One input field with date type is there.When we take Date type input field then in web dynpro Date navigater is appearing by default.Our requirement is if user enters the date manually in the input filed instead of chossing the date from the Date navigator then how we will do the following date validations manually:
a. If user is entering the date in any format then it should convert it to dd.mm.yy format.
b. How to do leap year validation?Suppose user is entering 29.02.20007 then it should display Invalid date.
c. How to do the follwing date validation:
Let's say that current running hours(Text Vie
w) on a given engine is 100, entered on 10-Jun-2008(Running hour date-Text view)).
-On 15-Jun-2008(New Running Hour Date-input field), I try to enter a value of 300 hours(New running hour-input field).
-This is impossible, because only 5x24=120 hrs has passed from the previous update.
-Hence, in this case the maximum value I can enter is 100+120=220.
Can anybody help me in solving the above 3 date validation?Hi Susmita,
For your 3 rd requirement...
Initially you will be storing the first date entered by the user right???
Say that date is D1. and user entered hours is H1.
now after some days at day D2 user again trying to enter some hours say H2. Now you have to restrict user from entering hours which are
greater than 24*D2-D1....
so now you have to get D2-D1....
For this....
long l1=youdate1.getTime(); // This will convert your Date D1 into long...
then,
Date d=new Date(System.currentTimeMillis());
long l2=d.getTime(); //which is a long value of current date...
So Now l2-l1 will give you number of days between past date and today's date...
So On Save you check for
if((l2-l1)*24<(H2-H1))
message("Please enter valied number of hours");
Hope this will help you....
Regards,
Srinivas. -
Validations in Web Dynpro FITE_VC_GENERAL_DATA
Dear Experts.
I need do a validations in the Web Dynpro FITE_VC_GENERAL_DATA, in where the value of field Costes estimados is the same that I put in the field Anticipos.
I want put the same value of the field Anticipos in the field Costes estimados.
I attach the images with the request.
[Step1|http://www.freeimagehosting.net/uploads/2cca4ef6b6.jpg]
[Step 2|http://www.freeimagehosting.net/uploads/b0c1da770b.jpg]
[Step 3|http://www.freeimagehosting.net/uploads/a24610c47b.jpg]
In the following link I found a listed of BAdI and Exit.
ESS: BAdi for Checking Mileage
I am new with WD ABAP a I want know How can do this?
Thank in advance for your help.
RegardsHi.
I did this, but the system display the message that posted in the following link:;
The ASSERT condition was violated.
Regards -
Hi,
Can anyone explain how to do data validation for the i/p fields in the WD View???Pleasegive an example with coding.
Thanks!Hi,
As Thomas pointed out in his reply that do the validation at WDDOBEFOREACTION method
say you have a date to validate:
DATA lo_nd_importing TYPE REF TO if_wd_context_node.
DATA lo_el_importing TYPE REF TO if_wd_context_element.
DATA ls_importing TYPE wd_this->element_importing.
DATA lv_startdate LIKE ls_importing-startdate.
navigate from <CONTEXT> to <IMPORTING> via lead selection
lo_nd_importing = wd_context->get_child_node( name = wd_this->wdctx_importing ).
get element via lead selection
lo_el_importing = lo_nd_importing->get_element( ).
get single attribute
lo_el_importing->get_attribute(
EXPORTING
name = `STARTDATE`
IMPORTING
value = lv_startdate ).
if lv_startdate is initial.
get message manager
DATA lo_api_controller TYPE REF TO if_wd_controller.
DATA lo_message_manager TYPE REF TO if_wd_message_manager.
lo_api_controller ?= wd_this->wd_get_api( ).
CALL METHOD lo_api_controller->get_message_manager
RECEIVING
message_manager = lo_message_manager
report message
CALL METHOD lo_message_manager->report_error_message
EXPORTING
message_text = 'Please input start date'
params =
msg_user_data =
is_permanent = ABAP_FALSE
scope_permanent_msg = CO_MSG_SCOPE_CONTROLLER
view =
show_as_popup =
controller_permanent_msg =
msg_index =
cancel_navigation = 'X' "this parameter will stop the program at the same view
endif.
this will stop the user at the same view and will give the error message out.....
you can also check the code wizard and try different type of methods to give out the error messages....the code wizard is right beside the external break point button...
Thanks...
AS. -
Input field validation in web dynpro abap
Hi....i have a input field in a view, which is bound with dictionary object of char type ,through context.for this input field, i have to allow the end users to enter the numeric and float values only,but in my condition it accepting everything and returns runtime error.for this how to validate inputs other than numerics.
Thanks & regards,
pavan maganti.DATA lo_nd_itab2 TYPE REF TO if_wd_context_node.
DATA lo_el_itab2 TYPE REF TO if_wd_context_element.
DATA ls_itab2 TYPE wd_this->element_itab2.
DATA lv_non_numeric TYPE wd_this->element_itab2-non_numeric.
* get message manager
DATA lo_api_controller TYPE REF TO if_wd_controller.
DATA lo_message_manager TYPE REF TO if_wd_message_manager.
* navigate from <CONTEXT> to <ITAB2> via lead selection
lo_nd_itab2 = wd_context->get_child_node( name = wd_this->wdctx_itab2 ).
* get element via lead selection
lo_el_itab2 = lo_nd_itab2->get_element( ).
* get single attribute
lo_el_itab2->get_attribute(
EXPORTING
name = `NON_NUMERIC`
IMPORTING
value = lv_non_numeric ).
IF lv_non_numeric CO '1234567890'.
lo_api_controller ?= wd_this->wd_get_api( ).
CALL METHOD lo_api_controller->get_message_manager
RECEIVING
message_manager = lo_message_manager.
* report message
CALL METHOD lo_message_manager->report_success
EXPORTING
message_text = 'All numeric'.
ELSE.
lo_api_controller ?= wd_this->wd_get_api( ).
CALL METHOD lo_api_controller->get_message_manager
RECEIVING
message_manager = lo_message_manager.
* report message
CALL METHOD lo_message_manager->report_warning
EXPORTING
message_text = 'Contains characters'.
ENDIF. -
Hi,
I need to put some validations in web dynpro java page which is "employee address page". I checked the BADI's but no badi exists which serve my purpsoe.
Now I want to make the code change in web dynpro java. Pls answer the followng questions.
1- I have installed NWDS on my local machine. Do i need to install NWDI also?
2- How to import and export the required page and from where?
3- How to modify the standard code, I mean in ECC we have enhancement and modification concept.
Thanks,NWDI is a part of NWDS, So you would need both as mentioend
NWDI - Netweaver Development Infrastructure is an SAP sytem for java development & change management. It's a repository for java code and change management system.
NWDS is a developer tool to build applications similar to Eclipse. NWDS uses NWDI to check-in & check-out java code and move java changes to SAP runtime systems (like portal etc).
Read the basics of NWDI and its utility in the below help document
http://help.sap.com/saphelp_nwce72/helpdata/en/48/bc23b1a70a0611e10000000a42189b/frameset.htm
Also go through how to import ESS configurations in NWDI
ESS/MSS Customization Make it Simple
NWDI cookbook in SAP note : 872892
The specified item was not found.
Edited by: Siddharth Rajora on Nov 9, 2011 9:28 PM -
Validating Input field in Web Dynpro
Hi All,
Could you please tell me how do I use set_attribute and get_attribute methods to get the user input from the dynpro screen?
The user enters some data in the input field. I need to get this data and validate it.
Please tell me how to get the user input.
Thanks & Regards,
Srilakshmi Bhi,
you can go through it,might be your problem solve.
Example for Using Messages
The following example shows how you can use messages created in the Message Editor. In the example, both messages with static text and messages that are dependent on user inputs that is, messages with dynamic text are defined.
Description of Example
Users can create a domain in this sample application. They can then enter a number in the next input field and press Click here to validate. If the specified number lies in the previously specified range, the user is informed of this fact in a standard message. If the number does not lie within this domain, the user sees a warning message.
Prerequisites
You have created a Web Dynpro application and defined view MainView within a Web Dynpro component.
Procedure
Creating the View
Define the view as illustrated below:
Context Creation:
The context that provides the data is created as follows:
1. Create a context node, UIElem
2. Set the propertycardinality to 1..1 for the context node.
3. Create the context attributes a, b, and TypeField.
4. Set the Type of the context attributes to Integer.
Data Binding
To make the messages dynamic with regard to specification of the domain, the user inputs have to be saved. To do this, the input fields have to be bound to the context.
sss
Object
Object ID
Data Binding to Attribute
Path Within the Context Structure
a
Input Field
A
MainView.UIElem.a
b
Input Field
B
MainView.UIElem.b
Children_2
Input Field
TypeField
MainView.UIElem.TypField
In addition, bind the Children_3 pushbutton to action ValidateAction, which you also have to create.
Creating Messages in the Message Pool
The Web Dynpro tools provide a special message editor for defining messages of different types.
A message is defined by a specified key, message type, and message text. The message types error, warning, and standard are predefined.
Create the following messages:
Messages Defined in the Message Editor
Message Key
Message Type
Message text
key1
warning
Please enter a number between the range of and !
and are placeholders for the user input (the domain), which changes dynamically.
key2
standard
The value entered is within the valid range.
Implementation
Because the messages are only displayed when the user Chooses Click here to validate, the messages must be implemented in the method onActionValidateAction:
Implementierung der Methode onActionValidateAction()
//@@begin imports
import com.sap.tc.webdynpro.progmodel.controller.MessageManager;
import com.sap.test.errorhandlingtest1.wdp.IMessageErrorhandlingTest1;
import com.sap.test.errorhandlingtest1.wdp.IPrivateMainView;
//@@end
public void onActionValidateAction(
com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent)
//@@begin
int i = wdContext.currentUIElemElement().getTypField();
int a = wdContext.currentUIElemElement().getA();
int b = wdContext.currentUIElemElement().getB();
MessageManager msgMgr =
(MessageManager)wdThis.wdGetAPI().getComponent().getMessageManager();
if (a < i && i < b)
msgMgr.reportMessage(IMessageErrorhandlingTest1.KEY2, null, true);
else
Object[] arg ={new Integer(a), new Integer(b)};
msgMgr.reportMessage(IMessageErrorhandlingTest1.KEY1, arg, true);
//@@end
The following tasks have been implemented in this method:
1. Read user inputs:
int I = wdContext.currentUIElemElement().getTypField();
int a = wdContext.currentUIElemElement().getA();
int b = wdContext.currentUIElemElement().getB();
1. Read messages from the Message Manager:
MessageManager msgMgr =
(MessageManager) wdThis.wdGetAPI().getComponent().getMessageManager();
2. Does the input lie within the defined domain?
if (a < i && I < b)
3. Call the standard message when the input lies within the domain:
MsgMgr.reportMessage(IMessageErrorhandlingTest1.KEY2, null);
Method reportMessage can be used to read the messages from the Message Manager. In this way you define the key and the objects that you want to change dynamically in the messages. Because no dynamic text was defined in your standard messages, you define null as a parameter.
4. Call the warning messages when the input does not lie within the domain:
Object[] arg ={new Integer(a), new Integer(b)};
MsgMgr.reportMessage(IMessageErrorhandlingTest1.KEY1, arg);
Because the warning messages ( Please enter a number between the range of and !) contain text that depends on the user input, you also have to define the parameters for the domain in an object array. In the messages, the first object is then called from the array with (and the second with , and so on).
Result
After you have built and deployed your application, you can call it by choosing Run.
If the user enters a number that lies within the defined domain, a standard message is displayed:
If the user enters a number that does not lie within the defined domain, a warning message is displayed: -
Web Dynpro Import Web Service Model - not a valid NCName
Hi people,
We are having a problem while importing a WSDL as an Adaptive Web Service Model in Web Dynpro (CE 7.2 SP03).
The error is the following:
"Definition of qualified base /schema/element[5]/complexType/sequence/element[4] is not correct. The value of property is not a valid NCName."
We tried importing the same WSDL in other tools (XML Spy and SOAP UI). With these tools it could be read without errors and were able to successfully call the service.
The point is, why the import fails in Web Dynpro if the WSDL can be read in other tools ? Can we do something in WD to import the WSDL that is supposed to be "not correct" ?
Thanks in advance for your comments,
DanielHi Pranav,
I was facing this issue sometime back and i figured out that the ABAP proxy namespace in my case had a '/' in it, because of which the internal name of the service had a '/' character too.
And this was unacceptable for the endpoint binding name in my case.
Since it is occuring for you in case of the service name (i figured it out from attribute definations/services@name), check if the proxy name have a special character like '/'.
Regards,
Vivek -
Error «The entered value is not on the list of valid values» in the hierarchy of mss web dynpro abap
Hello Experts
The error «The entered value is not on the list of valid values» in the hierarchy of mss web dynpro abap occurs after manager’s following actions:
selected detailed Team View ;
selected hierarchy;
changed style of the hierarchy to any other (for example, the vertical);
the error occurs after attempting to do any action.
Our system is EHP7.
If someone faced with this error, please give me advice how can i resolve this problem.Hi John,
Sorry for the delay in replying. No, we do not have the same problem if we understand you correctly.
"We have bypassed the MSS Home Page and just embedded the Detailed Team View as a standalone application in our MSS portal role" - we also made for the our customer. BUT we have error «The entered value is not on the list of valid values» in our standard system.
Regards,
Andrey -
Validation of Adobe Form from Web Dynpro
Hi, can you please support me with the following problem:
I created an Adobe Form, which contains several mandatory fields. The Submit-button of the form is positioned in the WebDynpro-View, in which the Adobe Form is embedded, but not within the Adobe Form. I choce this way in order to avoid a useless submit button in the Adobe Form for the Offline Scenario.
(How) is it possible to do a validation check in the Adobe Form if all mandatory fields are filled by clicking the Submit button outside the Form?
Thanks in advance,
ThorstenHi Thorsten,
That would be done exactly the same as checking mandatory text fields in a standard Web Dynpro application, the fact that you use an interactive form makes no difference. Whether you click on a submit button in the form or a button in the Web Dynpro, the end result is simply that the entered data is transferred to the Web Dynpro context and an action is triggered. In the action (Web Dynpro code) you can check if the data in the context is valid, e.g. mandatory fields or whatever validation you like. However, if you want to do validation in the form itself, so mandatory fields are also checked offline, you have to use scripting in the form itself.
Kind regards,
Sigiswald -
How to write database validations in Adobe flex form for web Dynpro
Hi,
Can any one help me
How to write database validations in Adobe flex form for web Dynpro
Please provide some documents if u have
Thanks in advance
D babuHi Thomas Jung ,
Thanx for reply.
I will explain my requirement
I have vendor field in flex if i enter vendor no in flex I am biding this field to web dynpro context field I am getting this value in dynpro .
With this value I am checking in my SAP database if i donu2019t get I have to through an error in flex .
Please tell me how to through an error to flex. -
Limit ranges on Web Dynpro Business Graphics
I am implementing a "speedometer" graphic in Web Dynpro (using the Business Graphic control). Does anyone know how to set it so that it would always show the same max and min values regardless of the data passed in. (i.e. if my data is 20, 30, and 40, the total range displayed might be from 10 to 50. What if I want it to always show 0 to 100?)
Never mind. Found the answer.
In the Chart Designer, go to Axis, set the Minimum and Maximum values and de-select "Minimum Automatic" and "Maximum Automatic."
Maybe you are looking for
-
IPod freezes when played thru 3.5mm jack
When my iPod played on any device through the 3.5mm jack, from portable units to my car system, the iPod plays 1 to 3 songs, then freezes, even when fully charged. It then has to be unplugged, let sit for a while, and then the cycle can start over ag
-
This is a test of the emergency broadcast system
In the event of a real Adobe emergency, you will be instructed as to where to go to get your Adobe unbroke.
-
Setting Crystal Report data source at runtime
In advance, I've read all of the posts on here about dynamically changing the data source for your report at runtime and none of it seems to work. I developed a report against my development database using an MySQL ODBC connection. At runtime I want
-
Activation date keeps slipping
Hi, I am getting increasingly frustrated at the lack of information being given by BT in respect to FTTC. My exchange at Aberdeen Portlehen was meant to have been activated almost a year ago and I am still waiting. Whilst I appreciate there are techn
-
Reference equality for X and Integer
Hi, my problem is that i'd like to understand why java won't accept this statement at compile time. Class X { .... } Class Y { doSomething(...) { X x1; Integer i; boolean b = i == x1; }I absolutly know that this code makes no sen