How to do validation of input fields
Hi all,
I have a rquirement to do the validation of input fields.Can anybody explain me how to go for that???Please explain in detail.U can also give me a link where i can find the tutorial for doing this.
Hi Amit,
What everyone has said above is correct - in the method of your action simply test for whatever condition you need to validate for. However, the following tutorial shows you how to use Web Dynpro's Message Manager to display the messages on the screen in an easy user-friendly way:
<a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webdynpro/wd%20java/wd%20tutorials/a%20simple%20input%20form%20with%20message%20and%20error%20service%20support.pdf">Enabling Message and Error Support</a>
In addition, there are some validations that are done automatically depending on what you have your input fields set to - for instance, if you bind your input field to a date and a user enters words into the field instead of an actual date, it will automatically display an error message. To learn how to turn this feature on and off, see this tutorial
<a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/uuid/edf6ea90-0201-0010-7696-a68662381c12">Using Validating and Non-Validating Actions</a>
Similar Messages
-
How can we change the input field on a view stop showing zeros
Hello,
To make screen look consistent with other character input field. How can we change the input field on the view stop displaying zeros even though the data type is NUMC and data type should not be change?
Edited by: sap_learner on Mar 25, 2010 5:44 PM
Edited by: sap_learner on Mar 25, 2010 5:49 PM
Edited by: sap_learner on Mar 25, 2010 5:55 PMhello Manas Dua,
Thanks for your help. I am able to resolve my problem.
My code will help the future comers to resolve this kind of issues.
*The code is applied to method WDDOINIT of the default view.
DATA lo_nd_terms_input TYPE REF TO if_wd_context_node.
DATA lo_nd_terms_input_i TYPE REF TO if_wd_context_node_info.
DATA lv_zeros TYPE wdy_attribute_format_prop.
lv_zeros-null_as_blank = 'X'.
lo_nd_terms_input = wd_context->get_child_node( name = wd_this->wdctx_input ).
lo_nd_terms_input_i = lo_nd_terms_input->get_node_info( ).
lo_nd_terms_input_i->set_attribute_format_props(
EXPORTING
name = `ENTER THE ATTRIBUTE NAME`
format_properties = lv_zeros ).
Edited by: sap_learner on Mar 26, 2010 5:02 PM -
How to enable/disable the input fields based on the data entered in the web dynpro application abap? If the user enters data in one input field then only the next input field should be enabled else it should be in disabled state. Please guide.
Hi,
Try this code.
First create a attribute with the name readonly of type wdy_boolean and bind it read_only property of input field of which is you want to enable or disable.
Next go to Init method.
Set the readonly value as 'X'.
DATA lo_el_context TYPE REF TO if_wd_context_element.
DATA ls_context TYPE wd_this->element_context.
DATA lv_visible TYPE wd_this->element_context-visible.
* get element via lead selection
lo_el_context = wd_context->get_element( ).
* @TODO handle not set lead selection
IF lo_el_context IS INITIAL.
ENDIF.
* @TODO fill attribute
* lv_visible = 1.
* set single attribute
lo_el_context->set_attribute(
name = `READONLY`
value = 'X').
After that Go to the Action ENTER.
First read the input field ( first input field, which is value entered field) , next give a condition
if input value is not initial then set the readonly value is ' '.
DATA lo_nd_input TYPE REF TO if_wd_context_node.
DATA lo_el_input TYPE REF TO if_wd_context_element.
DATA ls_input TYPE wd_this->element_input.
DATA lv_vbeln TYPE wd_this->element_input-vbeln.
* navigate from <CONTEXT> to <INPUT> via lead selection
lo_nd_input = wd_context->get_child_node( name = wd_this->wdctx_input ).
* @TODO handle non existant child
* IF lo_nd_input IS INITIAL.
* ENDIF.
* get element via lead selection
lo_el_input = lo_nd_input->get_element( ).
* @TODO handle not set lead selection
IF lo_el_input IS INITIAL.
ENDIF.
* get single attribute
lo_el_input->get_attribute(
EXPORTING
name = `VBELN`
IMPORTING
value = lv_vbeln ).
if lv_vbeln IS not INITIAL.
DATA lo_el_context TYPE REF TO if_wd_context_element.
DATA ls_context TYPE wd_this->element_context.
DATA lv_visible TYPE wd_this->element_context-visible.
* get element via lead selection
lo_el_context = wd_context->get_element( ).
* @TODO handle not set lead selection
IF lo_el_context IS INITIAL.
ENDIF.
* @TODO fill attribute
* lv_visible = 1.
* set single attribute
lo_el_context->set_attribute(
name = `READONLY`
value = ' ' ). -
How to Fill value in Input fields before displaying ADOBE FORM
Hi to all,
Please can anyone tell me how to fill the entry in ADOBE FORM before displaying?
I have written a program to generate ADOBE FORM, but I need while displaying ADOBE FROM some input field should already be filled by value and can not be changed.
Please can anyone tell me how to do that in program?
Below is the program.
DATA: fm_name TYPE rs38l_fnam,
fp_docparams TYPE sfpdocparams,
fp_outputparams TYPE sfpoutputparams.
Parameters: p_pdf_form_name type fname.
fp_docparams-langu = 'E'.
fp_docparams-country = 'IN'.
fp_outputparams-preview = 'X'.
CALL FUNCTION 'FP_JOB_OPEN'
CHANGING
ie_outputparams = fp_outputparams
EXCEPTIONS
cancel = 1
usage_error = 2
system_error = 3
internal_error = 4.
CALL FUNCTION 'FP_FUNCTION_MODULE_NAME'
EXPORTING
i_name = p_pdf_form_name
IMPORTING
e_funcname = fm_name.
E_INTERFACE_TYPE = E_INTERFACE_TYPE
CALL FUNCTION fm_name
EXPORTING
/1bcdwb/docparams = fp_docparams
IMPORTING
/1BCDWB/FORMOUTPUT = fp_outputparams
EXCEPTIONS
usage_error = 1
system_error = 2
internal_error = 3.
CALL FUNCTION 'FP_JOB_CLOSE'
IMPORTING
E_RESULT =
EXCEPTIONS
usage_error = 1
system_error = 2
internal_error = 3
OTHERS = 4.
I shall be thankful to you for this.
Regards
Pavneet Rana
Edited by: pavneet rana on Jul 25, 2011 2:57 PMHello,
you need to provide the information via the interface, which you create for the Adobe form.
And then pass this values via the following function module inside your generation report.
CALL FUNCTION fm_name
check standard report : FP_EXAMPLE_01 as an example! -
How to compare value in input field to value in database?
Hi all. I need to clear up if the value in the input field (e.g. input_field) is equal to at least one record in the field (e.g. name) in database table (e.g. customers), or not. The code should be like this:
IF...
message001. "(there's such a record in database)
ELSEIF...
message002. "(there's no such record in database)
ENDIF.
thanks all.Hi,
I think u r asking about validating the selction screen and displaying a mess if that input is not in the DB right?
AT SELECTION-SCREEN ON s_matnr.
*Validate material no details
PERFORM validate_matno.
FORM validate_matno.
SELECT SINGLE matnr INTO v_matnr
FROM mara
WHERE matnr IN s_matnr.
IF sy-subrc NE 0.
MESSAGE i128.
LEAVE LIST-PROCESSING.
ENDIF.
ENDFORM.
Make sure that u are validating against the header table.
say eg if u wnat t validate matnr in marc, then do as below.
SELECT-OPTIONS: s_matnr FOR marc-matnr. "Material No
AT SELECTION-SCREEN ON s_matnr.
*Validate material no details
PERFORM validate_matno.
FORM validate_matno.
DATA: v_matnr LIEK mara-matnr.
SELECT SINGLE matnr INTO v_matnr
FROM <b>mara</b>
WHERE matnr IN s_matnr.
IF sy-subrc NE 0.
MESSAGE i128.
LEAVE LIST-PROCESSING.
ENDIF.
ENDFORM.
Dont select from marc.
Hope this is clear. -
How to create validation on the field in WEBUI ?
Hi all,
Can somebody inlight me with the following question?
Is it possible in IC WebUI when New Customer is being created through IC center to put validation on some field for Example if customer with the Last Name, First Name, email exists already in the system to notify user about it and to not allow create duplicate. If it possible how to do it using adviseable by SAP ways?
Thank you,
Maria.Hi Maria,
it is possible by implementing a BAdI. See the following discussion for more details: Execution of duplicate check.
The SAP help also has some information on this:
Duplicate Check for Accounts and Contacts - Business Partners - SAP Library
Duplicate Check - Business Address Services (BC-SRV-ADR) - SAP Library
Hope this helps,
Christian
ps.: I the future please search before posting a question. All the links above where in the 10 google results when searching for "sap crm business pattern duplicate check" -
How to set Date in input field by hard coding in application
Hi all,
1.I have to make a date(its my choice to set the date) to appear in input field which is date type.
2.How to compare two numbers of type decimal. for example greatest of two numbers
urgent requirementHi
Check the http://java.sun.com/j2se/1.4.2/docs/api/java/sql/Date.html
http://java.sun.com/j2se/1.4.2/docs/api/java/util/Calendar.html
Sample Code
Date now = new Date();
DateFormat df = DateFormat.getDateInstance();
String s = df.format(now);
System.out.println("Today is " + s);
java.sql.Date descends from java.util.Date, but uses only the year, month and day values. There are two methods to create a Date object. The first uses a Calendar object, setting the year, month and day portions to the desired values. The hour, minute, second and millisecond values must be set to zero. At that point, Calendar.getTime().getTime() is invoked to get the java.util.Date milliseconds. That value is then passed to a java.sql.Date constructor:
Calendar cal = Calendar.getInstance();
// set Date portion to January 1, 1970
cal.set( cal.YEAR, 1970 );
cal.set( cal.MONTH, cal.JANUARY );
cal.set( cal.DATE, 1 );
cal.set( cal.HOUR_OF_DAY, 0 );
cal.set( cal.MINUTE, 0 );
cal.set( cal.SECOND, 0 );
cal.set( cal.MILLISECOND, 0 );
java.sql.Date jsqlD =
new java.sql.Date( cal.getTime().getTime() );
The second method is java.sql.Date's valueOf method. valueOf() accepts a String, which must be the date in JDBC time escape format - "yyyy-mm-dd". For example,
java.sql.Date jsqlD = java.sql.Date.valueOf( "2010-01-31" );
creates a Date object representing January 31, 2010. To use this method with a Calendar object, use:
java.sql.Date jsqlD = java.sql.Date.valueOf(
cal.get(cal.YEAR) + ":" +
cal.get(cal.MONTH) + ":" +
cal.get(cal.DATE) );
which produces a Date object with the same value as the first example.
Regards
Ayyapparaj -
Javascript validation of input field in HTMLB in jsp
Hi... i am using Javascript in HTMLB in JSP for input filed validations .
According to the requirement , the Input Field should start with only "Alphanumeric values" .
Can somebody please help me out in this.
Regards
SmitaHi,
using java script can write like this
function validate(str){return str.substr(0,1) == str.substr(0,1).toUpperCase();}
Regards
Supraja
Edited by: Supraja Koganti on Nov 27, 2008 12:16 PM -
Error in validation an input field in a table ui and high lighting the cell
Hello All,
I have a table ui in one of my application. This table has, say 6 columns; out of these 6 columns 4 columns are shown as input fields. User needs to put in some numbers in two of the fields. I need to capture these two number fields data and subtract one from the other. If number is negative , I need to let the user know by error message that the number is negative and they need to fix their input to make the answer positive. I am able to do all this, but I am not able to high light the corresponding field which needs to be fixed. Is there anyway I can do that...I mean high light the particular field as one gets it when we use the "report attribute error message" method of message manager class.
Secondly I can not halt the application, I need to do some work around for that using some flags. Is there a simple way to halt the application, other than using flags and if condition? I searched this forum, but could not find any definite answer....
Thanks very much!
Any help would greatly be appreicated.Hi....
First you should have the table values in an internal table.... for that yo need to get the values from the context like this....
*DECLARE INTERNAL TABLE AND WORKAREA.
data ls_nd_stru type wd_this->element_<node name>
data lt_nd_table type wd_this->elements_<node name>
get all declared attributes
lo_nd_<your context node>->get_static_attributes_table(
importing
table = lt_nd_table ).
*now your lt_nd_table will have the values.....what ever you have in the table.
*then
loop at lt_nd_table into ls_nd_stru.
<.....your logic.....>
<ie., read the current line of the field like
ls_nd_stru-<field name1> = ls_nd_stru-<field name2> - ls_nd_stru-<field name3>
then check error msg... based on your postive or negative values
endloop.
Hope this will help you....
Thanks & regards
Raja -
How to delete Dynamically created input field UI Element
Hi all,
I want to delete dynamically created input field and label.
Is there any method please tell.
Thanks in advance
HemalathaHi,
In the WDEVENT parameter of the action handler you can find the event id.
***Variables
DATA:
lv_selected type string. "Selected tab value
***Structure and internal table for the Events and messages
DATA:
lt_events type WDR_EVENT_PARAMETER_LIST,
ls_events type WDR_EVENT_PARAMETER.
***Field symbols
field-symbols: <fs_value> type any. "Attribute value in events table
***Move the event table to lt_events
lt_events = wdevent->parameters.
read table lt_events into ls_events with key name = 'SAVE'. "Button Id
if sy-subrc eq 0.
assign ls_events-value->* to <fs_value>.
if sy-subrc eq 0.
lv_selected = <fs_value>.
endif. "IF sy-subrc eq 0.
endif. "IF sy-subrc eq 0.
Regards,
Lekha. -
Please Help. How to access to an input field in a table with javascript
Hi
i�m trying to access to the content of an input field that is in an table with a javascript function in this way
function Valida_Tabla()
var centro = document.getElementById("form1:idcentro").value;
alert("Centro es ["+centro+"]")
var des = document.getElementById("form1:table1:0:textField2").value;
alert("des ["+des+"]")
The fisrt alert is ok and displays the value of a field that is in a table.
The second alert is not displayed.
Is the syntax wrong?
what i�m doing wrong
Please helpThe best bet is to look at the source of the generated HTML and then use the exactly generated ID in the HTML source. When I looked at the HTML source I see the ID of a textfied inside a table as
form1:table1:tableRowGroup1:0:tableColumn1:textField1
- Winston
http://blogs.sun.com/roller/page/winston?catname=Creator -
How to avoid validation of input items within af table and javascript
Hi all,
I developed a form which includes table and commandButton. Some input items are required. I want them to validate while just button pressed.
And everything was ok, this scenario was working well. But when table presents only one row, selecting row does not work. See alsa plz: Table row selection --> might be 9th post
I applied to my jsff the solution which is told in above link. It works previous issue but this time, javascript caused another problem that is inconsistent validation. As i understood java script overrides af table immediate="true" property. plz see : http://www4.picturepush.com/photo/a/11897217/640/11897217.png
How can i resolve that? Any suggestion?
Plz help me
Thanks in advance
<?xml version='1.0' encoding='UTF-8'?>
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1"
xmlns:af="http://xmlns.oracle.com/adf/faces/rich"
xmlns:trh="http://myfaces.apache.org/trinidad/html"
xmlns:f="http://java.sun.com/jsf/core">
<trh:script>
function tableLoad(event)
AdfCustomEvent.queue(event.getSource(), "refreshTables",
true);
event.cancel();
</trh:script>
<af:table var="row" rowBandingInterval="1" id="entityT"
value="#{pageFlowScope.incomingPaperworkBean.baseRowCollection}"
partialTriggers="::cb_incPaperDef_commit ::cb_incPaperDef_filter"
rowSelection="single" columnBandingInterval="0"
disableColumnReordering="true" columnStretching="column:c3"
styleClass="AFStretchWidth" autoHeightRows="20"
contentDelivery="immediate" immediate="true"
binding="#{pageFlowScope.incomingPaperworkBean.richTable}">
<af:clientListener method="tableLoad" type="click"/>
<af:serverListener type="refreshTables"
method="#{pageFlowScope.incomingPaperworkBean.refreshTables}"/>
<af:column id="c5" width="105">
<af:inputText id="registrationText"
value="#{row.baseEntity.registrationNumber.registrationNumber}"
required="true" readOnly="true" autoSubmit="true"
disabled="true"/>
<f:facet name="header">
<af:panelGroupLayout id="panelGroupLayout1" layout="vertical">
<af:inputText id="filterRegistrationNumber"
value="#{pageFlowScope.incomingPaperworkBean.filterTemplate.incomingPaperwork.registrationNumber.registrationNumber}"
simple="true" autoSubmit="true"/>
<af:spacer width="10" height="10" id="spacer1"/>
<af:outputText value="Kayit Numarasi" id="outputText6"/>
</af:panelGroupLayout>
</f:facet>
</af:column>
Edited by: webyildirim on 07.Oca.2013 06:08I guess you want the table header skin selector listing. [http://download.oracle.com/docs/cd/E15523_01/apirefs.1111/e15862/toc.htm|http://download.oracle.com/docs/cd/E15523_01/apirefs.1111/e15862/toc.htm]
search on af:table
I only see one mention of a table header though, so maybe this is the problem.
Have you looked at the html that is output (with Firebug) perhaps and seen what sort of style classes are associated with your table component? in 11g it seems that there are more human-readable style classes that you can guess at by looking at the html source.
Good luck -
How to populate read only input field or text view form value help only
Hi experts,
I have one requirement to populate a read-only field or text view from value help.
User cant put any value there.value comes only from the value help.
For example,
when we read context using Code Wizard,we cant type any value there.value only comes from value help.
How to implement that functionality?
Please reply.
Thanks in advance,
Subhasis.Yes it is possible.
1.Create a context Attribute and then bind this attribute to the Text view UI element.
2. read context attribute and then set value to the context attribute like this way.
DATA:
elem_context1 TYPE REF TO if_wd_context_element,
stru_context1 TYPE if_first=>element_context ,
item_potxt LIKE stru_context-potxt.
get element via lead selection
elem_context1 = wd_context->get_element( ).
stru_context1-potxt = 'PO'.
elem_context1->set_attribute(
VALUE = stru_context1
name = 'POTXT'
thanks
Suman
Edited by: suman kumar chinnam on Sep 9, 2008 12:12 PM -
Validating monetary input fields
Hi. We are developing a web site that supports English and French. Some of the web pages have forms where the user must enter monetary values. Since English and French monetary values use different formats, I am wondering if there's a Java API (that hasn't been deprecated or is obsolete) that would perform validation of these monetary values for us rather than us having to write these from scratch (granted, it would not be overly difficult)? I looked through the Internationalization tutorial but did not see anything on processing currency input, just on output formatting based on the locale (which works fine for us). Thanks...
When I run the following program:
import java.text.NumberFormat;
import java.text.ParseException;
import java.util.Locale;
public class frmoney
public static void main(String[] args)
String number = (args.length < 1) ? "24,98" : args[0];
NumberFormat nfc = NumberFormat.getCurrencyInstance(Locale.FRENCH);
try {
System.out.println("Parsing " + number);
System.out.println(nfc.parse(number));
catch (ParseException e)
System.out.println(e);
}I get:
Parsing 24,98
java.text.ParseException: Unparseable number: "24,98" -
How to validate the input field
Hi,
I have a input form which is draged from input port of a RFC.
in this input form i have two input fields nad submit button.
on of this input field should always take the character values only. it should not take any numeric value
and other input field should always take numeric value only.
i.e how to validate this two input fields.
regards
srinivasHi,
U can validate input fields using javascript.Write OnClientClick function for that submit button if ur using htmlb or onClick if u r using html.Refer the follows
http://help.sap.com/saphelp_nw70/helpdata/en/03/900e41a346ef6fe10000000a1550b0/frameset.htm
There are two ways to achieve ur task.
1.By checking for all alphabets.in this u need check all the alphabetic characters one by one.Refer the following
http://www.shiningstar.net/articles/articles/javascript/javascriptvalidations.asp?ID=ROLLA
http://www.shiningstar.net/articles/articles/javascript/checkNumeric.asp?ID=AW
2.By using regular expressions.its very easy and a single line code.here u need to specify single expression for whole alphabets.Refer this
http://aspzone.com/blogs/john/articles/173.aspx
Everything has been given for validating in javascript.i hope u also validating in javascript only.
For more details on "Regular expressions" search google.
Regards,
Tamil K
Maybe you are looking for
-
How do I enable an update on a 3GS which has never been updated before?
I need to update iPhone 3GS, as it has NEVER been updated before. Under the general/settings, there is no update icon available! How do I install this?
-
Applet does not start after Java 1.5 installation
Hi, When I go to my webpage where I have an applet that requires Java 1.5..the browsers are prompting for Java installation (ActiveX component install on IE or Firefox plugin for JRE installation). But once the Java install completes the applet does
-
Frozen iPhone 5 during restore from iCloud
I backed up my 4s and began setup on my new iPhone 5s. It began the restore from the iCloud but a Less than inch into the process it froze. It has been an hour with no movement. Should I wait? Shut it off and try again?
-
BAPI_CONTRACT_CREATE : Agreement date
Hi, I'm using this fm in order to create contract. I filled BAPI parameter like this: Header-creat_date = 2008.07.20 It should normally fill the agreement date in ME31K but when I take a look after executing BAPI, this date is always sy-datum. Can an
-
I want to reduce the scale of a graph on the web template. Pls advice on how to do this.