Alv Input Field Validation
Hi Experts,
In my initial screen there are some search criteria based on which i ve to display the data by using ALV.
And i ve hardcoded some value and the data are coming in ALV . But my question is how can i validate the data which is enter by the user in the search field so that data can bedisplay based on the search criteria in the alv output.
Regards,
Satya
Hi ,
use OVS (object value selector) method there , it wll take input and according to that f4 will be displayed.
OVS Component:
https ://OVS Input Help
http://help.sap.com/saphelp_erp2005/helpdata/en/30/d7fa41c915da6fe10000000a1550b0/content.htm
Packages : WDR_TEST_OVS2,WDR_OVS,WDR_TEST_OVS
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/user-interface-technology/webdynpro/wd%20java/wdjava%20archive/web%20dynpro%20valuehelp%20using%20object%20value%20selector.pdf
/people/shruti.rathour/blog/2008/05/05/ovs-help-in-web-dynpro-abap
Regards,
Muneesh Gitta.
Similar Messages
-
Input field validation in a Table based on the value of other column
Hi all
I have a table with 2 columns. column1 is of text view and column2 is Input field.
The user should not be allowed to enter a value in the column2 ( input field) greater than the value populated in column1(textview).
So for Eg; if the column1 is populated with value 100, The user should not be able to enter a number greater than 100 in the column2 input field.
Please let me how this can be achieved.
I appreciate the help.
ThanksHi,
Let me make sure u r working with table control.
First u have to create a event(VALIDATE) to do the validation.
Inside the event,
1. First get the current index where user has pointed the curson
2. Once u get the index read the internal table with index value.
3. Now u can compare the col1 and col2 values and populate the error message.
1. DATA : lo_elt TYPE REF TO if_wd_context_element,
l_index type i.
lo_elt = wdevent->get_context_element( name = 'CONTEXT_ELEMENT' ).
CALL METHOD LO_ELT->GET_INDEX( RECEIVING MY_INDEX = l_index.
above code should be written inside the event.
Thanks, -
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. -
Input field validation using JSP in HTMLB
Hi All,
How can we validate an input field in a form in BSP page.
Like: There are two input fields in my form.I want the user to enter value in any one and only one of the fields.If the value is entered in both fields or none of the fields the user should get a popup and form must not be submited.
Shall i use the onClientClick attribute of Button element or doValidate attribute of Inputfield element or validationScript attribute of From element?
Please help.
Thanks a lot,
Anubhav.Here you go:
<%@page language="abap" %>
<%@extension name="htmlb" prefix="htmlb" %>
<htmlb:content design="design2003" >
<htmlb:page title=" " >
<htmlb:form id="form1" >
< script t-ype = "text/javascript" > "Remove "-" between t & ype in type
function checkInput()
var field1 = document.form1.field1.value;
var field2 = document.form1.field2.value;
var error = "";
if(field1 != "" && field2 != "")
{ error = "X";
javascript error message here }
if(field1 == "" && field2 == "")
{ error = "X";
javascript error message here
if(error == "")
htmlbSL(this,2,'mybutton:Submit');
< / script >
<htmlb:textView text = "Hello World!"
textColor = "RED"
design = "HEADER1"
align = "CENTER" />
<htmlb:inputField id = "field1"
value = "<%= var1 %>"
type = "integer"
alignment = "CENTER" />
<htmlb:inputField id = "field2"
value = "<%= var2 %>"
type = "integer"
alignment = "CENTER" />
<htmlb:button id = "mybutton"
text = "Press Me"
onClientClick = "javascript:checkInput();" />
</htmlb:form>
</htmlb:page>
</htmlb:content>
Raja T
Message was edited by:
Raja Thangamani -
ALV: input field only in some rows
Hi:
I have done an ALV with FM 'REUSE_ALV_HIERSEQ_LIST_DISPLAY' .
With the attribute "INPUT = 'X'" of the catalog of fields, a field will appear editable in all rows but I need a field that appears editable in some rows but in others no. How?
thank´i think it is not possible like that , u can increase the length of that field in fieldcatalog
wa_fieldname-outputlen = '100'.
and in layout u can use
wa_layout-colwidth_optimize = 'X'. -
Hi Experts
I have an OIF Application in which I have an Input enabled table and it is mandatory to enter the date range fields. When the user clicks 'SAVE', I have to validate if the start and end dates are entered in each record, and give an error message if blank. I wanted to know if I have to loop through each record and validate manually or if there is a better way?
Thanks
NeoHello Neo,
you can use the utility method CL_WD_DYNAMIC_TOOL=>CHECK_MANDATORY_ATTR_ON_VIEW to check for the mandatory attributes.
For this you need to set the STATE property of the inputfield (in the table column) to REQUIRED.
BR, Saravanan -
How i can show the selection screen input field in the top of page in alv
hi ,
how i can show the selection screen input field in the top of page in alv grid output.
tell me the processHi,
excample from my program:
FORM topof_page.
DATA: l_it_header TYPE TABLE OF slis_listheader WITH HEADER LINE,
l_info LIKE l_it_header-info.
DATA: l_it_textpool TYPE TABLE OF textpool WITH HEADER LINE.
DATA: l_key LIKE l_it_textpool-key.
READ TEXTPOOL c_repid INTO l_it_textpool LANGUAGE sy-langu.
DEFINE m_selinfo.
if not &1 is initial.
clear l_it_header.
l_it_header-typ = 'S'.
l_key = '&1'.
translate l_key to upper case.
read table l_it_textpool with key key = l_key.
if sy-subrc = 0.
shift l_it_textpool-entry left deleting leading space.
l_it_header-key = l_it_textpool-entry .
endif.
loop at &1.
case &1-option.
when 'EQ'
or 'BT'
or 'CP'.
write &1-low to l_it_header-info.
when others.
write &1-low to l_it_header-info.
concatenate &1-option
l_it_header-info
into l_it_header-info
separated by space.
endcase.
if not &1-high is initial.
write &1-high to l_info left-justified.
concatenate l_it_header-info
l_info
into l_it_header-info
separated by space.
endif.
if &1-sign = 'E'.
concatenate ']'
l_it_header-info
into l_it_header-info.
endif.
append l_it_header.
clear: l_it_header-key,
l_it_header-info.
endloop.
endif.
END-OF-DEFINITION.
m_selinfo: s_trmdat,
s_trmext,
s_trmint,
s_fkdat,
s_delno,
s_vbeln,
s_deact,
s_kdmat.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = l_it_header[].
ENDFORM.
I hope, this will help you.
Regards
Nicole -
Hi All,
I have a requirement to display one field in the ALV grid as input field,so that the user can enter value in that field when the ALV is displayed.I need to use this entered user value later in th eprg for further processing.
My worry is that i do not see any parameter such as "INPUT " or "EDIT " in the field catalog structure lvc_s_fcat for the ALV.
How can i acheive having editable input field in the ALV grid?
Please suggest.
Thanks,
SwatiEDIT field in field catalog is there, you must have ommited it.
ls_fieldcat-edit = 'X'. "set your desired column to be edited
Now you need to get entered value for further processing.
Define a class as a event receiver for data_changed or data_changed_finished events. Here is how to implement the latter method:
CLASS cl_alv_event_receiver DEFINITION.
PUBLIC SECTION.
METHODS:
cell_changed FOR EVENT data_changed_finished OF cl_gui_alv_grid
IMPORTING e_modified et_good_cells.
ENDCLASS.
CLASS cl_alv_event_receiver IMPLEMENTATION.
METHOD cell_changed.
check e_modified = 'X'. "if content of cell was changed
"here you check et_good_cells table, it will contain new values
"it is of type lvc_t_modi
ENDMETHOD.
ENDCLASS.
CREATE OBJECT cl_alv_event_receiver.
"now just indicate the handler for this event
SET HANDLER cl_avl_event_receiver->cell_changed FOR cl_gui_alv_grid.
Each time some action was perfomed on edit field, the method will be invoked and you can check inside what was changed and what is the new value.
Additionally after displaying your output table in alv, you need to register this event
"register edit events
CALL METHOD W_ROGRID->register_edit_event
EXPORTING
i_event_id = cl_gui_alv_grid=>mc_evt_modified.
Now all you need is to update appropraite records to your internal table in your METHOD cell_changed. -
Editable / Non editable input field CELL (individually) on ALV dynamically
Hi again,
I need more help with an issue.
I have an ALV table with three columns that is necessary put values into input field cell editors, but these cells should be editable or not depending of business logic. I've got make editable or non in entire ROW LEVEL (method set_read_only_fieldname( 'READ_ONLY' )., but ¿how can I set editable or non at individual cells?
Any idea to do that?
Regards
Edited by: vanbelal on Mar 24, 2010 3:33 PMCan you paste any example source code?
I don't know how can I bind enabled property dynamically to individual CELL, I'm setting properties to whole column.
lt_columns = lr_column_settings->get_columns( ).
LOOP AT lt_columns INTO ls_columns.
if ls_columns-id = 'COLUMN1' or 'COLUMN2' or 'COLUMN3'.
CREATE OBJECT lr_input_field
EXPORTING
value_fieldname = ls_columns-id.
ls_columns-r_column->set_cell_editor( lr_input_field ).
Should I put business logic here? how can I set enabled or not on CELL, at this point I'm processing whole column!!
lr_input_field->set_enabled( abap_true ).
endif.
ENDLOOP.
Edited by: vanbelal on Mar 24, 2010 4:12 PM -
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> -
Validation of values in an input field.
Hello togther,
I've created an input field with a value-selector, so that the user can choose a value from help-list. But he can also enter a value directly into the input field. Is there any "STANDRAD" method to check whtether the value which is in the input field is valid against the values from the value-selector?
I've found a standard method to check whether mandatory fields are field and the method works fine. Is there anything like this also for checking values against values from the selector?
Thanks in advance.
Greetings,
FlorianHello Florian,
You can create an event CHECK_DATA for OnEnter event of you input field.
Then go to the Action tab and select the action type as Validation-Independent .
Hope this will work for the input field with OVS help .
Regards
Vivek -
Field validation in table maintenance generator and input value grey out.
i have created ztable with 3 fields as em_no,em_no and addrnumber.
first two fields are custom fields but the third custom field need to validate the standard table adrc contains the value of the field addrnumber.
i need the query of field validation query which we write in create entry events in table maintenance generator and also if we give wrong value for addrnumber in sm30 maintain table, the input field need not to be grey out for next entry...
please help.Hi,
create method -
>before saving data.....write the logic between the method
go to utilities->table maintanance ,,,after creating generator ---go to envirnment->modification->events.
create event -.>.as zsave select event type 1(before saving data to table) write code in include....
consider data for field3 is 10 .
lv_new = ztbr(table name)-field3.
select field3 from ADRC(ZTABLE) into wa_new (TYPE ZTABLE) where field3 = lv_new.
if sy-subrc = 0.
working fine
else.
message i888(sabapdocu) with 'data invalid'.
endform.
This will help u...
Thank u......... -
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: -
How to set cureent date as input field in alv
Hi Experts
I have created an Alv report.In that report i have an input field Created Date.
how to set the current date default in the alv input.Plz guideHi ,
In the internal table declare a field of type D and pass the sy-datum. this will solve ur problem.
Hope information shall be useful.
Regards
Santosh Kumaar.M -
Upper Lower Case for Input Fields of ALV
Hi,
i have an ALV has some input fields columns. All values of input fields are upper case after entering something into that input fields (etc. airline -> AIRLINE).
how to add upper lower case control to ALV? (etc. airline -> airline, AIRLINE -> AIRLINE)
Thanks.Dear Narullah,
The elements of your table consists of data types you can maintain in the SE11.
The data type are based on a domain which you can maintain in SE11 as well.
Just go to SE11 and check the domain which is behind the table field. On the tab "Definition" of the domain just checkmark "Lower Case". Afterwards the system does not translate your input to upper case automatically.
If you use a SAP domain, you need to copy it to customer namespace, set the lower case flag, create a new data type based on your own domain and use it in the structure of your internal table.
Does this help?
Regards,
Hendrik
Maybe you are looking for
-
Can too large a folder cause issues and effect performace of my Mac Pro
Hi, I have a 180 gb folder filled with important data within my Home folder. This folder has a many subfolders as well. The folder is on my startup drive and where I have Snow Leopard installed. Can too large a folder cause issues with my mac and eff
-
I have turned on my I phone this morning and it is asking for a pass code I have never used one and cannot get past the page can anyone help?
-
Sapscript : how to print logo in dynamic position ?
i have form with different company logo's , and i want to set the POSITION for each logo i created logo window and i can see the logo , But i can't set the POSITION of logo window according to my logo size. i tried : /: POSITION WINDOW /: POSITI
-
Cannot mount a .dmg file
I just received a Slingbox Pro for the holidays. I downloaded their software, which is in the form of a dmg file. After the download it would not mount. The people at SlingBox are clueless. I'm waiting for a Mac specialist to call me back. Any idea w
-
Mobile apps with phonegap + mysql ?
Hi, i was searching for a long time but didn't find answers. is it possible to show database-driven content within mobile apps made with dreamweaver cs6 ? If so, are there any examples or tutorials on the adobesite or elsewhere? Looking forward for a