Dynamically bind input field

Hi all
I have input field and it already binded context attribute .I am working on enhancement frame work so I can not modify propety of context attribute.My requirement is to create new attribute and bind it with input field dynamically.
I am able to create context attribute and bind it to input field but it's not working ,can we do it dynamically????
Pls help
Regards Reeha

Hi,
if you already have a context attribute than you can do this, I just created a test application to create one input field and bind it with a context attribute dynamically.
my context is like this:
SUBS_TYPE_NODE   <------node name
-SUBS_TYPE_VALUE  <----node attribute type string
under WDDOMODIFYVIEW i did this:
if first_time = abap_true.
DATA:
    lr_container TYPE REF TO cl_wd_uielement_container,
   lr_input TYPE REF TO cl_wd_input_field.
get a pointer to the RootUIElementContainer
    lr_container ?= view->get_element( 'ROOTUIELEMENTCONTAINER' )
    lr_input = cl_wd_input_field=>new_input_field(
    bind_value = 'SUBS_TYPE_NODE.SUBS_TYPE_VALUE'  "notice here how I passed the node and its attribute
    id =   'INPUT_F1'
    view =  view ).
    cl_wd_matrix_data=>new_matrix_data( element = lr_input ).
    lr_container->add_child( lr_input ).
endif.
hope this helps...
AS.

