Dynamic Creation of input fields

Dear Guys,
I have a node name 'NodeA' with 10 attributes(a,b,c,d..j) in it.
When the add button is clicked , I want to display 10 inputfield for the 10 attributes of 'NODEA' to be dynamically created and displayed. so what coding should be written in the add buttons action....
Regards,
Shamila

Hi Shamila,
I have a context node by name NODE & it has 10 attributes like NODE_1, NODE_2,... NODE_10 under it. All these attributes are of type STRING. So you just have to put the below code into WDDOMODIFYVIEW to get 10 input fields & labels displayed. These input fields would show any string that you have maintained for each attribute using the "Default Value" property.
METHOD wddomodifyview .
  DATA :  lr_container TYPE REF TO cl_wd_uielement_container,
        lr_input_field TYPE REF TO cl_wd_input_field,
          lr_label TYPE REF TO cl_wd_label,
        lv_attribute_name TYPE string,
        lv_id TYPE string,
          lv_label_text TYPE string.
  CHECK first_time = abap_true.
  lr_container ?= view->get_root_element( ).
  cl_wd_matrix_layout=>new_matrix_layout( container = lr_container ).
  lr_container->set_width( value = '50%' ).
  DO 10 TIMES.
    MOVE sy-index TO: lv_attribute_name,
                  lv_id,
                      lv_label_text.
" Figuring out the context attribute name to bind to the input field
" Since the node name is NODE & attributes are like ATTR_1, ATTR_2..
" The value to be bound would be like NODE.ATTR_1, NODE.ATTR_2....
"  Am condensing the string finally to avoid any gaps in between coz it would lead to shortdump
    CONCATENATE 'NODE.ATTR_'
             lv_attribute_name INTO lv_attribute_name.
    CONDENSE lv_attribute_name NO-GAPS.            
" Figuring out a unique id to be used for assigning to the input fields
" Am assigning id's with values like IO_1, IO_2, ... IO_10
"  Am condensing the string finally to avoid any gaps in between coz it would lead to shortdump
    CONCATENATE 'IO_'
             lv_id INTO lv_id.
    CONDENSE lv_id NO-GAPS.
" Figuring out a unique text to be used for assigning to the label fields
" Am assigning text to labels like Label_1, Label_2, .. Label_10
"  Am condensing the string finally to avoid any gaps in between coz it would lead to shortdump
    CONCATENATE 'Label_'
                lv_label_text INTO lv_label_text.
    CONDENSE lv_label_text NO-GAPS.
    lr_input_field =   cl_wd_input_field=>new_input_field( id          = lv_id
                                           bind_value = lv_attribute_name ).
    lr_label = cl_wd_label=>new_label(  label_for  = lv_id
                                        text       = lv_label_text ).
    cl_wd_matrix_head_data=>new_matrix_head_data( element = lr_label ).
    cl_wd_matrix_data=>new_matrix_data( element = lr_input_field ).
    lr_container->add_child( the_child = lr_label ).
    lr_container->add_child( the_child = lr_input_field ).
    CLEAR: lv_attribute_name,
           lv_id,
           lv_label_text.
  ENDDO.
ENDMETHOD.
Regards,
Uday

