Dynamic insertion of elements based on dynamic condition

I need to achieve the following:
Input:
<Customer>
     <name>Name1</name>
     <email>Email1</email>
     <phone>Phone1</phone>
     <Number>Num1</Number>
<Customer>     
Output:
<Customer>
     <name>Name1</name>
     <email>Email1</email>
     <phone>Phone1</phone>
     <Number>Num1</Number>
     <Addresses>
          <Address>add1</Address>
          <Address>add1</Address>
          <Address>add1</Address>
     </Addresses>
<Customer>
Based on the number of Addresses that exist for the customer, multiple <Address> elements should be added.
I can't determine number of Addresses at the beginning. It is deterrmined dynamically based on certain condition.
So each time when the condition is met, I need to get the count of <Address> elements that exist and insert the new one last.
My logic:
     Switch (case)     ==> Add <Address> only if condition is met
          count ==> count(bpws:getVariableData('outputVariable','payload','/ns1:Customer/ns1:Addresses')) ==> 0 first time
          <Addresses>
               <Address>add1</Address> ===> Now I need to insert this.
          </Addresses>
I have the following in my bpel:
<assign name="AssignInsertAfterExisting">
<copy>
<from expression="count(bpws:getVariableData('outputVariable','payload','/ns1:Customer/ns1:Addresses'))"/>
<to variable="NumberOfAds"/>
</copy>
<copy>
<from expression="'123 street'"/>
<to variable="nextAddress"/>
</copy>
<bpelx:insertAfter>
<bpelx:from variable="nextAddress"/>
<bpelx:to variable="outputVariable" part="payload"
query="/ns1:Customer/ns1:Addresses/ns1:Address squareBrakets NumberOfAds squareBrakets"/>
</bpelx:insertAfter>
</assign>
But with the above I am receiving the folllowing error:
     Assign Operation Misuse.
     The to-spec does not yield any data; insertAfter operation cannot be performed.
Please check the BPEL source at line number ..
I can I insert dynamically insert elements into array. I have seen the example provided in samples, but my problem is little different than that.
Edited by: user10367892 on Aug 4, 2009 3:16 AM

append is appending value of variable to existing element, instead of creating a new element in the array:
For Eg:
Input:
<bpelx:append>
<bpelx:from variable="nextAddress"/>
<bpelx:to variable="outputVariable" part="payload" query="/ns1:Customer/ns1:Addresses/ns1:Address"/>
</bpelx:append>
Output if nextAddress = Address2 and if <Address>Address1</Address> already exists
<Customer>
     <Addresses>
          <Address>Address1Address2</Address>
     </Addresses>
</Customer>

