Creating Input and Button UI Element when doing an action

Dear All,
I have a requirement like this, initially i have one button in view, when i click on that button i need to add some group of input fields(say 10) and one button. can we achieve this? any code help pelase..
Thanks and Regards,
Venkat.

Hi,
first create two context attribute in the context
named flag and count
FLAG should be of type WDY_BOOLEAN.
COUNT should be of type INT1.
then just copy paste the code it will work .
Use the following code for creating 10 input fields and one button dynamically in one row.
write this code in wddomodify
DATA lo_el_context TYPE REF TO if_wd_context_element.
    DATA ls_context TYPE wd_this->element_context.
    DATA lv_flag LIKE ls_context-flag.
*   get element via lead selection
    lo_el_context = wd_context->get_element(  ).
*   get single attribute
    lo_el_context->get_attribute(
      EXPORTING
        name =  `FLAG`
      IMPORTING
        value = lv_flag ).
  DATA lv_count LIKE ls_context-count.
* get element via lead selection
  lo_el_context = wd_context->get_element(  ).
* get single attribute
  lo_el_context->get_attribute(
    EXPORTING
      name =  `COUNT`
    IMPORTING
      value = lv_count ).
if lv_flag = abap_true.
Data name1 type STRING value 'NODE'.
data COUNT1 type string.
data attr_name type string value 'ATTR'.
data indx type String.
data tr_name type STRING value 'TR'.
data inp_name type string value 'INP'.
count1 = lv_count.
concatenate name1 count1 into name1.
condense name1.
concatenate tr_name count1 into tr_name.
condense tr_name.
data: lr_container type ref to cl_wd_transparent_container.
data: lr_container1 type ref to cl_wd_transparent_container.
data: lr_flow_data type ref to cl_wd_flow_data.
data: lr_matrix type ref to cl_wd_matrix_head_data.
data: lr_matrix1 type ref to cl_wd_matrix_data.
data :lr_button type ref to cl_wd_button.
lr_container ?= view->get_element( 'ROOTUIELEMENTCONTAINER' ).
lr_button = cl_wd_button=>new_button( text = 'Add' on_action = 'CREATE' id = TR_NAME ).
data lo_node type ref to if_wd_context_node.
  data lo_node_child type ref to if_wd_context_node.
data lo_node_info type ref to if_wd_context_node_info.
data lo_childnode_info type ref to if_wd_context_node_info.
DATA EL TYPE REF TO IF_WD_CONTEXT_ELEMENT.
data bind_val type String.
lo_node_info = wd_context->get_node_info( ).
lo_node_info->ADD_NEW_CHILD_NODE( name = name1 ).
lo_node_child = wd_context->get_child_node( name = name1 ).
EL = LO_NODE_CHILD->CREATE_ELEMENT( ).
LO_NODE_CHILD->BIND_ELEMENT( EL ).
lo_childnode_info = lo_node_child->get_node_info( ).
do 10 times.
  data attr type WDR_CONTEXT_ATTRIBUTE_INFO.
  indx = sy-index.
  concatenate attr_name indx into attr_name.
  condense attr_name.
  attr-name = attr_name.
  attr-TYPE_NAME = 'STRING'.
lo_childnode_info->add_attribute( attr ).
concatenate name1 '.' attr_name into bind_val.
condense bind_val.
condense count1.
condense indx.
concatenate inp_name indx count1 into inp_name.
condense inp_name.
data lr_input type ref to CL_WD_INPUT_FIELD.
CALL METHOD CL_WD_INPUT_FIELD=>NEW_INPUT_FIELD
exporting
bind_value =  bind_val
id = inp_name
RECEIVING
CONTROL = lr_INPUT.
IF sy-index = 1.
lr_matrix = cl_wd_matrix_head_data=>new_matrix_head_data( lr_INPUT ).
lr_INPUT->set_layout_data( lr_matrix  ).
else.
lr_matrix1 = cl_wd_matrix_data=>new_matrix_data( lr_INPUT ).
lr_INPUT->set_layout_data( lr_matrix1  ).
endif.
lr_container->add_child( lr_INPUT ).
inp_name = 'INP'.
enddo.
lr_matrix1 = cl_wd_matrix_data=>new_matrix_data( lr_button ).
lr_button->set_layout_data( lr_matrix1  ).
lr_container->add_child( lr_button ).
* get element via lead selection
  lo_el_context = wd_context->get_element(  ).