Similar Messages

  • How to get the co-ordinates of a dynamically created input field

    Hello Frn's
    i have created a dynamic text view . but this text view is not appearing at proper position . I want palce it infront of a dynamically created input field . how can i do this ?
    as i am thinking ...i should first of all  get info about the co-ordinates of   dynamaclly creatd input field . and with respect to these co-ordinates ...set the position of  text View .
    Please suggest  your thoughts .
    Thanks and Regards
    Priyank Dixit

    Hi,
    There is no provision in WD for getting screen coordinates and then placing the UI element.
    You to add the UI element to layout editor and based on the layout type it will add the UI element to respective position.
    I would advice not to create dynamic UI elements( instead you can create them statically and then play with visibility status through context binding ). This will be more effective way and less error prone. This is also recommended practice.
    still,For dynamic creation you can refer to following wiki:
    http://wiki.sdn.sap.com/wiki/display/WDABAP/CreatingUIElementsDynamicallyinAbapWebdynpro+Application
    regards
    Manas Dua

  • 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
    Hemalatha

    Hi,
    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.

  • 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);

  • Dynamic Format Input Field

    Hi,
    I have a table and within an input field. Dependent of a flag I would like to set the format dynamically, concret the decimal places:
    row 1 -> no decimals
    row 2 -> decimals allowed
    row 3 -> no decimals
    row 4 -> no decimals
    row 5 -> decimals allowed
    It would be very usefull, that the conversion starts directly without clicking any button or doing any navigation.
    Thanks
    Best regards
    My actual idea: 2 attributes in context node. At runtime I bind the input field to attribute 1 or attribute 2
    But how?

    Stefan Kagelmacher wrote:
    Thanks for answering,
    >
    > this solution works not fine or I do not understand it correctly. I create a node within my node. This new node has supply function and an attribut "MENGE". But how should I format the value? The value of the input field is not moved in supply funktion, value is empty.
    You have to bind the "menge" to your inputfield . This will trigger a supply function. Supply function has parameters like parent and node.
    Get the values from the Parent attributes.. calculate them and set value for menge field.
    Supply function has template code already generated. You only have to modify them.

  • Bind input field value to a variable fails

    Business need : The user wants to re-evaluate lines by a percentage value which he fills via his BI-IP screen.
    I created an INPUT FIELD in WAD and I am trying to link a variable value (initially created in BI-IP through transaction RSPLAN)
    to this INPUT FIELD.
    Whenever I fill the input field with a value, the value is not being transferred to the variable.
    Please help how to bind an INPUT field value to a variable to be transmitted to a planning function.
    I have made many trials but in vain.
    Please help.

    Hi.
    I will present my scenario (it works in my system). From this scenario you may "cut" implementation for your scenario.
    Lets sat I have an input fileld item and I want to read value (in my case numeric value) and pass this value to any planning sequence.
    1. Create in Bex variable (in my case it is formula variable) lets say Z_INPUT_VAR
    2. In WAD, when you executin planning sequence (lets say by pressing button execute) in command EXEC_PLANNING_SEQUENCE_SIMPLE define data binding.
    When you clicked data binding->variable input MANUALY your variable name (Z_INPUT_VAR) in popup window.
    3. In variable type select (ITEM_INPUT) type
    4. In web item select your input field item.
    This way you will pass inputed value to vaariable and planning sequence.
    Then in planning function you also may use VARV() to read value of Z_INPUT_VAR variable.
    Regards.

  • Dynamic output & input fields in the table control

    HI Guys,
    How can one change the attribute of  input field to output field basically greying of field) dynamically
    based on the some flag. Loop at screen does not work. I need to change the attributes
    of field 'outfiled' and output field display only'.
    Any help is highly appreciated.
    Regards,
    Harsha

    Hi Harsha,
    I generated a table control (ERP 6.2) and somewhere I found the coding like this (the name of the table control is TABLE_CONTROL):
    *&spwizard: output module for tc 'TABLE_CONTROL'. do not change this lin
    *&spwizard: get lines of tablecontrol
    module TABLE_CONTROL_get_lines output.
      g_TABLE_CONTROL_lines = sy-loopc.
    If I do a loop at the screen at this place, I can control the individual input/output for the screen fields (the table fields). In my work area (WA_CONTROL) I can see the actual value of fields. Depending on this, I choose to enable/disable input via:
    loop at screen.
    if wa_control-material <> ' '.
    screen-input = '0'.
    modify screen.
    endif.
    endloop.

  • Dynamically editing input fields

    i would like to know if it is possible to insert or delete I/O fiels, labels on a screen at run time.
    Thanks,
    Mukesh.

    Hi,
    You can deactivate them at runtime
    Say P_MATNR is ur screen field name
    AT SELECTION SCREEN.
    loop at screen.
      if screen-name eq 'P_MATNR'.
         screen-active = 0.
         modify screen.
      endif.
    endloop.
    If it is module pool , then write the code in PBO

  • Add Dynamic Input field

    Hi...Experts am new in ABAP Webdynpro. Actually my application is Add Dynamic Input Field in webdynpro. Already One lable, one Input field is there and I add one more button. When I click that button Dynamically Adding same like existing lable and inputfield.Can anyone tel me how to resolve my problem.

    Hi..Yugesh
    U will try this,Definitly Ul get Answer.
    For Dynamically creating Attribute
    DATA : rootnode_info TYPE REF TO if_wd_context_node_info,
    dyn_node_info TYPE REF TO if_wd_context_node_info,
    dyn_node TYPE REF TO if_wd_context_node.
    DATA : dyn_attr_info TYPE wdr_context_attribute_info.
    dyn_attr_info-name = 'NAME'. Attribute Name
    dyn_attr_info-DEFAULT_VALUE = 'Prakash'. +Iam Setting Default value of attribute,u can change as per ur requirement +
    dyn_attr_info-type_name = 'ZDE_NAME' . Data Element(CHAR20) ( Type Of Attribute )
    rootnode_info = wd_context->get_node_info( ).
    CALL METHOD rootnode_info->add_attribute
    EXPORTING
    attribute_info = dyn_attr_info.
    This will create a attribute at run time...
    For Dynamically creating Input Field
    DATA lr_container TYPE REF TO cl_wd_uielement_container.
    DATA lr_input TYPE REF TO cl_wd_input_field.
    DATA lr_table TYPE REF TO cl_wd_table.
    DATA lo_nd_sflight TYPE REF TO if_wd_context_node.
    DATA lr_button TYPE REF TO cl_wd_button.
    DATA lr_grid_data TYPE REF TO cl_wd_grid_data.
    DATA lr_flow_data TYPE REF TO cl_wd_flow_data.
    DATA lr_matrix TYPE REF TO cl_wd_matrix_head_data.
    +Note : Before that change the Layout of ROOTUIELEMENTCONTAINER to MATRIX LAYOUT +
    navigate from <CONTEXT> to <SFLIGHT> via lead selection
    lr_container ?= view->get_element( 'ROOTUIELEMENTCONTAINER' ).
    CALL METHOD cl_wd_input_field=>new_input_field
    EXPORTING
    bind_value = 'NAME' + attribute which i created above+
    id = 'INPUT1'
    RECEIVING
    control = lr_input.
    lr_matrix = cl_wd_matrix_head_data=>new_matrix_head_data( lr_input ).
    lr_input->set_layout_data( lr_matrix ).
    CALL METHOD lr_container->add_child
    EXPORTING
    index = 1
    the_child = lr_input.
    ENDIF.
    Code it in WDDOMODIFYVIEW...

  • 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

  • I have no clue why I can't save to db if input field is empty?

    I have row generated according to the users input. But my problem is that let's say that the user leaves one input field empty. The whole row of data does not get saved into my database. Why is that so...? Is there any particular reason for this?
    Here's the code for the dynamically generated input fields.
    <%
         for (int i=1; i<=newNum; i++)
              out.println("<TR><TD>"+i+".</TD><TD><input type='TEXT' value='' name='model"+i+"' size='13'></TD><TD><input type='TEXT' value='' name='lquan"+i+"' size='5'></TD>");
              out.println("<TD><input type='TEXT' value='' name='insp"+i+"' size='6'></TD><TD><select name='rej"+i+"'><option value='Blow AAA'>AAA</option><option value='BBB'>BBB</option><option value='CCC'>CCC</option>");
              out.println("</select></TD><TD><select name='area"+i+"'><option value='A'>A</option><option value='B'>B</option><option value='C'>C</option></select></TD><TD><input type='TEXT' value='' name='loc"+i+"' size='6'></TD></TR>");
    %>I am using orion server and Mic. Access Database

    No i didn't. So. ..that's the problem is it. I will try it out and post another reply.
    Thank you Jerry Garcia

  • Simple input field

    quick question:
    How can I avoid upper case conversion when getting value from a simple input field?
    I binded input field to a node and when I get values from the node they are in upper case. I tried to look for alpha conversion field but I didn't see nothing like normal dynpro.
    thanks in advance
    Gabriele

    Hi Gabriele,
    Keep your attribute of type String...... this wont convert whole text in uppercase....
    regards
    Pranav

  • How to bind a specific attribute of an element to an input field

    HI,
    in my web shop application I create an overview page of the items dynamically in the wdDoModify Method. Each item has it's own transparent container. I do not use tables or row repeaters, because they did not fullfill my requirements.
    Now I have the problem to bind a specific attribute to an input field.
    I bind the value with following code:
    amountInput.bindValue(item.getAttributePointer("amount").getAttributeInfo())
    item is the element of the item to display. amount is the attribute with type integer.
    The problem is, that I have 4 Items on the screen. When I enter a value for amount, all amounts on the screen are the same. So I guess that the input field is not bound to the correct element.
    Has anybody an idea what I have done wrong? Or which string for bindValue do I have to use for example for an attribute of the 5th element in a node?
    Best regards,
    Peter

    Peter, you can set the context node to mutiple select, but you have to select it on item variable, like:
    item = wdContext.nodeXXX.getElementAt(1);
    amountInput.bindValue(item.getAttributePointer("amount").getAttributeInfo())
    item = wdContext.nodeXXX.getElementAt(2);
    amountInput2.bindValue(item.getAttributePointer("amount").getAttributeInfo())
    Regards,
    Edson Thomaz

  • 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 PM

    Can 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

  • Automatically fill input fields based on selection from dynamic drop down

    Hi All,
    I tried to search before posting, but i cannot find appropriate thread (maybe wrong keyword).
    My scenario:
    1. In my offline interactive form, I have:
        a.  Material Number --> drop down field with "Allow Custom Text Entry" ticked
        b.  1 execution button to call web service
        c.  Material Group - Input Field (Read Only)
    2. User will enter material number with wild card character (eg: ABC*).
        User will then click the execution button.
        Web Service in result will return all materials that match the entered material number.
        Dynamic binding will do the magic to generate the drop down list.
    3. Beside material number, web service will also return material description and material group.
        Below is the illustration:
         Material        Description       Material Group
         ABC              Material ABC               GRP01
         ABCDE        Material ABCDE          GRP02
    --- so far so good ---
    My requirement:
    Every time user select material from the drop down list, i want to auto-populate field "Material Group" (which value is also returned by web service).
    I know i need to put the script on event change of the drop down field.
    But i don't know how to read internal table returned by web service.
    Hope someone can enlighten me.
    Thanks in Advance !!!

    Solved after reading:
    1. /people/juergen.hauser2/blog/2007/09/03/accessing-data-nodes-in-sap-interactive-forms
    2. Chapter 7 of Live Cycle Designer Scripting Basics
    (http://help.adobe.com/en_US/livecycle/9.0/LiveCycle_Designer_Scripting_Basics.pdf)
    Thanks.

Maybe you are looking for

  • SAP DMS server installation Query

    Guys, I would like to share my plans on DMS server installation under DEV,Quality,prod stage and requesting you all to validate and send me any comments if I am wrong anywhere. -        We have 1 external DMS server of (250Gb capacity) -     We are n

  • My internal speaker no longer shows as an output option; has anyone experienced this?

    My internal speaker no longer shows as an output option; has anyone encountered this before?

  • HT204364 How can I find a photobook that has gone missing?

    I created a 70 page book that has disappeared! First it was stuttering in slideshow mode. I checked that the book was still fine in the gallery, it was all there.  I quit out of a bunch of programs including iphoto.  When I opened iphoto back up it s

  • Conversion program

    Hi Abapers, My requirement is to read an excel input file from PC and for a each pernr(personnel number) and check against infotype 2001-absences, and read other fields from excel, if it is valid record then i should update the nfotype 2001 with this

  • Shrink file (log) from within a procedure

    I'd like to incorporate the DBCC shrinkfile command to my maintenance procedure. This procedure gets called after I've finished my weekly importing process. I only need to shrink the log files as almost all the modifications are either a record updat