Similar Messages

  • Dynamically Creation of  input field in webdynpro

    Hello Experts,
    I am new to webdynpro.
    I have a requirement to create the input filed dynamically for material.
    Requirement:- I have to button in my screen "+" and "-" button.
                          after execution  while i will click on + button one input filed should be created automatically and while i will clicik on
                          - button the newly creaed inputfield should be deleted from the screen.
    Coulld anybody help me on this.
    it would be great if somebody can share any solutin or sample code.
    Thanks in Adv...

    Hi Kiran,
    Jus to clarify on this: There might be situations, we don't know how many fields the user wants to create at runtime.
    Yes, OK, that does make sense and justifies the effort in this case, I agree with you.
    But in OP's case I think he only wants one field:
    after execution while i will click on + button one input filed should be created automatically and while i will clicik on
    Still, it does make sense to dynamically create them if there could be one up to X to keep the application slender.
    Cheers, Lukas

  • Dynamic enabling of input fields via radio btn in report selection screen?

    Hi there!
    I was wondering whether one can dynamically enable/disable input fields on a selection screen of a report-program.
    Or is this only possible for selection screens in dynpro-programs?
    If possible for reports - could you give an example?
    Thanx a lot.
    Andreas

    Hi,
    yes..You can dynamically disable and enable inputs fields in the selection screen..
    Check this ex..If you press the first radio button..The second input will be disabled...And vice versa..
    PARAMETERS: p_r1 RADIOBUTTON GROUP g1 USER-COMMAND usr DEFAULT 'X',
    p_r2 RADIOBUTTON GROUP g1.
    PARAMETERS: p_input1 TYPE matnr MODIF ID m1,
    p_input2 TYPE matnr MODIF ID m2.
    AT SELECTION-SCREEN OUTPUT.
    LOOP AT SCREEN.
    IF p_r1 = 'X'.
    IF screen-group1 = 'M2'.
    screen-input = '0'.
    ENDIF.
    ELSE.
    IF screen-group1 = 'M1'.
    screen-input = '0'.
    ENDIF.
    ENDIF.
    MODIFY SCREEN.
    ENDLOOP.
    Thanks,
    Naren

  • Dynamic filling of input fields in a table

    Hi,
    There are input fields in a two tables these are to be filled parallely at run time. the no of entries depend on the entires in internal table.
    If internal table has more entries, then a certain entries is filled up; say 9 times the control should be given to a new tables and the remaining entries should be filled in the input fields of other table .
    I appreciate help.

    Hi,
    Actually there is two HTML tables, each table has nine rows. if the no of entries in the internal table exceeds nine then the second table should be filled after the first HTML table has filled with all the nine entries.
    Both tables contains same input fields. How to fill both tables dynamically. I think now it makes sense.

  • Dynamically  Visibilty of Input Field in Interactive PDF Form

    Hi All,
    I want to bind the visibilty of Input Field dynamically in an Interactive PDF Form. How can I do ?
    Please give me some solution
    Regards
    Manish

    Manish,
    Well select the inputfield & check the Scripting Window in your Designer.
    On its top, you will see an option something as Show: Events with Scripts.
    Select the initialize event and insert the code she mentioned. Then click on + sign. This will enter your changes.
    There will be language option on top as well. Select JavaScript from it.
    So in the end your code should read something like this.
    ----- data.<YourFormName>.txtInput::initialize: - (JavaScript, client) ----------------------------------
    txtInput.presence = "invisible";
    Chintan

  • Flash Pro CC  dynamically create an input field problems?

    I dynamically created an input TextField and designated a TextFormat object that is a Thai Font. The difficulty I have is the superscript above the Thai letters will not display. These tone marks are cut off by the uppermost dimension of the field.
    The following is an example of the problem   "   นี้  "
    The tone mark "  ้  "does not display
    If there are multiple lines the tone marks are obscured by the line above.
    I have fooled around with carriage returns and RegExp as a work around but this is torture.
    Any ideas?
    thanks

    Thank you Rob for your help. The  leading property will add whatever space I require between lines. So  the response was helpful there. However it does not apply to the first line.I have worked around this by adding a  carriage return as the initial line of text. This is working for me

  • Digital Signature Turns Invalid while setting the Property Dynamically to an Input Field

    I have an Input box that turns mandatory only if a check box is clicked.
    The Script goes Something Like This;
    if(chkbox.rawValue === 1){
         inputField.mandatory = "error";
         inputField.mandatoryMessage = "This Field cannot be left Blank";
         inputField.presence = "visible";
    } else {
         inputField.mandatory = "disabled";
         inputField.mandatoryMessage = "";
         inputField.presence = "hidden";
    I am working with Assembler Service and the Signature field is placed in the cover page after which this form is attached.
    Any clue of why the property change Invalidates the Signature?
    Note: The stand alone form where the Check box and Input field is present doesnot have a preSign event as this form doesnot contain a Signature field unless its merged using assembler. This Script is added to the Click Event of the Checkbox.
    Cheers
    Mahesh Krishnan

    weblogic.common.resourcepool.ResourceDisabledException: Pool mds-soa is Suspended, cannot allocate resources to applications ..Check server logs to find out why mds-soa is suspended. Make sure that datasource mds-soa is up and running on SOA servrs before deploying an application.
    Regards,
    Anuj

  • Dynamic creation of input values

    Hi All,
    My Req is:
    FROM APPLICATION:- (drill down combo box)               TO APPLICATION:- (drill down combo box)
    the user selects an application from the list of the appset.Their respective dimensions needs to be displayed as prompts.
    eg:-
    appset: TEST
    app: FINANCE,RATE,LRATE,OWNERSHIP,TEST1
    then...
    FROM APPLICATION : FINANCE(from drop down box)    TO APPLICATON:-RATE(selects from dd)
    the corresponding dimensions must be displayed as prompts in th next page.say FINANCE has 5 dimensions,they have to be displayed in the next page as PROMPTS.
    How is it possible to get the dimensions for selected applications at run time? ,as we r selecting the applications from drop down box.
    dynamically at runtime.

    hi,
    i had given one example it will help you
    data: begin of itab_alv1 occurs 10,
              MAKTX like MAKT-MAKTX ,
              MATFI like MARA-MATFI ,
              MATNR like MARA-MATNR ,
              MFRPN like MARA-MFRPN ,
          END OF ITAB_ALV1.
    type-pools: slis.
    data: afield type slis_fieldcat_alv.
    DATA: fieldcat type slis_t_fieldcat_alv.
    clear afield.
    afield-col_pos = 1 .
    afield-fieldname = 'MAKTX'.
    *afield-seltext = ''.
    append afield to fieldcat.
    afield-col_pos = 2 .
    afield-fieldname = 'MATFI'.
    *afield-seltext = ''.
    append afield to fieldcat.
    select * from mara.
       select * from makt where
             matnr = mara-matnr.
           itab_alv1-matnr = mara-matnr.
           itab_alv1-maktx = makt-maktx.
           append itab_alv1.
       endselect.
    endselect.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
           IT_FIELDCAT = fieldcat
        Tables
           t_outtab = itab_alv1.

  • Dynamic input fields

    I need to dynamically generate the input fields based on the results returned from the query. How do I name each input fields differently.
    Eg:-)
    Say I have 5 rows returned from EMP table. I need to generate 5 input fields to change their names??
    How does the XSL script looks like??
    null

    First one - javascript good.
    Second one - take user to another page.
    [JavaBean and Servlet are not interchangable, JSP and Servlet are]

  • Flash Pro CC  Input field difficulties ?

    If I  dynamically create an input field and designate a TextFormat object that is a Thai font. The difficulty I have is that
    the superscript above the Thai letters will not display. They are cut off by the uppermost  dimension of the field .
    The following is an example of the problem     นี้
    The tone mark  "  ้ " does not display.
    I have been fooling around with carriage returns and RegExp  as a work around but this is  torture.
    Any Ideas?
    thanks

    Thank you Rob for your help. The  leading property will add whatever space I require between lines. So  the response was helpful there. However it does not apply to the first line.I have worked around this by adding a  carriage return as the initial line of text. This is working for me

  • Dynamic Input field creation - issue with bindValue in loop

    Hello,
    I am creating context node elements at runtime. My node looks like this -
    LocalNode
      Question
      Answer
    for(int i;i<wdContext.nodeLocalNode.size();i++)
    wdContext.nodeLocalNode().setLeadSelection(i);
      IWDTextView TV1 = (IWDTextView)view.createElement(IWDTextView.class,"TV"+i);
      TV1.setText(wdContext.currentLocalNodeElement().getQuestion());
       mainGrp.addChild(TV1);
       IWDInputField IP1 = (IWDInputField)view.createElement(IWDInputField.class,"TE"+i);                             
      IP1.bindValue("LocalNode.Answer");
       IP1.setValue(wdContext..currentLocalNodeElement().getAnswer());
       mainGrp.addChild(IP1);
    Please note: Question column is the textView and Answer column is the input field
    The output should be as follows-
    Question               Answer
    Header                  None
    How Many             7
    Comments             Maybe valid
    Do you agree        Yes
    Although the text view displays correctly, the input field only shows the last record value and the output currently displays as follows-
    Question               Answer
    Header                   Yes
    How Many             Yes
    Comments              Yes
    Do you agree         Yes
    What am I doing wrong here?
    How can I bind the corresponding values to the input field in a loop?
    Regards,
    Nisha

    Hi,
    Could you please provide the code .
    Regards,
    Sunil.

  • 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

  • F4 Help for a dynamic input field( class CL_DD_INPUT_ELEMENT)

    Hi all,
    I am programming a dynamic document which has several input fields on it. I want to program F4 helps for these fields, does anyone have an idea how I can do that?
    I have the idea to program a button(class CL_DD_BUTTON_ELEMENT) next to the input field and manually program an F4 help in the event handler of the button. But I do not know how I can handle pattern entries with '*' etc. in the input field. Is there a function module which could give me an F4 list(F4IF_INT_TABLE_VALUE_REQUEST could not be used, because it needs a dynpro field as a return field, which we do not have in this case).
    Kind Regards,
    Sükrü

    hi
    good
    SELECTION-SCREEN DYNAMIC SELECTIONS FOR NODE|TABLE node.
    allows you to define further nodes for dynamic selections. If the node has type T, you can use TABLE instead of NODE. The user can then decide at runtime the components of the node for which he or she wants to enter selections. Dynamic selections require special handling in the database program
    F4 HELP->
    AT SELECTION SCREEN ON VALUE REQUEST FOR P_SACHA.
        PERFORM VALUES_SACHA.
    THANKS
    MRUTYUN^

  • 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

  • How to create a dynamic entry list for an input field in VC(ce 7.1)

    Hello all,
    I have an Input field, i need to create a Dynamic Entry List for it in VC(ce 7.1).
    How can this be done.
    Thanks in Advance.
    Thanks and Regards,
    Santhosh Guptha N

    Hi Santhosh,
    You can define Dynamic entry list for Drop down list and combo box but not for input field.
    [Refer this|http://help.sap.com/saphelp_nwce10/helpdata/en/2a/28249060dd4dbc872f6266f4557364/frameset.htm] for defining entry list.
    Let me know if it helped.
    Regards,
    Dharmi

Maybe you are looking for

  • Issue in delta download through CI39

    Hi, Iam having an issue in CI39-Delta download of Network Activities to PDC system. When I release the Network from CRTD to REL,all the activities are getting download to PDC with CHANGED status. When I technically complete the Network,all the activi

  • Error 7 - Windows error 193

    Trying to download itunes and getting error 7 - windows error 193. What does this mean?

  • What to do if iphone stuck on logo

    how to rest my iphone if stuck on logo

  • X220 Windows 7 x64 Pro Blinking Cursor of Death

    Currently, when I start my X220 it won't boot to Windows 7. Instead, it just sits at a blinking cursor in the top-left hand corner. The keyboard is alive (i.e. I can get a response out of CapLock and NumLock).  Here is the tragedy of today, told in a

  • Wave reconstitu​tion

    Hello I am using a wave generator to simulate a 200 Hz wave and a NI acquisition board is used to acquire the signal. I think that according to Nyquist theorem, I must, at least, acquire at 2x the frequency of the wave. Thus, I'm acquiring, in contin