* get single attribute
  lo_el_context->set_attribute(
    EXPORTING
      name =  `FLAG`
      value = abap_false ).
  endif.
create first button manually and give it an action named 'CREATE'
wirte the following code in the eventhandler of the first button.
DATA lo_el_context TYPE REF TO if_wd_context_element.
    DATA ls_context TYPE wd_this->element_context.
    DATA lv_flag LIKE ls_context-flag.
*   get element via lead selection
    lo_el_context = wd_context->get_element(  ).
*   get single attribute
    lo_el_context->set_attribute(
        name =  `FLAG`
        value = abap_true ).
  DATA lv_count LIKE ls_context-count.
* get element via lead selection
  lo_el_context = wd_context->get_element(  ).
* get single attribute
  lo_el_context->get_attribute(
    EXPORTING
      name =  `COUNT`
    IMPORTING
      value = lv_count ).
lv_count = lv_count + 1.
lo_el_context->set_attribute(
    EXPORTING
      name =  `COUNT`
      value = lv_count ).
let me know if you need further assistance
thanks
sarbjeet singh
Edited by: sarbjeet  singh on Jan 17, 2011 4:23 PM

Similar Messages

  • Binding input and Output node elements

    Hi all,
    Binding Input and Output nodes of a model node.
    Most of the time, we create a object of the input model node and then,
    bind that object with wdContext.
    Do we need to bind output node objects too in RFC Models?
    Regards
    Neha Singh

    Hi Neha,
    There is no need to create/bind the model node. you can execute a bapi using classes.
    To execute a bapi, you should do the following things.
    1. Import the RFC and create the model.
    2. Create an object of the input class of the bapi
    e.g. :
    Zbapi_Test_Input  commision_Input = new Zbapi_Testn_Input();
    3. Set the input
    commision_Input.setSpart(division);
    4. execute the bapi
    commision_Input.execute();
    5. Disconnect the model
    commision_Input.modelInstance().disconnectIfAlive();
    6. Get the output. Create an object for output class
    Zbapi_Test_Output output = commision_Input.getOutput();
    String commission = output.getCommision();
    Hope this helps you.

  • Defer log shipping and RMAN-08137 message when doing archivelog backup

    Hello,
    in a Primary & Dataguard scenario in which we set to DEFER the log shipping to the Dataguard during a high impact process done in the Primary, we receive the message "RMAN-08137: WARNING: archive log not deleted as it is still needed" when doing archive log backup with rman.
    Is it the expected behaviour due to the DEFER status with the Dataguard? or even in this scenario  we might we able to delete the logs and therefore we have to look more in deep to find our problem?
    Thanks in advance for your help.

    Hello,
    Had a look on v$archived_log and found the archivelogs that are not deleted and the state for them is
    DEST_ID=1 
    STANDBY_DEST=NO
    ARCHIVED=YES
    APPLIED=NO
    as http://docs.oracle.com/cd/B12037_01/server.101/b10755/dynviews_1015.htm says , they are all Local, were archived and there is no apply needed for them as they are not defined to go to the StandBy Database.
    Therefore, why can not still archive them?  How can we check if they had been processed by a Streams process?
    Regards

  • Can't create menu and shortcut in Win2003 when install Oracle9.2

    It can't create menu and shortcut in Windows server 2003 when install Oracle9.2.
    And show the error message.

    Several possible reasons.
    Start by describing exactly what you did, including user ids (or at least desctriptions of them) and the permission that those user ids have.
    And don't forget to detail which 'Windows 2003'. There are, as far as I know, several flavours of that product and there may be patches.
    95% of the effort here is to validate the assumptions - the more you tell, the fewer the assumptions.

  • Best way to print an image multiple times on same sheet and not lose quality when doing so

    Hello,
    I have the full subscription to Adobe Creative Suite, but am unfamiliar with almost all of the programs. I have used Photoshop a bit, but not too much.
    I have this project I do several times a year, and am sure there is a better way to do it.
    I am sent a colourful excel spreadsheet - a schedule. I print a bunch of copies full size, then need to print 8 copies on a single 8.5x11 piece of paper.
    I've tried several methods - but want to know what the best way to retain the best quality would be.
    The best I've done (and I'm not totally happy with) is to copy the image into Photoshop, save as a PDF, create 7 more copies then merge as a single PDF and print.
    I do find that the quality does suffer a bit.
    Can anyone suggest a better way?
    Thanks in advance.
    Amber

    With all the apps at your disposal, that is a long way around. Granted it is hard to not loose quality/data when scaling. But it makes sense to create the document to your liking, then create a new document that is 8.5" x 11" and place the original into it. Then using guides or alignment tools, duplicate that image.
    This allows you to have full control over the location of each image, and extra data needed like captions, names, etc. and how that data is formated.
    Luckily you have multiple programs that can accomplish this. Some are easier than others, some are more robust than others, etc. In the end it is what you are familar with and how much time you can spend on learning while getting the job done.
    Photoshop, Illustrator, Indesign are all your go to programs from creating anything for print and they can be used for other media as well. But that is their strong suite, print.
    All three apps have their own dedicated forum on this site, so go ahead and mark them as your favorites as your questions for each need to be in their respective place.
    http://forums.adobe.com/community/photoshop
    http://forums.adobe.com/community/illustrator
    http://forums.adobe.com/community/indesign

  • Missing and partially-missing elements when printing PDF's -- Problems began 3 days ago

    Source files and PDF's created from them are printing fine from Ai and PS, but the same Ai- and Ps-created PDF's opened in Acrobat Pro or preview app are not.  Elements are missing, some completely, some partially; half a word or half an image missing, or an image but no drop shadow and vis-versa.  Furthermore, what does and doesn't print changes with each printing attempt.
    Not sure what the problem is; it's not a matter of color profile of items or documents, missing links, outline vs. text, or even vector vs. raster.
    All attempts to print have been on digital printers, both here in our office and at a local print shop, with the same results.  Problem just started 3 days ago; can't find anything in forums and am not sure where to turn...

    You probably need to start by establishing whether your problem is before or after creation.
    To do that just open in Acrobat a file made before the problem started which you are SURE used to be good.
    - If it's still good, you have a problem with PDF creation
    - If it's gone bad you have a problem with PDF printing

  • ImageIcon moves and buttons don't when resizing!

    Hi,
    when i resize my applet window, ImageIcon (which i'm using as background) moves along with the applet window, so it stays in the center. The buttons don't. As a result the buttons end up in the wrong place in the applet window compared to the background.
    Does someone have a suggestion for me how to make the ImageIcon stay where it is?
    Here is a piece of my source code. If more is needed, let me know.
    static String imageFile = "kamer zonder kleppen.jpg";
    public Kamer() {
         Container contentPane = getContentPane();
         contentPane.setLayout(new BorderLayout());
         Dichtbutton = new JButton("Dicht");
         Dichtbutton.setBounds(230, 271, 46, 25);
         Dichtbutton.setMargin(new Insets(0, 0, 0, 0));
         Dichtbutton.addActionListener(this);          
         contentPane.add(Dichtbutton);
         picture = new JLabel(new ImageIcon(imageFile));
         picture.setBounds(0,0,800,600);
         contentPane.add(picture);
         setVisible(true);
    I hope someone can help me with this.

    hi, i notiested that you set yoour buttons to be in certain predefined place:
    Dichtbutton.setBounds(230, 271, 46, 25);
    if you would upon any resize event calculate new position, then you would not have the problem you're having right now.
    if you consult JButton's API then you find that there is inherited method from Component that allows you to set new location (setLocation()) for your button
    see following url, that should end after 'int)' not before it:
    http://java.sun.com/j2se/1.4.1/docs/api/java/awt/Component.html#setLocation(int, int)
    but if you would like this button to move without you to code any resize event listeners, then you should use some layout manager, these pack your components on some certain places and upon resize repack it where they think it is apropriate for them to be.
    L.

  • Photoshope Elements when selecting an action, the paint brush tool doesn't work and system keeps freezing, then catching up every 30-45 seconds

    I have been having this problem with elements ever since the last OS upgrade, but it wasn't all the time and it wasn't very bad. Now, I have upgraded my macbook again, and I cannot even edit a photo!! I open the photo, choose an action, say "smooth skin", then choose the paint brush, I start to "paint" over their face and it won't paint a line, I have to keep clicking it, click - it paints, move brush, click again - it paints. Plus, every time I choose a tool or an action, it freezes for about 10 seconds, then catches up to what I am doing, 30 seconds later, it freezes again. HELP!! I have 8 sessions to finish editing by this weekend!! I just want to cry!!

    Try deleting the prefs and the saved application state:
    A Reminder for Mac Folks upgrading to Yosemite | Barbara's Sort-of-Tech Blog

  • Creating class and returning the dataset when the proxy function is called

    Hello all,
    I am able to set the connection and call the function from .net. My requirement is all follow,
    I want to create a class in .net which will call this function and will return a dataset.
    That means when that class is called with the required parameter it should return a dataset.
    Can anyone can give the code or the steps how can i achieve it?

    You can either have an instance variable SoSession, if your seConnect() method is in the same class as the saveInterest() method, or pass in the SoSession object to the saveInterest() method.
    public class Sample{
        private SoSession session;
        public SoSession seConnect()
                SOApplication app = new SOApplication();
                SoSession se = SoSession.Authenticate(app.Database.Username, app.Database.Username);
                return se;
    public void saveInterest2()
                if (se != null) //Here i want to check on the returned se, but this is probably the wrong way ??, because it fails
                    System.out.println("Yeah' im still inn");
                else
                    System.out.println("Doo' im not  inn");
    } this way, the class calling the methods would do this:
    public class Test {
    public static void main(String [] args)
        Sample s = new Sample();
       s.seConnect();
       s.saveInterest();
    }~Tim
    Message was edited by:
    SomeoneElse

  • Sourcing and source of supply - when does it happen?

    Hi Experts,
    Can anybody tell me how the sourcing / source of supply assignment works in standard classic scenario?
    This is the situation;
    Classic scenario.
    Price and vendor (and maybe even info record nr) are known in the internal catalog.
    Is the standard process (not sure if standard is the right word ) that you would transfer the price and vendor to the shopping cart? (price is needed for approval)
    Or can you also source already in the SHC? And get the price directly from ECC info record?
    Or is this sourcing done in the PO and not yet in the SHC?
    Are there any best practices on this? (sourcing / assigning directly from backend can prevent difference between catalog price and change price in info recordu2026delta due to timing)
    Any ideas or setups on how you did it could be helpful, so please let me know.
    Thanks in advance.
    Kind regards,
    Marius Hartman

    Can anybody tell me how the sourcing / source of supply assignment works in standard classic scenario?
    This is the situation;
    Classic scenario.
    Price and vendor (and maybe even info record nr) are known in the internal catalog.
    Internal catalog is totally different. Sc can be created via catalog also.
    nowadayas you can transfer info record to MADM and you can utilise be specific what is your internal catalog.
    Q1:-Is the standard process (not sure if standard is the right word ) that you would transfer the price and vendor to the shopping cart? (price is needed for approval)
    A1:- so this purchase inforecord price or contract price will not be considereed for sc approval process via internal goods and services.
    Q2:- Or can you also source already in the SHC? And get the price directly from ECC info record?
    A2:- while creating PO sc takes that proce from info record and creates a PO with info record/ contract price .while ordering cart , sc just takes material price.
    Or is this sourcing done in the PO and not yet in the SHC?
    PO will be created by the purchaser after assigning the vendor ,
    Are there any best practices on this? (sourcing / assigning directly from backend can prevent difference between catalog price and change price in info recordu2026delta due to timing).
    you can not change inforecord price in srm via sc.
    br
    muthu
    for materials valuation price is shown as sc price .

  • I just upgraded to 10...and now links and buttons black out when my cursor moves over them, and my entire window goes black whenever I scroll.

    I just upgraded to Firefox 10 and had to go back to 3.6 because 10 doesn't seem to work on my computer. I have a windows 7 pc. After upgrading, whenever I moved my cursor over a button or link, that link blanks out or a black bock appears over it. Additionally, whenever I try to scroll, the entire window goes black until I stop scrolling.

    Hi Nester88,
    I'd try starting Firefox in [[Safe Mode]]. If you don't have the issue while all of your add-ons, extensions, and themes are disabled, you can try adding them back in one by one until you find the culprit.
    Hopefully this helps!

  • Action on hyperlink keeps getting called when doing other actions

    Hello.
    I have a jsf application created mostly with visual web pack, but with some custom code added. I have a table where one of the columns contains a hyperlink, which I created a custom action for. This action gets an HttpServletResponse and write urls to it with content type "audio/x-mpegurl".
    Once this action has been called, any attempt to click on another link which calls this action will call the action twice. A third link click will cause it to be called three times. Any attempt to use a search button on the screen, or a table reorder link, will cause the action to be called (the number of times it was called from the last link click).
    Is there some method I need to be called in order to clear something out?
    Thanks in advance, and here's the code.
    First the action
        public String recordingHyperlink_action() {
            try {
                String url;
                List<WarehouseQuestion> questions = null;
                Boolean isFullCase;
                isFullCase = getSessionBean1().isIsFullCall();
                log.debug("url is" + FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().get("url"));
                if (FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().get("url") == null) {
                    url = null;
                } else {
                    url = (String) FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().get("url");
                if (isFullCase && url != null) {
                    if (getSessionBean1().getKludgeKeyToDetail() != null) {
                        log.debug("In hyperlink action, getting key from url: " + url);
                        WarehouseDetail wd = getSessionBean1().getKludgeKeyToDetail().get(url);
                        if (wd != null) {
                            questions = wd.getQuestions();
                        } else {
                            log.error("warehouseDetail is null in hyperlink action but want full case is true");
                    } else {
                        log.error("keyToDetail is null, but want full case is true... should be no results");
                getApplicationBean1().returnRecording(questions,url,isFullCase);
            } catch (IOException ex) {
                log.error("Error in hyperlink action for playing recording", ex);
            return null;
        }Then the writing to the response.
        public void returnRecording(List<WarehouseQuestion> questions, String url, Boolean isFullCall) throws IOException {
            ExternalContext econtext = getExternalContext();
            HttpServletResponse response = (HttpServletResponse) econtext.getResponse();
            ServletOutputStream sos = null;
            FacesContext fcontext = FacesContext.getCurrentInstance();
            try {
                sos = response.getOutputStream();
                if (isFullCall == null || isFullCall == false) {
                    response.setContentType("audio/x-mpegurl");
                    try {
                        sos.println(url);
                    } catch (IOException ex) {
                        log.error("Error adding url to response: " + url, ex);
                } else {
                    response.setContentType("audio/x-mpegurl");
                    if (questions != null) {
                        for (WarehouseQuestion wq : questions) {
                            try {
                                sos.println(wq.getUrl());
                            } catch (IOException ex) {
                                log.error("Error adding url to playlist: " + wq.getUrl(), ex);
                    } else {
                        log.error("returning playlist, questions is NULL!");
                sos.close();
            } catch (IOException ex) {
                log.error("Error setting output stream to response: " + url, ex);
            fcontext.responseComplete();
        }Sorry for the messy code, and thanks in advance for any help, this is really driving me nuts!

    How odd.. this works as intended when called from a button with a static url, but now I can't access the param in the button, which I could in the hyperlink. Here's the jsp code for the two.
    <ui:tableColumn binding="#{resultsPage.tableColumn7}" headerText="Recording" id="tableColumn7" sort="questionName">
        <ui:hyperlink action="#{resultsPage.recordingHyperlink_action}" binding="#{resultsPage.recordingHyperlink}"
                      id="recordingHyperlink" immediate="true" text="#{currentRow.value['questionName']}">
            <!--<f:param name="studyNumber" value="#{currentRow.value['studyNumber']}"/>
            <f:param name="formName" value="#{currentRow.value['formName']}"/>
            <f:param name="caseNumber" value="#{currentRow.value['caseNumber']}"/>
            <f:param name="attempt" value="#{currentRow.value['attempt']}"/>
            <f:param name="date" value="#{currentRow.value['date']}"/>-->
            <f:param name="url" value="#{currentRow.value['url']}"/>
        </ui:hyperlink>
        <ui:button action="#{resultsPage.recordingHyperlink_action}" binding="#{resultsPage.playRecordingButton}" escape="false"
                   id="playRecordingButton" mini="true" text="Play">
            <f:param name="url" value="#{currentRow.value['url']}"/>
        </ui:button>   
    </ui:tableColumn>

  • Flash element panel does not appear when Flash is selected in DW3

    In DW3 (Win7) After creating several slide shows using image viewer and months later when I want to edit the image viewer.. When I click on the flash slideshow that I created in image viewer in order to edit it and the Flash Elements panel does not appear on the right as it did before. I have the Tags panel open and it has changed to Flash elements in the past but it is no longer appearing. This happened with a friends DW3 also.

    DW3 or DW CS3?

  • Problem creating inputs, outputs and text in Scilab Script Block

    I have recently installed the Labview to Scilab Gateway.  I am running Labview 11.0 and Scilab 5.3.3.  The example files run properly, However, when I try to define any inputs, or outputs, there is no option to add the ports.  The block also ignores any text I type in it or copy to it.  I have been trying this on a blank vi.
    Solved!
    Go to Solution.

    Hi Ronny,
    I have a few more questions to help us debug this issue.  You said you tried the same right-click procedure to create inputs and outputs on a normal script block and it worked as expected.  What specifically do you mean by a "normal script block"?
    How did you drop the empty Scilab script node on a blank VI?  Did you drop it from a palette or paste it from another VI?
    Can you post an image of your Help >> About LabVIEW screen (feel free to obscure your name, company, and license number)?  If not, can you provide the LabVIEW version number specified from that screen?  There have been a few patches to LabVIEW 2011 and it will help us to reproduce the issue if we know exactly which version you have.  Also on that screen, do you have LabVIEW Base, Full, or Professional (or maybe an Evaluation or Student edition)?  The Scilab script node will not work in LabVIEW Base and the right-click menu will look as you describe.  You can verify your LabVIEW activation in the NI License Manager.
    Do you have any other versions of LabVIEW installed on your computer?  Is LabVIEW 2011 the most recent LabVIEW you installed?  How about previous versions of Scilab?  Do any previous versions remain or did you remove a previous version of Scilab AFTER installing Scilab 5.3.3?
    Grant M.
    Senior Software Engineer | LabVIEW Tablets | National Instruments

  • HT201401 When I press the + and - buttons, the volume icon appears, but the slider is empty. When I receive a call, I hear it ring, and I can hear the ringtones in the sound menu. However, the message/mail notifications don't make any noise, and I can't h

    When I press the + and - buttons, the volume icon appears, but the slider is empty. When I receive a call, I hear it ring, and I can hear the ringtones in the sound menu. However, the message/mail notifications don't make any noise, and I can't hear the sound menu.
    - During a phone call, if I put the conversation on speakers ==> it works and the volume bar reappears. I can control the volume with + and - buttons. But when the conversation is over, the bar disappears again.
    - With the headphones, everything is ok!
    - I also noticed (only a few times) that when I do a silent to ringer mode, the volume slider reappears and works correctly during 2 or 3 seconds, before disappearing again.
    I don't know what is problem,because the speakers work.

    Hello jam5064,
    We've an article which provides tips that can help get your iPhone working correctly.
    iPhone: No sound or distorted sound from speaker
    http://support.apple.com/kb/TS5180
    Cheers,
    Allen

Maybe you are looking for