Table input field.
I have to create a table which will take input from user. I have created the context and binded it to the table. At the time of biniding with table i mentioned that these will be input field. But the problem is as the node has no value the table becomes uneditable.I have to give user 5 rows for editing. Can any one tell me the steps of creating this.
<b>If possible please provide the detail step & Sample code.
Points will be rewarded.</b>
Thanks,
Prosun
Hi Prosun,
If you want five empty rows in the beginning Insert 5 empty lines in an Internal table and bind it to the context. You can see 5 empty rows in ur table.
Also if u want to add an intial line to ur table when you press add button in the toolbar of ur table.
Provide a Add button linked wit action add
In Action :On action add
DATA: lo_new TYPE REF TO if_wd_context_element,
ls_employee TYPE zemployee,
lo_node type ref to if_wd_context_node.
lo_node = wd_context-get_child_node( 'NODENAME' ).
lo_new ?= lo_node->create_element( ).
lo_new->set_static_attributes( ls_employee ).
do_main_node->bind_element( new_item = lo_new
set_initial_elements = abap_false ).
Regards,
Ismail.
Message was edited by:
Ismail Basha
Similar Messages
-
Hi All,
I am facing a problem now where table row height is too big , as in 1 row size is actually a merged of 2 rows, the input field is shifted to the bottom of the cell. And when you select the row, an asterik is visible at the bottom row, and the input field is shifted up to the top of the cell. I am using customized iterator and cl_crm_ic_inputfield to render the cell. Anyone have this problem before?
Thanks!
Cheers,
cadyHi Guys,
Some additional info i found on this issue. I am using design2003. I realized that the * added meant that its required field. However, upon further checking, when calling method RENDER_DESIGN2003 in class cl_crm_ic_inputfield, it checkes for me->required is not initial, which is kind of odd since the required field has the initial value of 'FALSE'. So , either required = 'TRUE' or 'FALSE', it will always be required field. Anyone encountered such problem before?
Cheers,
cady -
Dynamic Table Input Field - Disabled in runtime
Hi,
I have dynamically created a node. The node as a string attribute X.
Then dynamically created a IWDTable to bind to the node.
In the table I have a column, then a tablecelleditor of inputfield.
The inputfield 'value' is binded to node->X attribute info.
inputField.bindValue(attributeInfo).
Then I created a few entries of the node, populating X with some dummy value.
In runtime, my inputfields are disabled, and the dummy values don't appear.
I believe it is something to do with my binding.
Then I replaced the inputfield with a textview. textview text is binded to the node->X
attribute info.
textview.bindText(attributeInfo)
(i.e. exact same attribute info I used for the inputfield)
In runtime I see my textview with the dummy values.
Can anyone point me in the right direction?
Cheers,
Michael.Hi Guys,
I think to be clear I better include my code here.
I did bind the table to the nodeInfo, and I did bind the textView/inputfield to the particular attribute.
As mentioned before, it does show for the textView, but not for the inputfield.
Create the new node:
IWDNodeInfo newNode = wdContext.getNodeInfo().getChild("nodeName");
newNode =
wdContext.getNodeInfo().addChild(
"nodeName",
null,
true,
true,
true,
false,
false,
true,
null,
null,
null);
Create the attribute:
IWDAttributeInfo detailAttribute =
newNode.addAttribute(
"xyz",
"ddic:com.sap.dictionary.string");
Get the node
IWDNode specificNode =
wdContext.getChildNode(
"nodeName",
0);
Create the element from the node
newElement =
specificNode.createElement();
Set the attribute value:
newElement.setAttributeValue(
"xyz",
"1234");
Add the new element:
specificNode.addElement(newElement);
Create the table now:
IWDTable someTable =
(IWDTable) view.createElement(
IWDTable.class,
"TAB_ArticleQty" + articleElement.getArticleId());
someTable.setEnabled(true);
someTable.setReadOnly(false);
someTable.setRowSelectable(true);
someTable.setFooterVisible(false);
someTable.setSelectionMode(WDTableSelectionMode.NONE);
someTable.setVisibleRowCount(-1);
someTable.bindDataSource(
specificNode.getNodeInfo());
TC.addChild(someTable);
Loop at all the attributes and create the column
The code for the textView has been commented out
The code is now for the input field
* LOOP AT ALL THE ATTRIBUTES IN THE NODE:
* CREATE ONE COLUMN FOR EACH ATTRIBUTE
Iterator allAttributes =
specificNode.getNodeInfo().iterateAttributes();
while (allAttributes.hasNext()) {
IWDAttributeInfo attrInfo =
(IWDAttributeInfo) allAttributes.next();
String attrName = attrInfo.getName();
// Text View
IWDTextView TV_info =
(IWDTextView) view.createElement(
IWDTextView.class,
"TV_AQ_"
+ counter
+ attrName);
TV_info.bindText(attrInfo);
COL_qty.setTableCellEditor(TV_info);
//input field for the user to enter the value
IWDInputField input_Qty =
(IWDInputField) view.createElement(
IWDInputField.class,
"input_Qty"
+ counter
+ attrName);
input_Qty.setEnabled(true);
input_Qty.bindValue(attrInfo);
input_Qty.setWidth("4");
COL_qty.setTableCellEditor(input_Qty);
someTab.addColumn(COL_qty); -
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 -
Highlighting input field and table cell column in red colour
Hi,
I have 4 input fields and a table in my screen. All the input fields are read only.
I have a functionality where I have to highlight a input field with the red colour. In the sense, I have to put a thin Red border over the input field without thowing any errors or messages.
Also, i have to highlight a particular cell in the table. i.e, i have to put Red colour border over the cell of the table for some rows only. Right now i have changed the background colour of the cell for required rows, but i need Red thin border rather than changing the entire background colour.
Please guide me on achieving these functionalities..
Thanks and Regards,
-Shabir Rahim.Hi,
The red thin lines border you are talking about comes from the framework during the exceptions. If this is the case then refer the following links, hope this will help you.
[Re: Automatic message for inputfields with state=required]
[Re: Validation of InputField]
Well without exceptions, i dont think it will come.
thanks & regards,
Manoj
Edited by: Manoj Kumar on Feb 7, 2008 12:09 PM -
Input field in a table view control
Hi,
I have a table view control, with input field in one of the columns.
That is meant for entering some values.
My problem is when i am entering a 3 input field with value and then by using mouse control i enter say 20th input field with value. After that when i use the directional keys to enter the 21st field, the cursor is not in 21st field, it is somewhere else.
How to correct this problem.
Regards,
VijayalakshmiHi,
Try to use the TABINDEX property of <input>.
Best regards,
Guillaume -
How to get the value from the Input field of the Table view.
Hi Experts,
I have created a table view with 10 rows and each rows contains input fields in it.Can you please help me getting the values that are entered in all 10 rows.
Currently I am using the below code,but using the below I am able to get only the first row details of the table.
lo_el_table->get_static_attributes(
IMPORTING
static_attributes = ls_table).
Please let me know you suggestions on this.Thanks in advance.
Regards,
ArunHi Arun,
You should use this method:
lo_nd_table->get_static_attributes_table(
IMPORTING
table = lt_table).
Cheers,
Roelof
http://www.nl4b.com -
Add data to table view from input fields in a page
Hi
I am developing a BSP page which will be called from SRM shop transaction. After user enters the line item data, data will be passed back to shop transaction using OCI interface and the page attributes (URL).
(1) How can I add data from input fields to table view on a page on a button click? I am able to add first line but I could not retain first line data when I try to add the second line.
I am able to add multiple lines to table view if I use view and controller by adding to the line data to static attribute of the controller. I cant use the controller and view because I can not set the attribute to Controller automatically.
(2) Is there a way to pass an attribute (URL) to controller from SPRO? Like we pass an attribute to page automatically (Automatic page attribute).
(3) How can I call a controller and view and pass the page attribute to the controller on a button click from a page with out controller?
Thanks
SreenivasI'm trying to test the merge with the following data in a test.txt file:
ZZZZZ114923000004
1234Z400660000001
ZZZZZ114923000010
Getting an error:
SQL> @C:\dataformats\sql\pc12seriesMerge.sql
Directory created.
SP2-0552: Bind variable "17" not declared.
SQL>
here it the pc12seriesMerge.sql file
set serveroutput on
create or replace directory user_dir as 'c:\dataformats\incoming\';
DECLARE
v_filename VARCHAR2(100); -- Data filename
v_file_exists boolean;
v_file_length number;
v_block_size number;
f utl_file.file_type;
s varchar2(200);
lineString varchar(200);
v_account varchar(5);
v_IDN varchar(6);
v_quantity varchar(6);
BEGIN
v_filename := 'TEST.TXT';
DBMS_OUTPUT.PUT_LINE(v_filename); --shows filename
utl_file.fgetattr('USER_DIR', v_filename, v_file_exists, v_file_length ,v_block_size );
IF v_file_exists THEN
dbms_output.put_line('File Exists');
create table ext_table (
account varchar2(5),
idn number(6),
quantity varchar2(6)
organization external (
type oracle_loader
default directory user_dir
access parameters (
records delimited by newline
fields (
account position(1:5) char(5),
idn position(6:11) char(6),
quantity position(12:17) char(6)
location ('test.txt')
reject limit unlimited;
MERGE INTO id_req_stg t
USING (
SELECT account,
idn,
decode(quantity, '-', 0, to_number(quantity)) as quantity
FROM ext_table
) v
ON ( t.account = v.account AND t.idn = v.idn )
WHEN MATCHED THEN
UPDATE SET t.quantity = v.quantity
DELETE WHERE t.quantity = 0
WHEN NOT MATCHED THEN
INSERT (account, idn, quantity)
VALUES (v.account, v.idn, v.quantity);
ELSE
dbms_output.put_line('File Does Not Exist');
END IF; -- file exists
EXCEPTION
WHEN UTL_FILE.ACCESS_DENIED THEN
DBMS_OUTPUT.PUT_LINE('No Access!!!');
WHEN UTL_FILE.INVALID_PATH THEN
DBMS_OUTPUT.PUT_LINE('PATH DOES NOT EXIST');
WHEN others THEN
DBMS_OUTPUT.PUT_LINE('SQLERRM: ' || SQLERRM);
END;
/ -
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, -
Issue with input field in table control
Hi,
I have an issue with field acgl_item-rstgr in the table control.
I have created a screen program with a table control.
In the control i have added a dictionary field as acgl_item-rstgr.
When i execute, do f4 on the input field, select a value and press enter, then it is showing me
error as 'Entry 'val' does not exist in T053R (check entry). Its really weird to understand this. I have selected the value
from f4 and even then it says this. Its working for all other columns, but not working only for RSTGR.
Plz help me on this regard.
Code is like this.
TYPES : BEGIN OF ty_rstgr,
rstgr TYPE RSTGR,
END OF ty_rstgr.
TABLES : ACGL_ITEM.
DATA : it_rstgr TYPE TABLE OF ty_rstgr.
DATA : wa_rstgr TYPE ty_rstgr.
CONTROLS : table TYPE TABLEVIEW USING SCREEN 100.
PROCESS BEFORE OUTPUT.
MODULE STATUS_0100.
LOOP AT it_rstgr INTO wa_rstgr WITH CONTROL TABLE.
ENDLOOP.
PROCESS AFTER INPUT.
MODULE USER_COMMAND_0100.
LOOP AT it_rstgr.
ENDLOOP.
Thanks,Hi Navitha,
Its Check Table concepts for the error u stated. Please check wht the Search help ur using...Because for this field there is no search help at value table level...Use search help that hold all master data or create a custom search field in SE11 level or in program level.
Cheers,
Naveen -
How to set focus on a input field in a selected row of a table?
In a previous discussion (http://scn.sap.com/thread/3564789) I asked how to access an input (sap.m.Input) field of a selected row in a table. In the answer that was supplied I was shown how to get the items of the table. Then using the selected index to get the selected item get the cells. Then I could set editable on the proper cell(s). This worked fine.
Now I need to set the focus on one of the fields. I tried something like this:
var oNewLink = table.getSelectedItem();
var oNewLinkName = oNewLink.getCells()[1];
oNewLinkName.focus();
But this doesn't seem to work.
I have searched through other discussions and have seen this technique for putting focus on a field if you have its ID:
sap.ui.getCore().byId(id_of_the_input_field).$().focus();
In my case though I do not have an ID since the row and its cells are generated. How can I set focus on the cell of a certain row in a table?Hello Venkatesh. Yes that code does work. First I tried it on a table cell that was already rendered and it did work. The next time I tried it on a table row that was being added and it did not work there. So I added an on after rendering function for the table and added that code there. That did not work until I added a delay (timeout) to do a context switch before calling the focus and that worked.
Once last thing though sometimes when I call focus on an input field (actually in a table row cell) if the field has text in it already the flashing cursor is at the beginning of the text and other times it is at the end of the text (which is the desired way). It depends on where I click in the row. Is there anyway to make sure the flashing cursor is at the end of the text when the focus is applied to a field that contains text? -
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 -
Input Field in table - I need a OnClick Event
Hello everybody,
I have the following problem:
I have created a table in my view which is filled at runtime. The table has 3 different rows and every row has TableSingleMarkableCells, these cells further have a input field as their celleditor.
I now want to know which cell the user is editing. I have a AttributePointer through which I know that at the time the user presses the enter key. But I need to know whether the focus has changed. Because there is the possibility that the user switches between the differnt cells with the arrow key or the tab key. But the AttributePointer only gives me the first selected cell.
Have anybody a suggestion to solve this problem - it seemed to be something like definingb a OnClick event for a input field (additionaly to the default OnEnter event...)
Best regards,
SebastianHi,
You can find out at which row the editing goes, by using
onLeadSelect action of TableUIElement.
in onLeadSelect action you can find row number using this statement
int rownumber= wdContext.node<TableNode>().getLeadSelection();
Regards
LakshmiNarayana -
How to link label with an input field in data table?
I am curious if there is a nice way to link a label to input field in a data table directly in JSP? Data filling the table are dynamically bounded.
Sample, simplified code below. Values of "label" property are unique in the collection binded to dataTable.
<?xml version="1.0" encoding="UTF-8"?>
<jsp:root version="1.2" xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:jsp="http://java.sun.com/JSP/Page">
<jsp:directive.page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8" />
<f:view>
<html>
<body>
<h:dataTable value="#{screen$monitoring$errorlog$CorrectHopper.dataset}" var="DATA_ROW">
<h:column>
<f:facet name="header">
<h:outputText value="Name" />
</f:facet>
<h:outputLabel value="#{DATA_ROW.label}" for="#{DATA_ROW.label}_id" />
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="Value" />
</f:facet>
<h:inputText value="#{DATA_ROW.label}" id="#{DATA_ROW.label}_id" />
</h:column>
</h:dataTable>
</body>
</html>
</f:view>
</jsp:root>
returns:
17:39:01,390 ERROR [[jsp]] Servlet.service() for servlet jsp threw exception
java.lang.IllegalArgumentException: #{DATA_ROW.label}_id
what is related to EL expression in h:inputText's "id" attribute.
Is there any other way to bind label with dynamically created input field in JSP? Do I really have to bind input field directly to component objects with "binding" and set IDs manually with setId() (what is ugly solution because it moves View related logic to Model layer)?I've thought of using EL because I have to somehow
link a label to an input field dynamically. Somehow? Dynamically? Just use plain text :)Well... just look at my code snippet (notice: we want to join the pairs of labels and text boxes placed in a datatable [or any other repeater-like component rendering properties of objects from a collection]):
<h:dataTable value="#{screen$monitoring$errorlog$CorrectHopper.dataset}" var="DATA_ROW">
<h:column>
<f:facet name="header">
<h:outputText value="Name" />
</f:facet>
<h:outputLabel value="#{DATA_ROW.label}" for="#{DATA_ROW.label}_id" />
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="Value" />
</f:facet>
<h:inputText value="#{DATA_ROW.label}" id="#{DATA_ROW.label}_id" />
</h:column>
</h:dataTable>
and what is your idea of using plain text as "id" attribute value in this case? :)
Regards,
Michal -
Pressing tab key within table not scrolling to next input field
Hi All,
I have a table with editable and read only fields. I have more than 20 columns. When the tab Key is pressed it scrolls only to the editable fields that are in the visible screen. It does not scroll the table to the right to the next input field.
However if I change the screen size so that the scroll bar is required for the browser then it will scroll across moving the browser scroll bar, moving the cursor to the input field that was not visible. Again it does not go further moving the scroll bar within the table to the next editable field to the right.
The table has been set to scrollable with the scrollable column count set to 8.
We are using explorer 8 on 7.01
Is it possible to have the tab key move from input field to input field scrolling the table to the next input field if it is not visible yet?
Thanks
BruceWhat you describe sounds like the correct functionality. If you set a scrollable column count, only the visble rows are actually rendered on the client side. When you use the horizontal scroll bar, you are triggering a server side event to retrive the next set of visible columns. Therefore the browser doesn't actually know anything about non-visible columns and hence the tab can't go to them.
When you increase the number of visible columns (or don't set anything for visible column) you render al the columns on the client side and use the browser scrolling. Therefore the tab works.
Maybe you are looking for
-
Unable to open RFC connection - Err message
I all I am trying to install SAP ERP 2004 SR1 on Microsoft Windows Server 2003, SQL Server 2000. I have successfully installed the Central Instance but when I try to install the Database instance after the database loading the following error is give
-
FOUND THE ANSWER!! Apparently when you plug your iPhone in to your computer, Windows will "sometimes" install the drivers as a camera, putting them in the wrong place. This is why it will pop up in Windows so you can take photos off, but iTunes can't
-
Installing iTunes 8.2.1 consistent error message.
Help needed please. Each time I try to reinstall iTunes 'Quick Time failed to intialise (error - 2096) Quick Time is required to run iTunes. Please uninstall iTunes then install iTunes again.
-
3 queries 3 tables and in a NON-relational DBMS
3 queries 3 tables and in a NON-relational DBMS i got this msg box error: Error prop_id is a invalid identifier. basically i have querying form a non rel_dbms. with this statement select a.case_nbr, a.Aplc_id from Tcase a , tloc b , tla_prop c where
-
I want to use top-of-page event in my program
Hi, I am using slis type pools.Can anyone describe me how to write the code to diaplay the top-of-page With Regards Ansuman Parhi