Generate a dynamic Transparent container in WD

Hi all,
i' ve created a Transparent conatiner in where i will write my text, i also created a Button (ADD)
what i want now is, after clicking on the (Add) Button, a new Transparent container will appear, 
how can' I do this dynamically??  i dont want to create 10 or 20 transparent container in my main view, i want to create  only one, and after clicking on the Add Button, an other one will appears,
is there a way or any method to do this?
thank you all for your help

Hello Thomas,
You could refer the below thread. [thread|Re: How to dynamically generate a transparent container ?]
all the code required to do things dynamically has to be inside wddomodifyview method of that particular view.
Since you want that on a click of a button you would like to add a new transparent container, you could create a varible of type wdy_boolean under attributes tab of the view and onaction associated with the button you change that value and you write the code for transparent container in wddomodifyview, and before that could you could have a if statement if variable value is true you would run the below code.
Regards
Anurag Chopra

Similar Messages

  • Dynamic Transparent Container

    Hi,
    I am new to Web Dynpro. I have the following problem.
    How to set Streched horizontal property in Transparent Container dynamically?
    Thanks,
    Peter,

    hi
    hope it will be very helpful
    IWDTransparentContainer transNew=(IWDTransparentContainer)view.createElement(IWDTransparentContainer.class,"TranName");
    transNew.createLayout(IWDMatrixLayout.class);
    transNew.destroyAllChildren();
    IWDMatrixLayout gl=(IWDMatrixLayout)transNew.createLayout(IWDMatrixLayout.class);
    gl.setStretchedHorizontally(false);
    gl.setStretchedVertcally(false);
    if you give gl.setStretchedVertcally(false);
    it will be very compact structure in your view
    Regards
    Dhinakar J

  • Short dump while creating transparent container dynamically

    Hi experts!
    I want to create a transparent container dynamically, but I get a Short Dump (
    Note
    The following error text was processed in the system NSP : Access via 'NULL' object reference not possible.
    The error occurred on the application server Datatrain_NSP_00 and in the work process 0 .
    The termination type was: RABAX_STATE
    The ABAP call stack was:
    Method: CREATE_BY_VIEW_ELEMENT of program CL_WDR_VIEW_ELEMENT_ADAPTER===CP)
    while doing so. Below my code...
    Can somebody please advise I don't know what I did wrong....
    Thanks in advance!
    Points will be rewarded
    METHOD wddomodifyview .
    DATA: lr_container TYPE REF TO cl_wd_uielement_container,
            lr_matrix_head TYPE REF TO cl_wd_matrix_data,
            lv_hlp_str TYPE string VALUE 'DYNCONT_1',
            lr_trans_cont TYPE REF TO cl_wd_transparent_container.
        lr_container ?= view->get_element( 'ROOTUIELEMENTCONTAINER' ).
    CALL METHOD cl_wd_transparent_container=>new_transparent_container
      EXPORTING
        enabled                  = ABAP_TRUE
        id                       = lv_hlp_str
        is_layout_container      = ABAP_TRUE
      receiving
        control                  = lr_trans_cont
        lr_matrix_head = cl_wd_matrix_head_data=>new_matrix_head_data(
                            element = lr_trans_cont ).
        lr_trans_cont->set_layout_data( lr_matrix_head ).
        lr_container->add_child( lr_trans_cont ).

    Hi Felix,
    You need to set the layout first and then set the layout data. Use the method cl_wd_matrix_layout=>new_matrix_layout. Do a set_layout on the container and then do set_layout_data. That should solve your problem.
    Regards
    Nithya

  • Dynamic Programming: Adding Transparent Container to Root Element

    Hi,
    I simply am adding a Transparent Container to the Root Element dynamically and I am getting the error "The ASSERT condition was violated".
    Does anyone have an idea what the problem is.
    Below is my VERY MUCH simplified code:
    method WDDOMODIFYVIEW .
      DATA:
        LR_ROOT TYPE REF TO CL_WD_UIELEMENT_CONTAINER,
        LR_TCONTAINER TYPE REF TO CL_WD_TRANSPARENT_CONTAINER,
        LR_FLOW_DATA TYPE REF TO CL_WD_FLOW_DATA.
      LR_ROOT ?= VIEW->GET_ROOT_ELEMENT( ).
      LR_TCONTAINER = CL_WD_TRANSPARENT_CONTAINER=>NEW_TRANSPARENT_CONTAINER(
        id = 'TCONTAINER_01' ).
      LR_FLOW_DATA = CL_WD_FLOW_DATA=>NEW_FLOW_DATA( LR_TCONTAINER ).
      LR_TCONTAINER->SET_LAYOUT_DATA( LR_FLOW_DATA ).
      LR_ROOT->ADD_CHILD( LR_TCONTAINER ).
    endmethod.

    Found the answer on this link:
    Creating dynamic tranparent container

  • Add a Transparent Container dynamically in wddomodifyview

    Hi All,
    I have added UI Elements to views before. Now, I am trying to add a Transparent Container to a Group, which does not work. I am using the same procedure as I have used it for other UI Elements before, but I keep receiving the dump:
    The following error text was processed in the system JIL : Access via 'NULL' object reference not possible.
    The error occurred on the application server SV-SAP-2_JIL_01 and in the work process 0 .
    The termination type was: RABAX_STATE
    The ABAP call stack was:
    Method: CREATE_NW7_BY_VIEW_ELEMENT of program CL_NW7_VIEW_ELEMENT_ADAPTER===CP
    My code is as follows:
    lo_group ?= view->get_element( 'GROUP' ).
        lo_tc = cl_wd_transparent_container=>new_transparent_container( id = 'TC_SECOND_ELEMENT' ).
        cl_wd_matrix_head_data=>new_matrix_head_data( element = lo_tc ).
        lo_group->add_child( the_child = lo_tc ).
    Why does the coding above not work?? How is the proper coding to add a Transparent Container to my group?
    THANKS, Johannes

    Hi,
    Your coding seems to me fine. Though i am not sure if this line causes the error.
    cl_wd_matrix_head_data=>new_matrix_head_data( element = lo_tc ).
    I normally get this error when the UI element property is not binded correctly. How sure are you that this error is coming  because of this TransparentContainer ?.
    You can comment out the whole and check if this is working.
    Then enable one by one and see if you get it worked.

  • Dynamic programming: Add transparent container to root container

    Hi all,
    I'm trying to add a transparent container to the root container,
    but I´m getting this error: 'ASSERT condition was violated'
    METHOD WDDOMODIFYVIEW .
      DATA: LR_ROOT       TYPE REF TO CL_WD_UIELEMENT_CONTAINER,
            LR_TCONTAINER TYPE REF TO CL_WD_TRANSPARENT_CONTAINER.
      LR_ROOT ?= VIEW->GET_ROOT_ELEMENT( ).
      LR_TCONTAINER = CL_WD_TRANSPARENT_CONTAINER=>NEW_TRANSPARENT_CONTAINER( ).
      CL_WD_FLOW_DATA=>NEW_FLOW_DATA( LR_TCONTAINER ).
      LR_ROOT->ADD_CHILD( LR_TCONTAINER ).
    ENDMETHOD.
    Is something wrong with this code?
    Thank you.
    Regards,
    Thomas

    >
    Giscard Rous wrote:
    > I have the same problem.
    > I am getting the error "The ASSERT condition was violated".
    >
    > I have reduced my code to just simply add a transparent container to the rootuielement and I am getting the error.
    >
    > I could not figure out why.  Does anyone have info on this?  Thanks.
    >
    > Giscard
    My problem was the layout, after I added it, the problem was solved.
    METHOD WDDOMODIFYVIEW .
      DATA: LR_ROOT       TYPE REF TO CL_WD_UIELEMENT_CONTAINER,
                 LR_TCONTAINER TYPE REF TO CL_WD_TRANSPARENT_CONTAINER.
      LR_ROOT ?= VIEW->GET_ROOT_ELEMENT( ).
      LR_TCONTAINER = CL_WD_TRANSPARENT_CONTAINER=>NEW_TRANSPARENT_CONTAINER( ).
      CL_WD_FLOW_DATA=>NEW_FLOW_DATA( LR_TCONTAINER ).
      CL_WD_FLOW_LAYOUT=>NEW_FLOW_LAYOUT( LR_TCONTAINER ).
      LR_ROOT->ADD_CHILD( LR_TCONTAINER ).
    ENDMETHOD.
    Hope it helps you.
    Regards,
    Thomas

  • ABAP: Dynamic creation of transparent container

    Hello,
    I have this code and it fails (null pointer exception):
    transparent_container = cl_wd_transparent_container=>new_transparent_container( ).
      cl_wd_grid_data=>new_grid_data( element = transparent_container ).
      ui_container->add_child( transparent_container ).
    What is the problem? Do I need to create transparent container and pass some parameters?
    Thank you.

    Hello Armin,
    yes it is.
    I have some code like this:
      "create a transparent container
      transparent_container = cl_wd_transparent_container=>new_transparent_container( ).
      cl_wd_grid_data=>new_grid_data( element = transparent_container ).
      ui_container->add_child( transparent_container ).
      "create a dropDown with figures
      drop_down_figure = cl_wd_dropdown_by_key=>new_dropdown_by_key( bind_selected_key = 'REPOSITORY.FIGURES' on_select = 'GET_OPERATOR' ).
      cl_wd_grid_data=>new_grid_data( element = drop_down_figure ).
      ui_container->add_child( drop_down_figure ).
    If I comment out code where I create transparent container it works fine and creates dropDown.
    However, as soon as I add transparent container I get NullPointer exception.
    Thank you.

  • Transparent Container Cell Background design

    Hi All,
    I have a scenario where in on click of a link, I'm needed to highlight a transparent container. In Webdynpro JAVA i used to achieve this using Transparent Container -> cellBackGroundDesign -> WDCellBackgroundDesign.BORDER
    What is the equivalent of this in WD ABAP. I do not find any such attribute in particular.
    Any pointers on this will be of great help.
    Thanks & Regards,
    Gayathri Shanbhag

    Hi All
    On switching from flow to matrix layout I found the property cellBackGroundDesign, but it is not bindable to an attribute, in my scenario I'm needed to set the border/highlight dynamically. Please suggest if there is an alternative.
    Thanks & Regards,
    Gayathri Shanbhag

  • Move transparent container from tab to new view

    Hi
    I have a scenario where I wish to move the whole layout structure from a tab to a new view.
    Essentially I want to move from a tabstrip to a roadmap type of development.  My issue is that if I copy the transparent container that houses the whole structure, when I paste the structure all my elements have _CP. Is there any way to paste without have this suffix?
    Cheers
    Ian

    >
    Thomas Jung wrote:
    > I can't think of any offical way of doing this. 
    >
    > I have one suggestion - but it is totally not supported by SAP and if anyone asks you didn't get it from me.
    > You could use SAPLink to export the component to XML.  Once in XML on your desktop, use a text editor to do a mass find and replace.  Then reimport the same object back into your system via SAPLink.
    > [http://code.google.com/p/saplink/|http://code.google.com/p/saplink/]
    >
    > Just curious however - why worry about the _CP on the UI elements at all?  It is just that you don't like the prefix?  I agree it makes things look messy, but if you are correcting binding UI to your context instead of directly coding against the UI elements (with the rare exception of really dynamic stuff) the IDs of the element shouldn't break anything in your application.
    PS:  Obviously monkeying around with the component using find and replace on the XML and importing via SAPLink could be dangerous. I just thought after I posted I should stress the warning a little more.  You probably want to copy your entire component before attempting this - just incase it completely screws things up.

  • How to hide a transparent container and its fields in webdynpro abap

    Hello Friends,
    I am trying to create a view where i want to show some fields based on some other field.
    What i exactly need is When i enter some data in 1 input field .
    Corresponding to that input field few text fields wud be opened automatically in the same view.
    No Pop-ups allowed.
    What i am doing is !!
    i have created another Transparent container for my  text view fields.
    But i  am unable to hide this fields..
    Kindly help..
    At the runtime..
    After entering the value in the input field..
    This transparent container should become visible with the textview fields...
    Gaur Mayank

    Hi,
    Create A Context Attribute (Say  Visible_Hide )of Type WDUI_VISIBILITY with initial value as 01.
    Goto your Container, Bind the Visible Property with Above Created Attribute(Visible_Hide).
    In the Input Field,Use the OnEnter Event and Set the Value to Visible_Hide as 02.
    Then the Container will be Visible.
    Thaks.
    Uma

  • How to generate a dynamic selection-screen

    Hi folks,
    I have a itab with all fields and descriptions of a database-table. Now i want to generate a selection screen dynamically. I want to create a select-option for every field of the table.
    First I read all fields of a database table into my intern table:
    CALL FUNCTION 'DDIF_FIELDINFO_GET'
      EXPORTING
        tabname              = 'database_tabname'
      TABLES
        dfies_tab            = it_tabname_fields.
    Then I tried to generate a dynamic selection-screen with a select-options statement per field of the itab, but it doesn't work:
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001 NO INTERVALS.
    LOOP AT it_tabname_fields INTO s_tabname_fields. "should be 14 loops and 14 lines
      SELECTION-SCREEN BEGIN OF LINE.
      SELECTION-SCREEN COMMENT (25) s_tabname_fields-SCRTEXT_S FOR FIELD var1. "the name of the field should be set dynamically from the itab
      SELECT-OPTIONS var1 FOR tabname-s_tabname_fields-fieldname. "s_tabname_fields-fieldname should be set dynamically for each line
      SELECTION-SCREEN END OF LINE.
    ENDLOOP.
    SELECTION-SCREEN END OF BLOCK b2.
    I know that this doesn't work but it should help you to understand what i want to do. It doesn't create more than one select-option (it should be 14 because there are 14 lines in the table) and it doesn't get the values from the table.
    I hope you can help me...
    Regards,
    Sebastian

    hi
    Firstly, have a look at the following code to see how this can be implemented -
    REPORT ZTEST.
    perform test.
    class test definition.
      public section.
        methods: create_screen.
    endclass.
    class test implementation.
      method create_screen.
        data:  report_line(72),
               report_source like table of report_line.
        data: err_message(240),
              err_line type i,
              err_word(100).
        report_line = 'REPORT TEST.'.
        append report_line to report_source.
        report_line = 'PARAMETERS: P_TEST TYPE I.'.
        append report_line to report_source.
        report_line = 'START-OF-SELECTION.'.
        append report_line to report_source.
        report_line = 'WRITE : P_TEST.'.
        append report_line to report_source.
        syntax-check for report_source message err_message
                                       line    err_line
                                       word    err_word.
        if err_message is initial.
          INSERT REPORT 'ZZZTESTZZZ' FROM REPORT_SOURCE.
          SUBMIT ZZZTESTZZZ VIA SELECTION-SCREEN AND RETURN.
        endif.
      endmethod.
    endclass.
    form test.
      data test type ref to test.
      CREATE OBJECT TEST.
      call method test->create_screen.
    endform.
    As you can see, the report is being written dynamically. Once the INSERT REPORT statement is executed, the program is available. you can you external subroutine calls to pass the data between the programs now.
    Regards,
    ravish
    <b>plz dont forget to reward points if helpful</b>

  • Possible to generate graphics dynamically using ABAP?

    Hello friends,
    It is possible to generate graphics dynamically using ABAP as programming language? In the same line like SVG (Scalable Vector Graphics) or ChartDirector?
    Output of this abap program should be a picture.
    Daniel

    Hi Daniel,
    Have a look at URL
    http://help.sap.com/saphelp_nw04/helpdata/en/0c/5c55a8d0a611d2963100a0c9308b1f/content.htm
    Also have a look at SGRB Package/deveoplment class.
    Thanks
    Lakshman
    Message was edited by: Lakshman Tandra

  • How to generate a dynamic ALV

    give me some points on how  to generate the dynamic Alv using RTTS and why it is useful to generate this way

    Hi ,
    Please follow this link
    RTTS question
    problem with coloring cells in dynamic fieldcatalog
    Regards,
    Pravin

  • Creating dynamic tranparent container

    Hi,
    I have to create a dynamic tranparent container, i have added the following code , but it gives dump.
    Error : The following error text was processed in the system SCC : The ASSERT condition was violated in Screen.
    Kindly help.
    Code:
    *Create container
      DATA: lr_container1            TYPE REF TO cl_wd_uielement_container,
            lr_tranparent_container  TYPE REF TO cl_wd_transparent_container,
            lr_flow_data_tc          TYPE REF TO cl_wd_flow_data.
      lr_tranparent_container = cl_wd_transparent_container=>new_transparent_container(
           height                   = '10'
           width                    = '20'
           id                       = 'TEST'
      lr_flow_data_tc  =  cl_wd_flow_data=>new_flow_data( element = lr_tranparent_container  ).
      lr_container1 ?= view->get_element( 'ROOTUIELEMENTCONTAINER' ).
      lr_container1->add_child( lr_tranparent_container ).

    Hi,
    I guess that you are getting the dump coz you have missed out on specifying 1 of the layout properties. If the UI element that you are adding on to your layout is a normal element then you need to just fill its LayoutData property. But however if the UI element is a container element (like a Group, TransparentContainer, Tray...) then you need to specify 2 properties:
    Layout & LayoutData
    The property which you specify for the Layout would be inherited by all UI elements that you would embed within your container element.
    Check the code fragment below in which I am dynamically creating a TransparentContainer & embedding a Caption within it. You can try paste it inside your WDDOMODIFYVIEW method & check the results.
    METHOD wddomodifyview .
      DATA: lr_root_container TYPE REF TO cl_wd_transparent_container,
            lr_trans_container TYPE REF TO cl_wd_transparent_container,
            lr_caption TYPE REF TO cl_wd_caption.
      lr_root_container ?= view->get_root_element( ).
      lr_trans_container ?= cl_wd_transparent_container=>new_transparent_container( ).
    "*** Since you are creating an element of type container. You need to specify 2 layout properties:
    "*** Layout & LayoutData. Layout specifies as to how the layout property which would be inherited by
    "*** any elements that are embedded within this container. Whereas LayoutData controls whether the element
    "*** should appear in the same line or next line. This is useful in layouts like Matrix layout.
      cl_wd_flow_layout=>new_flow_layout( container = lr_trans_container ).
      cl_wd_flow_data=>new_flow_data( element = lr_trans_container ).
      lr_caption ?= cl_wd_caption=>new_caption( text = 'This is my caption!' ).
      cl_wd_flow_data=>new_flow_data( element = lr_caption ).
    "*** Embed the created caption within our TransparentContainer
      lr_trans_container->add_child( the_child = lr_caption ).
    "*** Add the created TransparentContainer as a child of ROOTUIELEMENTCONTAINER
      lr_root_container->add_child( the_child = lr_trans_container ).
    ENDMETHOD.

  • Programatically hide a transparent container

    Hi Experts,
    i am using select options in my application.
    i have made two block for the selec options (transparent container 1 and transparent container 2) by using add_block method of select option.So i cant do the normal context binding as containers are created programatically.
    Now i have a requirement to hide one of the block on click of an event so that the select options inside is also hidden.
    DATA lo_ui_element      type ref to CL_WD_UIELEMENT.
          DATA lo_container       TYPE REF TO cl_wd_uielement_container.
          DATA lo_transc           TYPE REF TO cl_wd_view_element.
    " get root container
         lo_container ?= view->get_root_element( ).
    *" get button reference
         lo_transc ?= lo_container->get_child() // Get the tray which container the view container of select options.
    then inside this i have the transparent container which has the selec options.
    Please help
    Tashi

    Hi Tashi,
    1. Add your Select-Options screen elements(Your blocks) to UI View Container element and bind the context to WDUI_VISIBILITY. Set the visibility depends on your requirement.
    2. You have REMOVE_SELECTION_SCREEN_ITEM method from Interface IF_WD_SELECT_OPTIONS to remove the fields at runtime.
    Please follow the below link
    Creation and Deletion of selection screen elements based on user action
    Hope it helps you
    BR,
    RAM.

Maybe you are looking for

  • Transfer data to new computer

    I just brought home a macbook pro 13 to replace my 5 yr old macbook pro (display died). As i was starting it up it asked me if I wanted to transfer data from another computer. I chose "not now". How can I get back to that prompt?

  • What are the best practice in report design ?

    Hi, According to you, what are the best practices in report desing about layout, fonts and colors ? Thks

  • Can't add Lightroom 4.4 to "open with" menu

    Since the recent 4.4 update I can't add Lightroom 4.4 to the Windows 7 right click "open with" menu. When I try to add Lightroom.exe to the menu it simply doesn't get added.

  • Mac OS X 10.6.8 it's Snow Leopard?

    I am a new user of iMac and want to know if my version of software Mac OS X 10.6.8 belongs to Snow Leopard. I want to confirm it because I want to install the software Lion. Thank you.

  • How to apply alpah to BitmapFill when drawing image to stage??

    I'm just starting with AS3 from AS2, but understand basics of code, so bear with me. I got this code from www.kirupa.com; it writes an image to stage as a way of tile it. holidaytile is an instance of a Gif Image. But I want to change the Alpha so th