Similar Messages

  • Inserting new columns based on the condition!

    Hi guys,
    I have a very simple query like the following… 
    SELECT table2.column_code2,
    table2.column_description2,
                 table2.column_code1,
                 table1.column_description1
    FROM database_001.table2 table1 LFET OUTER JOIN database_001.table2 table1 on (table2.column_code1 = table1.column_code1)
    From this query, its returning me a result set of something like below:
    column_code1       column_description1        column_code2                 column_description2
    RO1                              BOOK                              RL1            
                               PDF/ECOPY
    RO2                              PAPER                             RL2            
                            CONFERENCE
    RO5                            JOURNAL 
    RL11  OTHER
    Now, on the above query I want to insert three extra columns with the name (status, location and contact) where the results in the extra three columns would be based on the conditions I want to define in the query based on the above results…
    Something for example (sorry, I am not trying to write a condition: my question is how to write it), 
    if column_code1 = RO1 and column_description2  =  PDF/ECOPY on status column it should return a value ‘ONLINE’ & on location column it should return ‘WEB’ and on contact column it should write ‘BOB’.
    Also,
    if column_code1 = RO5 and column_description1 = JOURNAL on status column it should return a value ‘ON PRESS FOR PRINT’ & on location column it should return ‘S.R STREET, LONDON’ and on contact column it should write
    ‘SMITH’ like below result…so the final output should be the top four columns and the extra three columns…I hope someone can help me into this…thanks a lot…
    status                                            location                
                            contact
    ONLINE                                               WEB                          
                           BOB
    ON PRESS FOR PRINT                     S.R STREET, LONDON                           SMITH

    Hi artistdigital,
    you can use case statment for same in sql server. MSDN link - > http://technet.microsoft.com/en-us/library/ms181765.aspx
    Try code like this:
    SELECT table2.column_code2,
    table2.column_description2,
    table2.column_code1,
    table1.column_description1,
    case when column_code1 = 'RO1' and column_description2 = 'PDF/ECOPY' then 'ONLINE'
    when column_code1 = 'RO5' and column_description1 = 'PDF/ECOPY' then 'ON PRESS FOR PRINT'
    end as [status],
    case when column_code1 = 'RO1' and column_description2 = 'PDF/ECOPY' then 'WEB'
    when column_code1 = 'RO5' and column_description1 = 'PDF/ECOPY' then 'S.R STREET, LONDON'
    end as [Location],
    case when column_code1 = 'RO1' and column_description2 = 'PDF/ECOPY' then 'BOB'
    when column_code1 = 'RO5' and column_description1 = 'PDF/ECOPY' then 'SMITH'
    end as [contact]
    FROM table2
    join table1
    on table2.column_code1 = table1.column_code1
    Regards Harsh

  • Dynamic insertion of data in a Dynamic Column in a table

    Hi EveryBody ,
    I have a table where i am increasing the column dynamically . I need to insert data through PreparedStatement Like
    pst = con.prepareStatement(CBBsqlConstants.addOrderItem);
                   pst.setString(1,ein);
                   pst.setString(2,insert_date);
                   pst.setString(3,checkList);
                   pst.setString(4,Quantities);
                   pst.setDate(5,pick_date);
                   pst.setDate(6,completed_date);
                   pst.setString(7,comment);
                   pst.setInt(8,status);
                   pst.setString(9,agent_ein);
                   i = pst.executeUpdate();
    But here my column is increasing dynamically, so the above cant be constant as column is incresing . how do i handle the insertion part dynamically.
    Thanks So much . Please help with this .

    Server_java wrote:
    Ya you are right ,
    Take i am ordering some Items and quantity from checkbox and inserting that to the table , each item and quantity is going to consume a row , but when i am going have column for each item , all the items i am going to select is going to appear in a single row . so i am consuming .But only 256 column is allowed for a table ,but my item is not going to excced that . That maximum number of columns is the least of the problems here.
    The problem is that you are taking data that should be in another table and turning it into metadata instead. That's a mistake because it makes your entire application brittle and it doesn't need to be. It also will make querying your table a nightmare.
    Let's take a look at your solution and then the correct solution.
    Your solution (condensed)
    tblOrder
    id
    customername
    apples
    oranges
    bananas
    cherries
    Sample data (CSV format for the forum)
    1,"John Smith",0,0,0,1
    2,"Jane Smith",1,0,0,3
    3,"Kate Smith",0,2,1,0
    The correct solution
    tblOrder
    id
    customername
    Sample data
    1,"John Smith"
    2,"Jane Smith"
    3,"Kate Smith"
    tblProduct
    id
    name
    Sample data
    1, "Apples"
    2,"Oranges"
    3, "Bananas"
    4, "Cherries"
    tblOrderItem
    orderid
    productid
    quantity
    Sample data
    1,4,1
    2,1,1
    2,4,3
    3,2,2
    3,3,1
    So what's the difference?
    With your design what happens when you want to add a new fruit? Your schema changes and all your code breaks. With my design you simply insert one row and that's it.
    And what happens if you do happen to eventually need more than 250 odd fruits? With your design you are screwed. With my correct design it's never going to be a problem.
    And consider that with my design you can populate user inteface components using actual data and not table meta data.
    And the list goes on... the point is the only correct solution is to use a proper relational design.

  • How to dynamically insert UI to View

    i need dynamically create link,
    like HTML Tag <a href='URL' >text</a>
    public void wdDoInit()
    ArrayList al = .... (URL String List)
    for(int i =0;i<al.size(); i++)
    ..... HOW  TO CODING??
    Dynamically Insert UI to View or Dynamically Insert UI to View LinkToURL

    hi  Sarbjeet
    this is my code,
    how coding LinkToURL UI put in Group UI and how use group.createLayout() method for GridLayout ?
         if(firstTime)
              IWDTransparentContainer tc = (IWDTransparentContainer)view.getElement("RootUIElementContainer");
              tc = (IWDTransparentContainer)view.getElement("RootUIElementContainer");
              IWDCaption groupTitle = (IWDCaption)view.createElement(IWDCaption.class,"GroupTitle");
              groupTitle.setText("TempGroup");
              IWDGroup group = (IWDGroup)view.createElement(IWDGroup.class,"DynamicallyGroup");
              group.setHeader(groupTitle);
              group.setWidth("100%");
              group.setEnabled(true);
              tc.addChild(group);
              for (int i=0 ; i<10; i++)
                   tc = (IWDTransparentContainer)view.getElement("RootUIElementContainer");
                   IWDLinkToURL ld = (IWDLinkToURL)view.createElement(IWDLinkToURL.class,"ltu"+i );
                   ld.setTarget("http://www.google.com");
                   ld.setReference("http://www.google.com");
                   ld.setText("test..."+i+"\t");
                   ld.setEnabled(true);
                   tc.addChild(ld);

  • How to dynamically add/remove a button from the ribbon based on some condition? (Ribbon XML)

    Hi,
    I have a ribbon (done using ribbon XML) with menu options. I need to remove few buttons from the menu dynamically based on some condition. Also, I want to change the label of another button. How to achieve this programmatically? (C#)
    Thanks in advance.
    Thanks Prasad

    Hello Prasad,
    Use callbacks for populating Ribbon controls such as menu, dropDown, gallery and etc. Then you can use the
    Invalidate or
    InvalidateControl methods of the
    IRibbonUI interface to get your callbacks invoked when required. Thus, you will be able to delete the required item(s).
    You will find the following articles in MSDN helpful:
    Chapter 11: Creating Dynamic Ribbon Customizations (1 of 2)
    Chapter 11: Creating Dynamic Ribbon Customizations (2 of 2)
    To change the label of your controls at runtime you need to use the getLabel callback and call the Invalidate or InvalidateControl methods of the IRibbonUI interface. The following series of articles describe the Fluent UI in depth:
    Customizing the 2007 Office Fluent Ribbon for Developers (Part 1 of 3)
    Customizing the 2007 Office Fluent Ribbon for Developers (Part 2 of 3)
    Customizing the 2007 Office Fluent Ribbon for Developers (Part 3 of 3)

  • Setting a field as Mandatory dynamically based on certain condition

    Hi All -
    I am working on ADOBE Interactive forms. I am not able to find out, How to set a particular field as a 'Mandatory field' based on some condition. I am using FormCalc as scripting language.
    i.e: I have a field "RATING". I want to make the next field "COMMENT" as mandatory when "RATING" is less than 3.

    Hi Vishal,
       You need to set the mandatory attribute of the specific field according to your condition. In FormCalc this will be similar to this,
    if (Rating < 3) then
              $.mandatory = "error"
              $.mandatoryMessage = "The corresponding Comment field is mandatory. Please fill"
    else
              $.mandatory = "disabled"
    endif
    The mandatory property can be set as:
    "error" : Makes the field compulsory to be filled before submission
    "disabled" : Makes the field optional
    "warning" : Gives a warning to the user that the field should be filled, but doesn't cause an error on submission
    The property "mandatoryMessage" specifies the message to be displayed to the user when the mandatory field isn't filled before submission.
    Regards,
    Rose

  • How insert a Group into RootUIElement dynamically?

    Hi,
    how is it possible to add a dynamically created UI Element (Group) to ROOTUIELEMENTCONTAINER? I try it with the following piece of code but i get always the error message: <b> Access via 'NULL' object reference not possible. </b>
      IF FIRST_TIME EQ ABAP_TRUE.
        DATA: lr_root TYPE REF TO cl_wd_uielement_container,
              lr_groupbox TYPE REF TO cl_wd_group.
        lr_root ?= view->get_element( 'ROOTUIELEMENTCONTAINER' ).
        lr_groupbox ?= cl_wd_group=>new_group( id = 'GROUP' ).
        cl_wd_flow_data=>new_flow_data( lr_groupbox ).
        lr_root->add_child( lr_groupbox ).
      ENDIF.
    What is my mistake?
    regards,
    Sharam
    Message was edited by:
            Sharam Pourmir

    Hi Sharam,
    Firstly, I am not getting a null pointer exception. I got an ASSERT condition violated error, which I solved by defining a layout for the group. The layout has to be defined first and then the layout data. This is my code and it works. Try if it does for you too.
    IF FIRST_TIME EQ ABAP_TRUE.
        DATA: lr_root TYPE REF TO cl_wd_uielement_container,
              lr_flow_layout type ref to cl_wd_flow_layout,         
              lr_groupbox TYPE REF TO cl_wd_group.
        lr_root ?= view->get_element( 'ROOTUIELEMENTCONTAINER' ).
        lr_groupbox ?= cl_wd_group=>new_group( id = 'GROUP' ).
        CALL METHOD CL_WD_FLOW_LAYOUT=>NEW_FLOW_LAYOUT
          EXPORTING
            CONTAINER = lr_groupbox
          RECEIVING
            CONTROL   = lr_flow_layout
        lr_groupbox->set_layout( lr_flow_layout ).
        cl_wd_flow_data=>new_flow_data( lr_groupbox ).
        lr_root->add_child( lr_groupbox ).
      ENDIF.
    Regards,
    Nithya

  • Dynamically hide/unhide elements?

    Hello
    I have generated dynamic controls on form through XML, now I want to hide/unhide the elements based on click of particular item.
    Also i have added the click event on the desired elements and trying the following in function
    this["sampleElementID"].visible = false;( in sampleElementid i am passing the id of the element which needs to be hidden)
    Is there is any method like document.getElementbyId in action script???
    ( also tried get getChildByName("sampleElementID").visible = false; but it does not work) 
    Help needed....
    Thank in advance!

    Hi Vibhor Seth,
    please find the working code below:
        var sampleForm:Form = new Form();
        var sampleFormItem:FormItem = new FormItem();
        var sampleTextInput:TextInput = new TextInput();
        sampleTextInput.id="smpleTxtIpt";
        sampleTextInput.name="smpleTxtIpt";
        sampleTextInput.text = "sample Text Input";
        sampleFormItem.addElement(sampleTextInput);
        //adding in form
        sampleForm.addElement(sampleFormItem);
        addElement(sampleForm);
        sampleFormItem.getChildByName("smpleTxtIpt").visible = false;
    In the code you have posted you have used different names for id and name....Try to use the same names for both id and name ...however it is not compulsory...but its good practice...
    Also you have used sampleForm.getChildByName("smpleTxtIntName").visible = false; But you should be using the below line of code:
    sampleFormItem.getChildByName("smpleTxtIpt").visible = false;
    In your code you are trying to use the getChildByName() method on the Form tag but you should be using on the FormItem container.
    Note: Remember you can access the child elements by using the getChildByName() only for the elements which are direct childs of a container but not the from the parent of parent container.
    So by the AS code you created the following structure is created:
    <mx:Form id="sampleForm">
         <mx:FormItem id="sampleFormItem">
              <mx:TextInput id="smpleTxtIpt" name="smpleTxtIpt" />
         </mx:FormItem>
    </mx:Form>
    So if you want to make TextInput visible false..then you need to use ..... sampleFormItem.getChildByName("smpleTxtIpt").visible = false;
    but not  sampleForm.getChildByName("smpleTxtIpt").visible = false; since smpleTxtIpt is direct child of sampleFormItem.
    Hope now things are clear for you...
    If this post answers your question or helps, please kindly mark it as such.
    Thanks,
    Bhasker Chari

  • Is it possible to enable DOM events from a dynamically inserted QuickTime?

    QuickTime in IE uses an <object> as a 'behaviour' template in order to enable DOM events. The behaviour <object> is referenced from the QuickTime plugin instance with IE's behavior style: style="behavior: url(#idof_behaviorobject)".
    This works great for all QuickTime <object> instances declared before window.onload, but QuickTime <object> instances inserted into the DOM after that do not pick up the DOM events behaviour.
    I do not know exactly how behaviour styles work and what I've read so far hasn't made me any the wiser. Are behaviours called on elements that reference them, only on page load, and therefore can't be picked up later?
    Are there any known workarounds for enabling DOM events from QuickTime objects inserted after page load?
    Just so you know - I've tried various methods of DOM insertion - innerHTML, createElement, and calling iframes with their own html page containing the necessary objects. None of these work for enabling DOM events on insertion after page load.
    ( P.S. I've cross-posted this question on stackoverflow here:
    http://stackoverflow.com/questions/1336678/is-it-possible-to-enable-dom-events-f rom-a-dynamically-inserted-quicktime-object
    If I get a working answer I'll copy it across. )
    Cheers!
    Stephen.

    I found forwarding the impl_processMouseEvent kind of works ... except when the graphics of the transparent child window floats over the owner window's chrome elements - in particular the title bar, minimise/maximise and resized borders won't accept forwarded mouse events this way.
    Not true mouse transparency.

  • Problem with Dynamic Node & UI Elements

    Hi,
                                            The scenario is to create an Questioaire.Since the number questions which I get from R/3 may vary, I have created the Dynamic Node which is mapped with Dynamic set of Radio button Group by index for options & Dynamic text view for displaying Questions..  A New Dynamic Node will be created for each set of Questions .The Number of questions displayed per page is controlled by the Static Counter Variable....
                                              Now the issue is ,if i click back button the count will be initialized so again it needs to trigger the DoModifyView(). at that time It is arising an exception "Duplicate ID for view & Radio button ..." because while creating Dynamic node i used to have "i" value along the Creation of node name...
    for(i=Count;i<i<wdContext.nodeQuestions().size();i++)
                   customnod=<b>nodeinfo.getChild("Questionaire"+i);</b>
                        if(customnod==null)
    Its not possible to create a new node whenever i click the Back button.
    At the same time i am not able to fetch the elements which had already created Dynamically...
    How do i make the Next & back button work?
    If anyone  bring me the solution It would be more helpful to me.
    Thanks in advance..
    Regards,
    Malar

    Hi,
          We can Loop through the Node Elements but how can we do Option Button Creation for each set of question Options?. At design time we can not have the radio buttons,because we do not know how many set of questions are available at the Backend.

  • How to deal with dynamic selection screen elements when macros are used?

    Hello experts,
    This is regarding the dynamic selection screen elements. Actually the requirement is to modify the existing standard report program RFUMSV00 by copying it into a Z report, adding a few selection screen elements and new fields in the output. I actually did everything required except for the one thing that is going out of my reach.
    There are a certain fields which are coming when they are not supposed to get displayed. I don't understand the code because of its obsoleteness. Neither can I debug it because it is just data declaration.
    This is the code where there is a fault. If I copy the entire code into a new Z report, I'm getting new fields like Entry Date, Document Type, Reference Transaction,  Reference key, Logical system.
      DEFINE selection_screen_line.
      selection-screen: begin of line.
      parameters &3 like &4 default 'X' modif id mc4.
      selection-screen: comment (30) &1 for field &3 modif id mc4.
      selection-screen: comment pos_low(10) text-019
                        for field &2 modif id mc4.  "neu
      parameters &2 like rfums_alv-variante modif id mc4.
      selection-screen:
          position pos_high.
      selection-screen: pushbutton (15) text-028
                        user-command &5 modif id mc4.
      selection-screen end of line.
    END-OF-DEFINITION.
    Kindly, suggest me the right solution.

    In the program attributes ( SE38 > RFUMSV00 > GOTO > Properties ), you will find a logical database BRF declared. The include DBBRFSEL is part of the selection screen of this logical database.
    The selection screen is actually the selection screen of this logical database.
    Under the Logical Database field, there is a Selection screen field where you can input which selection screen of the logical database to be used.
    But, this is just to change the selection screen that is displayed. To completely suppress it you need to remove logical database declaration from the properties of the program and call it inside your program through function module.
    You cannot just remove it from the declaration because many of its variables are used in the program.
    So call it using function module as the first step in INITIALIZATION section of the program.
    The syntax and function module to call it in your program can be found in the following thread :
    How to hide the selection screen of a Logical datebase?
    Regards,
    Ashish

  • How to show the columns dynamically in OBIEE report based on the selection?

    Hi,
    I have a requirement where the columns should be dynamically shown in report based on what we select in propmt page.
    I'm creating a report in OBIEE where i want to give an option to the end user to select the columns whichever he wants to see in the report.
    For example I have the following columns in the report already:
    Customer Name,
    Customer Number,
    Bank Account,
    Address
    I want to give an option to the user to select 'Customer Mail ID' dynamically and see the column to be displyed in the report along with the existing columns.
    Through 'Column Selector' user can select a single column at a time, but if he want to select more than one column, how can we do this ?
    Please help me out in resolving this issue.
    Thanks,
    Chaithanya.

    Hi Chaithanya,
    there's not a straight solution for this. You can create different analysis containing different number of columns and then directing the user to this analysis using Action Links or you can also use View Selector to switch from one view (analysis) to the other. But it's not going to be very flexible nor dynamic.
    J.

  • Dynamic tree UI element in the view

    Dear All,
         Can anyone provide me with the code snippet for Dynamic Tree UI element in the view. I need to show the tree which should be generated dynamically.
    Thanks alot in advance!
    Points will be rewarded, Please its urgent!
    Cheers,
    Darshna.

    Hi ,
    sorry for the late reply... here is the code for onActionLoadchildren .. i am sure you wont understand this.. but lets try...
    DATA:
        element_parent  TYPE REF TO if_wd_context_element,
        lv_object_key1   type string,
        lv_object_type  type string.
    DATA:
           node_root_entry                     TYPE REF TO if_wd_context_node,
           elem_root_entry                     TYPE REF TO if_wd_context_element,
           stru_root_entry                     TYPE if_structure_view_new=>element_root_entry ,
           item_valid_from                     LIKE stru_root_entry-valid_from,
           item_plant                          LIKE stru_root_entry-plant,
           item_equi_key                       LIKE stru_root_entry-equi_key,
           item_object_key                     LIKE stru_root_entry-object_key,
           item_object_type                    TYPE string,
           item_path                           TYPE string,
           item_parent_path                    TYPE string,
          context_node                        TYPE REF TO if_wd_context_node,
           root_entry                          TYPE if_structure_view_new=>element_selected_entry.
          l_ref_componentcontroller           TYPE REF TO ig_componentcontroller.
    DATA:
         node_root_info                    TYPE REF TO if_wd_context_node,
         elem_root_info                    TYPE REF TO if_wd_context_element,
          stru_root_info                    TYPE if_structure_view_new=>element_root_info .
    DATA:
          element                            TYPE REF TO if_wd_context_element,
          node_selected_entry                TYPE REF TO if_wd_context_node,
          elem_selected_entry                TYPE REF TO if_wd_context_element.
    DATA:
          ls_hier_return      TYPE rplm_ts_struc_elements,
          lt_hier_return      TYPE TABLE OF rplm_ts_struc_elements,
          ls_hier_return_temp TYPE rplm_ts_struc_elements,
          lt_hier_return_temp TYPE TABLE OF rplm_ts_struc_elements,
          ls_hier_level       TYPE rplm_ts_hier_level,
          lt_hier_level       TYPE TABLE OF rplm_ts_hier_level,
          ls_hier_return_sort TYPE rplm_mt_ts_hier,
          lt_hier_return_sort TYPE TABLE OF rplm_mt_ts_hier.
      DATA:
           temp_hier_level TYPE if_structure_view_new=>element_hier_level,
           lt_hier_temp    TYPE TABLE OF if_structure_view_new=>element_hier_level,
           lt_temp         TYPE TABLE OF if_structure_view_new=>element_hier_level.
      DATA:
           lc_path       TYPE string,
           lv_object_key TYPE string.
      DATA:
           lv_hier_lines TYPE i.
      DATA:
          node_entries                        TYPE REF TO if_wd_context_node,
           node_sub_entries                    TYPE REF TO if_wd_context_node,
          elem_sub_entries                    TYPE REF TO if_wd_context_element,
           stru_sub_entries                    TYPE if_structure_view_new=>element_sub_entries .
      TYPES: BEGIN OF ls_hier_type,             "structure for Hierarchy table
          object(31)      TYPE c,         "Objectkey
          predecessor(31) TYPE c,         "Objectkey Predecessor
          data(2000)      TYPE c,         "Data container
          level           TYPE i,         "level of object in tree
          successors(1)   TYPE c,         "Object has successors: YES/NO/U
          display(1)      TYPE c,         "Object is displayed: YES/NO
          selected(1)     TYPE c,         "Object is selected/marked: YES/NO
          index_predec    LIKE sy-tabix,  "Index predecessor
          strno           TYPE ilom_strno,"External number for func. loc.
                                         "in BOMs used for top object
       END OF ls_hier_type.
      DATA:
           ls_hier     TYPE ls_hier_type,
           lt_hier     TYPE TABLE OF ls_hier_type WITH DEFAULT KEY,
           lt_mat_hier TYPE TABLE OF ls_hier_type WITH DEFAULT KEY.
      " For retrieving Material Data Heirarchy
      DATA:
           lh_stpo_tab     TYPE TABLE OF rihstpx ,
           lwa_stpo_tab    LIKE LINE OF lh_stpo_tab,
           check_menge     TYPE string ,
           check_meins     TYPE string ,
           lwa_mat_hier    LIKE LINE OF  lt_mat_hier ,
           lt_dup_mat_hier LIKE lt_mat_hier,
           lv_len          TYPE i,
           lv_len_temp     TYPE i .
      DATA:
           lv_equnr TYPE equi-equnr,
           lv_tplnr TYPE iflo-tplnr,
           lv_matnr TYPE mast-matnr.
      DATA:
           lv_cnt   TYPE i,
           lv_index TYPE i.
      DATA:
           lv_path        TYPE string,
           lv_parent_path TYPE string,
           pos            TYPE string,
           separator      TYPE c VALUE '.',
           max_level      TYPE i,
           temp_level     TYPE i,
           counter        TYPE i VALUE 1.
      TYPES: BEGIN OF ls_pred_type,             "structure for Hierarchy table
         parent(31)      TYPE c,         "Objectkey Predecessor
         path(2000)      TYPE c,         "Data container
         index_predec    LIKE sy-tabix,  "Index predecessor
      END OF ls_pred_type.
    DATA:
          ls_pred TYPE ls_pred_type,
          lt_pred TYPE TABLE OF ls_pred_type WITH DEFAULT KEY.
    DATA:
          lv_int_obj_key TYPE string,
          obj_len        TYPE i,
          lv_funcloc_ext TYPE ilom_strno,
          lv_funcloc     TYPE itob-tplnr.
    DATA:
          lv_level        TYPE i,
          lv_temp         TYPE i,
          lt_path_entries TYPE string_table.
    DATA:
          node_general                        TYPE REF TO if_wd_context_node,
          elem_general                        TYPE REF TO if_wd_context_element,
          stru_general                        TYPE if_structure_view_new=>element_general ,
          item_collapse_visibility            LIKE stru_general-collapse_visibility.
    DATA:
          elem_context                        TYPE REF TO if_wd_context_element,
          stru_context                        TYPE if_structure_view_new=>element_context ,
          item_expand_all                     LIKE stru_context-expand_all.
    lv_path = path.
    Get Element whose children shall be loaded
      element_parent = wd_context->path_get_element( lv_path ).
    element_parent->get_attribute(
          EXPORTING
            name =  `OBJECT_KEY`
          IMPORTING
            value = LV_object_key ).
    element_parent->get_attribute(
          EXPORTING
            name =  `OBJECT_TYPE`
          IMPORTING
            value = lv_object_type ).
    node_root_entry = wd_context->get_child_node( name = wd_this->wdctx_root_entry ).
    get element via lead selection
      elem_root_entry = node_root_entry->get_element(  ).
    get single attribute
      elem_root_entry->get_attribute(
        EXPORTING
          name =  `VALID_FROM`
        IMPORTING
          value = item_valid_from ).
      elem_root_entry->get_attribute(
          EXPORTING
            name =  `PLANT`
          IMPORTING
            value = item_plant ).
    item_object_type = lv_object_type.
    if lv_object_type eq 'EQUI'.
      item_object_key = ''.
      item_equi_key = lv_object_key.
    elseif lv_object_type eq 'FUNCLOC'.
      item_object_key = lv_object_key.
      item_equi_key = ''.
    ELSE.
      lv_matnr = lv_object_key.
    For BOM, material and Assembly
    endif.
      IF item_object_type EQ 'EQUI'.
        lv_equnr = lv_object_key.
      ELSEif item_object_type eq 'FUNCLOC'.
        lv_tplnr = lv_object_key.
      ELSE.
        LV_MATNR = lv_object_key.
        exit.
      ENDIF.
      CALL FUNCTION 'PM_HIERARCHY_CALL'
        EXPORTING
          datum             = item_valid_from
          equnr             = lv_equnr
          tplnr             = lv_tplnr
          matnr             = lv_matnr
          levdo             = '99'
          levup             = '00'
          sanin             = 'X'
          select_equi       = 'X'
          select_iflo       = 'X'
          select_stpo       = 'X'
          selmod            = 'D'
          stkkz             = ''
          werks             = item_plant
          with_equi         = 'X'
          with_equi_hier    = 'X'
          with_iflo_hier    = 'X'
          with_btyp         = 'X'
          with_mara         = 'X'
          with_ibase_hier   = ''
          capid             = ''
          emeng             = 0
        IMPORTING
          et_hier           = lt_hier
        EXCEPTIONS
          no_hierarchy      = 1
          no_object_defined = 2
          no_selection      = 3
          no_valid_equnr    = 4
          no_valid_matnr    = 5
          no_valid_selmod   = 6
          no_valid_tplnr    = 7
          OTHERS            = 8.
      LOOP AT lt_hier INTO ls_hier.
        ls_hier_return-object_key = ls_hier-object.
        ls_hier_level-object_key = ls_hier-object.
        ls_hier_level-predecessor = ls_hier-predecessor.
        lv_len = strlen( ls_hier-object ).
        IF lv_len GT 1.
          lv_len_temp = lv_len - 1.
        ELSEIF
        lv_len_temp = lv_len.
        ENDIF.
        ls_hier_level-level = ls_hier-level.
        IF ls_hier-object(1) = 'T'.
          ls_hier_return-icon = 'ICON_TECHNICAL_PLACE'.
          ls_hier_return-object_type = 'FUNCLOC'.
          IF ls_hier-successors = 'Y'.
            ls_hier_return-is_leaf = abap_false.
            ls_hier_return-is_expanded = abap_false.
            ls_hier_return-children_loaded = abap_true.
          ELSE.
            ls_hier_return-is_leaf = abap_true.
            ls_hier_return-is_expanded = abap_true.
            ls_hier_return-children_loaded = abap_true.
          ENDIF.
        ELSEIF ls_hier-object(1) = 'E'.
          ls_hier_return-icon = 'ICON_EQUIPMENT'.
          ls_hier_return-object_type = 'EQUI'.
          IF ls_hier-successors = 'Y'.
            ls_hier_return-is_leaf = abap_false.
            ls_hier_return-is_expanded = abap_false.
            ls_hier_return-children_loaded = abap_true.
          ELSE.
            ls_hier_return-is_leaf = abap_true.
            ls_hier_return-is_expanded = abap_true.
            ls_hier_return-children_loaded = abap_true.
          ENDIF.
        ELSEIF ls_hier-object+lv_len_temp(1) = 'M'.
          ls_hier_return-icon = 'ICON_MATERIAL'.
          ls_hier_return-object_type = 'MATERIAL'.
          IF ls_hier-successors = 'Y'.
            ls_hier_return-is_leaf = abap_false.
            ls_hier_return-is_expanded = abap_false.
            ls_hier_return-children_loaded = abap_false.
          ELSE.
            ls_hier_return-is_leaf = abap_true.
            ls_hier_return-is_expanded = abap_true.
            ls_hier_return-children_loaded = abap_true.
          ENDIF.
        ELSEIF ls_hier-object+lv_len_temp(1) = 'X'.
          ls_hier_return-icon = 'ICON_SUPPLY_AREA'.
          ls_hier_return-object_type = 'MATBOM'.
          IF ls_hier-successors = 'Y'.
            ls_hier_return-is_leaf = abap_false.
            ls_hier_return-is_expanded = abap_false.
            ls_hier_return-children_loaded = abap_false.
          ELSE.
            ls_hier_return-is_leaf = abap_true.
            ls_hier_return-is_expanded = abap_true.
            ls_hier_return-children_loaded = abap_true.
          ENDIF.
        ELSEIF ls_hier-object+lv_len_temp(1) = 'A'.
          ls_hier_return-icon = 'ICON_MATERIAL_REVISION'.
          ls_hier_return-object_type = 'MATERIAL'.
          IF ls_hier-successors = 'Y'.
            ls_hier_return-is_leaf = abap_false.
            ls_hier_return-is_expanded = abap_false.
            ls_hier_return-children_loaded = abap_false.
          ELSE.
            ls_hier_return-is_leaf = abap_true.
            ls_hier_return-is_expanded = abap_true.
            ls_hier_return-children_loaded = abap_true.
          ENDIF.
        ENDIF.
    *IF ls_hier-predecessor EQ item_object_key OR ls_hier-object EQ item_object_key.
        APPEND ls_hier_return TO lt_hier_return.
        APPEND ls_hier_level TO lt_hier_level.
    *ENDIF.
        CLEAR lv_len.
        CLEAR lv_len_temp.
      ENDLOOP.
    lt_hier_return_temp = lt_hier_return.
      DESCRIBE TABLE lt_hier LINES lv_hier_lines.
      IF lv_hier_lines EQ 0.
        elem_selected_entry = wd_context->path_get_element( '1.ENTRIES.1' ).
    Get children node
        elem_selected_entry->set_attribute(
        value = abap_true
        name = 'IS_LEAF' ).
      ENDIF.
    *************************************Deleting Now***********
    SORT lt_hier_level BY level DESCENDING.
      LOOP AT lt_hier_level INTO ls_hier_level.
        max_level = ls_hier_level-level.
        EXIT.
      ENDLOOP.
      SORT lt_hier_level BY level ASCENDING.
      LOOP AT lt_hier_level INTO ls_hier_level WHERE level EQ 0.
        ls_hier_level-path = '1.ENTRIES.1'.
        ls_hier_level-parent_path = '1.ENTRIES.1'.
        MODIFY lt_hier_level FROM ls_hier_level.
      ENDLOOP.
    ************************New design to Generate Path and Parent path
    lv_cnt = 0.
    temp_level = 1.
    SORT lt_hier_level BY object_key ASCENDING.
    LOOP AT lt_hier_level INTO ls_hier_level WHERE level EQ 1.
       lv_cnt = lv_cnt + 1.
       lv_parent_path = '1.ENTRIES.1'.
       ls_hier_level-parent_path = lv_parent_path.
       pos = lv_cnt.
       CONCATENATE lv_parent_path separator 'SUB_ENTRIES' separator pos INTO lv_path.
       ls_hier_level-path = lv_path.
       MODIFY lt_hier_level FROM ls_hier_level.
    ENDLOOP.
    temp_level = 1.
    lv_cnt = 0.
    *********************Need to call this for each level ***************************
    WHILE temp_level LT max_level.
       CLEAR lt_pred.
       CLEAR ls_pred.
       LOOP AT lt_hier_level INTO ls_hier_level WHERE level EQ temp_level.
         ls_pred-parent = ls_hier_level-object_key.
         ls_pred-path = ls_hier_level-path.
         APPEND ls_pred TO lt_pred.
       ENDLOOP.
       SORT lt_pred BY parent.
       DELETE ADJACENT DUPLICATES FROM lt_pred.
       LOOP AT lt_pred INTO ls_pred.
         lv_cnt = 0.
         LOOP AT lt_hier_level INTO ls_hier_level WHERE predecessor EQ ls_pred-parent.
           lv_cnt = lv_cnt + 1.
           lv_parent_path = ls_pred-path.
           ls_hier_level-parent_path = lv_parent_path.
           lv_path = ''.
           pos = lv_cnt.
           CONCATENATE lv_parent_path separator 'SUB_ENTRIES' separator pos INTO lv_path.
           ls_hier_level-path = lv_path.
           MODIFY lt_hier_level FROM ls_hier_level.
         ENDLOOP.
       ENDLOOP.
       temp_level = temp_level + 1.
    ENDWHILE.
    LOOP AT lt_hier_level INTO ls_hier_level.
       LOOP AT lt_hier_return INTO ls_hier_return.
         IF ls_hier_level-object_key = ls_hier_return-object_key.
           MOVE-CORRESPONDING ls_hier_level TO ls_hier_return.
           MODIFY lt_hier_return FROM ls_hier_return.
         ENDIF.
       ENDLOOP.
    ENDLOOP.
    SORT lt_hier_return BY path ASCENDING.
    **************************Delete the extra first character returned by PM_HIERARCHY_CALL******
      LOOP AT lt_hier_return INTO ls_hier_return.
        IF ls_hier_return-object_key(1) = 'T'.
          SHIFT ls_hier_return-object_key BY 1 PLACES.
          lv_object_key = ls_hier_return-object_key.
          lv_funcloc_ext = lv_object_key.
          CALL FUNCTION 'CONVERSION_EXIT_TPLNR_OUTPUT'
            EXPORTING
              input  = lv_funcloc_ext
            IMPORTING
              output = lv_funcloc.
          lv_int_obj_key = lv_funcloc.
          ls_hier_return-object_key = lv_int_obj_key.
        ELSEIF ls_hier_return-object_key(1) = 'E'.
          SHIFT ls_hier_return-object_key BY 1 PLACES.
          lv_object_key = ls_hier_return-object_key.
          obj_len = strlen( lv_object_key ).
          IF obj_len GE 18.
            lv_object_key = lv_object_key+0(18).
          ENDIF.
          wd_comp_controller->conv_ext_2_int(
           EXPORTING
             iv_object_key_ext =  lv_object_key            " String
             iv_object_type =   'EQUI'               " String
           IMPORTING
             ev_object_key =   lv_int_obj_key                " String
          SHIFT lv_int_obj_key LEFT DELETING LEADING '0'.
          ls_hier_return-object_key = lv_int_obj_key.
        ELSE.
          SHIFT ls_hier_return-object_key BY 1 PLACES.
          lv_object_key = ls_hier_return-object_key.
          obj_len = strlen( lv_object_key ).
          IF obj_len GE 18.
            lv_object_key = lv_object_key+0(18).
          ENDIF.
          SHIFT lv_object_key LEFT DELETING LEADING '0'.
          ls_hier_return-object_key = lv_object_key.
        ENDIF.
        MODIFY lt_hier_return FROM ls_hier_return TRANSPORTING object_key object_key.
      ENDLOOP.
    LOOP AT lt_hier_level INTO ls_hier_level.
       IF ls_hier_level-object_key(1) = 'T'.
         SHIFT ls_hier_level-object_key BY 1 PLACES.
         lv_object_key = ls_hier_level-object_key.
         lv_funcloc_ext = lv_object_key.
         CALL FUNCTION 'CONVERSION_EXIT_TPLNR_OUTPUT'
           EXPORTING
             input  = lv_funcloc_ext
           IMPORTING
             output = lv_funcloc.
         lv_int_obj_key = lv_funcloc.
         ls_hier_level-object_key = lv_int_obj_key.
       ELSEIF ls_hier_level-object_key(1) = 'E'.
         SHIFT ls_hier_level-object_key BY 1 PLACES.
         lv_int_obj_key = ls_hier_level-object_key.
         obj_len = strlen( lv_int_obj_key ).
         IF obj_len GE 18.
           lv_int_obj_key = lv_int_obj_key+0(18).
         ENDIF.
         wd_comp_controller->conv_ext_2_int(
          EXPORTING
            iv_object_key_ext =  lv_int_obj_key            " String
            iv_object_type =   'EQUI'               " String
          IMPORTING
            ev_object_key =   lv_int_obj_key                " String
         SHIFT lv_int_obj_key LEFT DELETING LEADING '0'.
         ls_hier_level-object_key = lv_int_obj_key.
       ELSE.
         SHIFT ls_hier_level-object_key BY 1 PLACES.
         lv_int_obj_key = ls_hier_level-object_key.
         obj_len = strlen( lv_int_obj_key ).
         IF obj_len GE 18.
           lv_int_obj_key = lv_int_obj_key+0(18).
         ENDIF.
         SHIFT lv_int_obj_key LEFT DELETING LEADING '0'.
         ls_hier_level-object_key = lv_int_obj_key.
       ENDIF.
       MODIFY lt_hier_level FROM ls_hier_level TRANSPORTING object_key object_key.
    ENDLOOP.
    *********************Getinfo if root node else call Get_Children_Info to generate the structure as well*******
      IF lv_path EQ '1.ENTRIES.1'.
        element = wd_context->path_get_element( lv_path ).
      navigate from <ENTRIES> to <SUB_ENTRIES> via lead selection
        node_sub_entries = element->get_child_node( name = 'SUB_ENTRIES' ).
        element->get_attribute( EXPORTING name = 'OBJECT_KEY'
                                 IMPORTING value = item_object_key ).
        element->get_attribute( EXPORTING name =  `OBJECT_TYPE`
                                IMPORTING value = item_object_type ).
    ****************Get Info of Technical Objects*************
        wd_comp_controller->get_children_info(
          EXPORTING
            iv_lt_list =     lt_hier_return           " Rplm_Tt_Mt_Struc
            iv_path = ''
            iv_hier_level  = lt_hier_level
          IMPORTING
            ev_lt_full =      lt_hier_return                   " Rplm_Tt_Mt_Struc
    Create the strcuture by binding the entries to Node which is bound to the table
    element = wd_context->path_get_element( lc_path ).
    Get children node
            node_sub_entries = element->get_child_node( 'SUB_ENTRIES' ).
            CALL METHOD node_sub_entries->bind_table
              EXPORTING
                new_items            = lt_hier_return
                set_initial_elements = abap_true.
      @TODO handle not set lead selection
       IF ( node_entries IS INITIAL ).
       ENDIF.
       lv_temp = 1.
    ***************Sort the LT_HIER_TABLE appropriately ******
       LOOP AT lt_hier_return INTO ls_hier_return .
         MOVE-CORRESPONDING ls_hier_return TO ls_hier_return_sort.
         ls_hier_return_sort-path_length = strlen( ls_hier_return_sort-path ).
         APPEND ls_hier_return_sort TO lt_hier_return_sort.
       ENDLOOP.
       SORT lt_hier_return_sort BY path_length ASCENDING path ASCENDING.
       CLEAR lt_hier_return.
       LOOP AT lt_hier_return_sort INTO ls_hier_return_sort.
         MOVE-CORRESPONDING ls_hier_return_sort TO ls_hier_return.
         APPEND ls_hier_return TO lt_hier_return.
       ENDLOOP.
    *wd_comp_controller->gv_master_data = lt_hier_return.
       LOOP AT lt_hier_return INTO ls_hier_return.
         lv_path = ls_hier_return-path.
         lc_path = ls_hier_return-parent_path.
         IF lv_path NE '1.ENTRIES.1'.
           element = wd_context->path_get_element( lc_path ).
    Get children node
           node_sub_entries = element->get_child_node( 'SUB_ENTRIES' ).
    Now, create the children elements
           element->get_attribute( EXPORTING name = 'OBJECT_KEY'
                                   IMPORTING value = ls_hier_level-predecessor ).
    Create the strcuture by binding the entries to Node which is bound to the table
           CALL METHOD node_sub_entries->bind_structure
             EXPORTING
               new_item             = ls_hier_return
               set_initial_elements = abap_false.
         ENDIF.
       ENDLOOP.
    Only when a new level is reached we create one more child node
    else we attach our elements to same child node
        element = wd_context->path_get_element( item_path ).
    Get children node
        element->set_attribute(
        value = abap_false
        name = 'IS_EXPANDED' ).
      ENDIF.
      navigate from <CONTEXT> to <GENERAL> via lead selection
      node_general = wd_context->get_child_node( name = wd_this->wdctx_general ).
      get element via lead selection
      elem_general = node_general->get_element(  ).
      get single attribute
      elem_general->set_attribute(
        name =  `COLLAPSE_VISIBILITY`
        value = abap_false ).
      node_selected_entry = wd_context->get_child_node( name = if_structure_view_new=>wdctx_selected_entry ).
      get element via lead selection
      elem_selected_entry = node_selected_entry->get_element(  ).
      get single attribute
      elem_selected_entry->set_attribute(
          name =  `OBJECT_KEY`
          value = '' ).
      elem_selected_entry->set_attribute(
            name =  `OBJECT_TYPE`
            value = '' ).
    get element via lead selection
      elem_context = wd_context->get_element(  ).
    get single attribute
      elem_context->set_attribute(
        name =  `EXPAND_ALL`
        value = abap_false ).
      wd_this->enable_buttons(
    endmethod.

  • Dynamic Table UI Element with different data type for each cell

    Hi Experts,
    I have a problem with a dynamic Table UI Element in Web Dynpro ABAP. I have the following coding:
    METHOD set_col_row .
      TYPE-POOLS: icon.
      DATA:
        lv_node         TYPE REF TO if_wd_context_node,
        lv_node_info    TYPE REF TO if_wd_context_node_info,
        lv_element      TYPE REF TO if_wd_context_element,
        lt_attributes   TYPE wdr_context_attr_info_map,
        lv_table        TYPE REF TO cl_wd_table,
        lv_table_column TYPE REF TO cl_wd_table_column,
        lv_text_view    TYPE REF TO cl_wd_text_view,
        lv_image TYPE REF TO cl_wd_image,
        lv_text_edit TYPE REF TO cl_wd_text_edit,
        lv_header       TYPE REF TO cl_wd_caption,
        attribute       LIKE LINE OF lt_attributes,
        lv_index       TYPE string,
        lv_cur_row         TYPE i,
        path            TYPE string,
        lv_value           TYPE string,
        attr_name       TYPE string,
        l_trc_point_id  TYPE string,
        l_num_cols      TYPE string,
        l_num_rows      TYPE string,
        lv_text         TYPE string,
        lv_index2 TYPE i,
        lr_ress_selections TYPE REF TO /its/di_2_cpr_ress_selections,
        lt_comp_tab TYPE cl_abap_structdescr=>component_table,
        ls_comp_tab LIKE LINE OF lt_comp_tab,
        lv_count TYPE i,
        lv_col_count TYPE i,
        lv_col_count_read TYPE i,
        lv_index_read TYPE i,
        lv_num_cols_minus_1 TYPE i,
        lv_bind_lv_value TYPE string,
        wd_standard_cell TYPE REF TO cl_wd_table_standard_cell,
        lv_data_count TYPE i,
        lv_data_count_str TYPE string,
        wd_table_column TYPE REF TO cl_wd_table_column,
        lv_column_id TYPE string.
      FIELD-SYMBOLS:
         TYPE ANY.
    Instanz der Klasse /ITS/DI_2_CPR_RESS_SELECTIONS
      lr_ress_selections = /its/di_2_cpr_ress_selections=>factory( ).
      ASSIGN lr_ress_selections->gr_table->* TO gt_comp_tab.
      ls_comp_tab-name = 'SUMME'.
    APPEND ls_comp_tab TO lt_comp_tab.
    ls_comp_tab-name = 'CELL_VARIANT'.
      APPEND ls_comp_tab TO lt_comp_tab.
      CLEAR ls_comp_tab.
      l_num_rows = num_rows + 1.
      CONDENSE l_num_rows.
      l_num_cols = num_columns + 1.
      CONDENSE l_num_cols.
    UI-Element 'TABLE'
      lv_table ?= wd_this->m_view->get_element( 'TBL_TABLE' ).
      lv_table->remove_all_columns( ).
    Kontext-Knoten 'TABLE'
      lv_node = wd_context->get_child_node( 'TABLE' ).
      lv_node_info = lv_node->get_node_info( ).
      lv_node_info->remove_dynamic_attributes( ).
      attribute-type_name = 'STRING'.
      lv_num_cols_minus_1 = num_columns - 1.
    Für jede Spalte einmal tun
      DO lv_num_cols_minus_1 TIMES.
        lv_index = sy-index + 1.
        CONDENSE lv_index.
        lv_table_column = cl_wd_table_column=>new_table_column( ).
        lv_column_id = lv_table_column->id.
    Spaltenüberschriften setzen
        IF lv_index EQ 1. "Beim ersten Durchlauf --> erste Spalte = "Ressourcen"
          lv_text = text-010.
          sy-index = 0.
        ELSE. "Danach für jede weitere Spalte eine Zeile aus der gt_comp_tab nehmen
          lv_index_read = lv_index - 1.
          READ TABLE lt_comp_tab INDEX lv_index_read INTO ls_comp_tab.
          lv_text = ls_comp_tab-name.
          lv_header = cl_wd_caption=>new_caption( text = lv_text ).
          lv_table_column->set_header( lv_header ).
        ENDIF.
        CONCATENATE 'TABLE.A' lv_index INTO path.
        lv_text_view = cl_wd_text_view=>new_text_view( bind_text = path ).
        lv_table_column->set_table_cell_editor( lv_text_view ).
        lv_table_column->bind_selected_cell_variant( 'TABLE.CELL_VARIANT' ).
        lv_table->add_column( lv_table_column ).
        wd_table_column ?= wd_this->m_view->get_element( lv_column_id ).
    *****************Test Cell Variant*************************************************
        IF lv_index GT 1.
          LOOP AT .
              IF sy-tabix EQ lv_cur_row.
              Name zuweisen
                ASSIGN COMPONENT 'NAME' OF STRUCTURE .
              Zuweisen ob Blatt oder nicht
                lv_element->set_attribute( name = 'NAME' value = lv_value ).
                ASSIGN COMPONENT 'IS_LEAF' OF STRUCTURE set_attribute( name = attr_name value = lv_value ).
              ENDIF.
        ENDLOOP.
    Now my problem is, that I need for every ROW of my table UI Element a different cell editor. I know how to change it for the column. But is not my issue. I want to have images (traffic lights red and green) in some rows. The other rows should have numbers. The coding works, so that I have all the data at the right place in my table, only the images are shown as a string, because the cells of these rows have the cell editor Text_View. I tried something with cell variants (with cl_wd_table_standard_cell), but it was not possible for me to get a cell variant "image" in these cells/rows were I need it. 
    I hope you understand my problem and now what to do here.
    Thanks a lot in advance.
    Best Regards,
    Ingmar

    Hi Experts, I have a problem with a dynamic Table UI Element in Web Dynpro ABAP. I have the following coding: METHOD set_col_row . TYPE-POOLS: icon. DATA: lv_node TYPE REF TO if_wd_context_node, lv_node_info TYPE REF TO if_wd_context_node_info, lv_element TYPE REF TO if_wd_context_element, lt_attributes TYPE wdr_context_attr_info_map, lv_table TYPE REF TO cl_wd_table, lv_table_column TYPE REF TO cl_wd_table_column, lv_text_view TYPE REF TO cl_wd_text_view, lv_image TYPE REF TO cl_wd_image, lv_text_edit TYPE REF TO cl_wd_text_edit, lv_header TYPE REF TO cl_wd_caption, attribute LIKE LINE OF lt_attributes, lv_index TYPE string, lv_cur_row TYPE i, path TYPE string, lv_value TYPE string, attr_name TYPE string, l_trc_point_id TYPE string, l_num_cols TYPE string, l_num_rows TYPE string, lv_text TYPE string, lv_index2 TYPE i, lr_ress_selections TYPE REF TO /its/di_2_cpr_ress_selections, lt_comp_tab TYPE cl_abap_structdescr=>component_table, ls_comp_tab LIKE LINE OF lt_comp_tab, lv_count TYPE i, lv_col_count TYPE i, lv_col_count_read TYPE i, lv_index_read TYPE i, lv_num_cols_minus_1 TYPE i, lv_bind_lv_value TYPE string, wd_standard_cell TYPE REF TO cl_wd_table_standard_cell, lv_data_count TYPE i, lv_data_count_str TYPE string, wd_table_column TYPE REF TO cl_wd_table_column, lv_column_id TYPE string. FIELD-SYMBOLS:  LIKE LINE OF lt_attributes,  TYPE ANY TABLE,  TYPE ANY,  TYPE ANY,  TYPE ANY. * Instanz der Klasse /ITS/DI_2_CPR_RESS_SELECTIONS lr_ress_selections = /its/di_2_cpr_ress_selections=>factory( ). ASSIGN lr_ress_selections->gr_table->* TO . lt_comp_tab = lr_ress_selections->gt_comp_tab. ls_comp_tab-name = 'SUMME'. * APPEND ls_comp_tab TO lt_comp_tab. * ls_comp_tab-name = 'CELL_VARIANT'. APPEND ls_comp_tab TO lt_comp_tab. CLEAR ls_comp_tab. l_num_rows = num_rows + 1. CONDENSE l_num_rows. l_num_cols = num_columns + 1. CONDENSE l_num_cols. * UI-Element 'TABLE' lv_table ?= wd_this->m_view->get_element( 'TBL_TABLE' ). lv_table->remove_all_columns( ). * Kontext-Knoten 'TABLE' lv_node = wd_context->get_child_node( 'TABLE' ). lv_node_info = lv_node->get_node_info( ). lv_node_info->remove_dynamic_attributes( ). attribute-type_name = 'STRING'. lv_num_cols_minus_1 = num_columns - 1. * Für jede Spalte einmal tun DO lv_num_cols_minus_1 TIMES. lv_index = sy-index + 1. CONDENSE lv_index. lv_table_column = cl_wd_table_column=>new_table_column( ). lv_column_id = lv_table_column->id. * Spaltenüberschriften setzen IF lv_index EQ 1. "Beim ersten Durchlauf --> erste Spalte = "Ressourcen" lv_text = text-010. sy-index = 0. ELSE. "Danach für jede weitere Spalte eine Zeile aus der gt_comp_tab nehmen lv_index_read = lv_index - 1. READ TABLE lt_comp_tab INDEX lv_index_read INTO ls_comp_tab. lv_text = ls_comp_tab-name. lv_header = cl_wd_caption=>new_caption( text = lv_text ). lv_table_column->set_header( lv_header ). ENDIF. CONCATENATE 'TABLE.A' lv_index INTO path. lv_text_view = cl_wd_text_view=>new_text_view( bind_text = path ). lv_table_column->set_table_cell_editor( lv_text_view ). lv_table_column->bind_selected_cell_variant( 'TABLE.CELL_VARIANT' ). lv_table->add_column( lv_table_column ). wd_table_column ?= wd_this->m_view->get_element( lv_column_id ). ******************Test Cell Variant************************************************** IF lv_index GT 1. LOOP AT  ASSIGNING . ASSIGN COMPONENT 'TYPE' OF STRUCTURE  TO . ADD 1 TO lv_data_count. lv_data_count_str = lv_data_count. CONCATENATE 'A' lv_index lv_data_count_str INTO path. wd_standard_cell = cl_wd_table_standard_cell=>new_table_standard_cell( view = wd_this->m_view variant_key = 'FLDATE' ). IF  = '01' OR  = '04'. lv_image = cl_wd_image=>new_image( bind_source = path view = wd_this->m_view ). wd_standard_cell->set_editor( lv_image ). wd_standard_cell->set_cell_design( '01' ). ELSE. lv_text_view = cl_wd_text_view=>new_text_view( bind_text = path view = wd_this->m_view ). wd_standard_cell->set_editor( lv_text_view ). wd_standard_cell->set_cell_design( '02' ). ENDIF. wd_table_column->add_cell_variant( wd_standard_cell ). ENDLOOP. ENDIF. ************************************************************************************* CONCATENATE 'A' lv_index INTO attribute-name. lv_node_info->add_attribute( attribute ). ENDDO. DO num_rows TIMES." Für jede Zeile einmal tun lv_cur_row = sy-index. lv_element = lv_node->create_element( ). lv_node->bind_element( new_item = lv_element set_initial_elements = abap_false ). DO l_num_cols TIMES. ADD 1 TO lv_col_count. IF lv_count LT 1. LOOP AT  ASSIGNING . IF sy-tabix EQ lv_cur_row. * Name zuweisen ASSIGN COMPONENT 'NAME' OF STRUCTURE  TO . "NAME lv_value = . * Zuweisen ob Blatt oder nicht lv_element->set_attribute( name = 'NAME' value = lv_value ). ASSIGN COMPONENT 'IS_LEAF' OF STRUCTURE  TO . "NAME lv_value = . lv_element->set_attribute( name = 'IS_LEAF' value = lv_value ). ENDIF. ENDLOOP. ENDIF. IF lv_count GT 0. lv_col_count_read = lv_col_count - 1. lv_index = sy-index. LOOP AT  ASSIGNING . IF sy-tabix EQ lv_cur_row. CLEAR ls_comp_tab. READ TABLE lt_comp_tab INDEX lv_col_count_read INTO ls_comp_tab. ASSIGN COMPONENT ls_comp_tab-name OF STRUCTURE  TO . lv_value = . CONDENSE lv_index. CONCATENATE 'A' lv_index INTO attr_name. lv_element->set_attribute( name = attr_name value = lv_value ). ENDIF. ENDLOOP. ENDIF. lv_count = lv_count + 1. ENDDO. CLEAR lv_col_count. CLEAR lv_count. ENDDO. ENDMETHOD. I definied my table in Layout Tab of the View and create here in thos method dynamicly my columns. lv_table_column = cl_wd_table_column=>new_table_column( ). . . lv_table->add_column( lv_table_column ). In  I have my data that should be shown later in my table. So I create for each row in this fieldsymbol in a loop: lv_element = lv_node->create_element( ). lv_node->bind_element( new_item = lv_element set_initial_elements = abap_false ). Later I fill every cell in my table with a different value with this loop: LOOP AT  ASSIGNING . IF sy-tabix EQ lv_cur_row. CLEAR ls_comp_tab. READ TABLE lt_comp_tab INDEX lv_col_count_read INTO ls_comp_tab. ASSIGN COMPONENT ls_comp_tab-name OF STRUCTURE  TO . lv_value = . CONDENSE lv_index. CONCATENATE 'A' lv_index INTO attr_name. lv_element->set_attribute( name = attr_name value = lv_value ). ENDIF. ENDLOOP. Now my problem is, that I need for every ROW of my table UI Element a different cell editor. I know how to change it for the column. But is not my issue. I want to have images (traffic lights red and green) in some rows. The other rows should have numbers. The coding works, so that I have all the data at the right place in my table, only the images are shown as a string, because the cells of these rows have the cell editor Text_View. I tried something with cell variants (with cl_wd_table_standard_cell), but it was not possible for me to get a cell variant "image" in these cells/rows were I need it. I hope you understand my problem and now what to do here. Thanks a lot in advance. Best Regards, Ingmar

  • Dynamic insertion of MIME object into a web dynpro component

    Hi,
    I want to dynamically insert a MIME object of type JPEG or type GIF into my web dynpro component at runtime.
    I was unable to find the database table which contains the list of MIME objects for a particular web dynpro component.
    Can you please help me out with this?
    Thanks in advance,
    Adithya
    Moderator message: wrong forum, please have a look in the "Web Dynpro ABAP" forum.
    Edited by: Thomas Zloch on May 23, 2011 9:55 AM

    Hi Muzammil Bichoo ,
                                   when you copy the wda component, it will be copied and will be in active state, once all the components are activated means, windows, views, everything will be available.
    now create application for your component, if you have more than one window(interface view) select the one which you need for the application.
    Regards
    Sarath

Maybe you are looking for

  • Airplay Mirroring

    Airplay Mirroring show not devices detected, the Apple TV is on, can i help you please

  • Identity Synchronization for Windows- still supported?

    Hello, I am doing some testing for a customer who is interested in syncing up his Active Directory and System Directory Server information, so I have been trying to build this solution in our lab. From what I have read, this can be done with Identity

  • Problem with refreshing pdf in preview

    I have a pdf open in preview which I am generating using latex. Every time I generate it, preview takes me to the first page. But in Leopard, it used to stay in the same page, which was very useful in checking the changes I made to the pdf. Is it a b

  • What is the exact reason behind this

    Hi, Can some one say why the output of the following program results 251.67000000000002. Mathematically above is wrong. What is the meaning fo the last digit 2; Mathematically it should result 251.67 double y= 258.67; double z= 7.00; System.out.print

  • How to stop planing for Sales Order Quotation?

    Dear Experts, Please help. Scenario: Material = X Material type = KMAT Strategy Group = 20 For Material X, quotations are created before actual sales order creation. These quotations particapte in MRP run and trigger material planning. The need is :