Dynamic contexts

hi All,
I have created node and value attribute dynamically in the a view and the controller. but not mapped them, since i m binding dynamically generated Dropdowns to these attributes,mapping the nodes of the view and controller is making the dropdown disabled. so i have not mapped the view node and the controller node.
the code i have used to create these are below.
now i want the values selected from the dropdown in the view to be available in the controller.
how can i do this ?
plz help.
*View:* wddoinit() method
//creates a node called TaskLst in the view
IWDNodeInfo viewnodeInfo = wdThis.wdGetAPI().getContext()
                    .getRootNodeInfo()
                               .addChild("TaskLst",null,true,true,false,false,false,true,null,null,null);
//creates 15 value attributes inside node TaskList with name Task + i and value taken form data dictionary.          
for(int i = 0;i<15;i++)
viewnodeInfo .addAttribute("Task"+i,"com.xyz.dynamic.taskvalue");
*View:* wddomodify() method
//creating dropdowns dynamically and binding it to dynamically generated attributes
for(int i =0; i<20;i++)
    IWDAttributeInfo attrInfo = wdThis.wdGetAPI().getContext().getRootNode().getChildNode("TaskLst",IWDNode.LEAD_SELECTION).getNodeInfo().getAttribute("Task"+i);
IWDDropDownByKey downByKey = (IWDDropDownByKey)view.createElement(IWDDropDownByKey.class,"drop"+i);
downByKey.bindSelectedKey(attrInfo);
matData = (IWDMatrixData)downByKey.createLayoutData(IWDMatrixData.class);
Controller :
//creates a node called TaskList in the controller
IWDNodeInfo CustnodeInfo = wdThis.wdGetAPI().getContext()
                    .getRootNodeInfo()
                               .addChild("TaskList",null,true,true,false,false,false,true,null,null,null);
//creates 15 value attributes inside node TaskList with name Task + i and value taken form data dictionary.          
for(int i = 0;i<15;i++)
CustnodeInfo .addAttribute("Task"+i,"com.xyz.dynamic.taskvalue");

since i m binding dynamically generated Dropdowns to these attributes,mapping the nodes of the
view and controller is making the dropdown disabled.
What do you mean by this.. AFAIK, binding the mapped node is not the reason for this. If the drop downs
are disabled, it is because the node that is bound doesn't contain any elements. So, create an element to
the node that is bound to the drop down..It should work..

Similar Messages

  • Set Data from a Dynamic Context in ALV

    Hi,
    I've created an dynamic context and have binded the data. When I want to show this data in an dynamicly table with the following code, it works well.
    cl_wd_dynamic_tool=>create_table_from_node( EXPORTING ui_parent      = lo_container
                                                              table_id       = 'DYN_ML_TABLE'
                                                              node           = lo_nd_dyn_ml
                                                    RECEIVING table          = lo_table ).
    Unfortunately when I want to show the context data in an ALV table with the method set_data I will see the structure, but the binded data are lost.
    lo_comp_alv = wd_this->wd_cpuse_usage_alv_dyn_ml( ).
      IF lo_comp_alv->has_active_component( ) IS INITIAL.
        lo_comp_alv->create_component( ).
      ENDIF.
      lo_comp_if_alv = wd_this->wd_cpifc_usage_alv_dyn_ml( ).
      lo_comp_if_alv->set_data( lo_nd_dyn_ml ).
    I've tested an manually created context node with this method, and I will see the data.
    Could anybody help me?
    Best Regards,
    Sascha

    I created the node with rtti. Now, it works:
    "Beschreibung zu interner Tabelle lesen
       lo_tab_descr ?= cl_abap_typedescr=>describe_by_data( it_matchlist ).
       "Zeilentyp zu interner Tabelle ermitteln
       lo_str_descr ?= lo_tab_descr->get_table_line_type( ).
       "Komponente der Zeile ausgeben, welche für die Erstellung der Knotenattribute benötigt werden
       lt_comp = lo_str_descr->get_components( ).
       data: ls_component type cl_abap_structdescr=>component,
             lr_type type ref to cl_abap_datadescr,
             lt_components type cl_abap_structdescr=>component_table,
             lr_structdescr type ref to cl_abap_structdescr.
       "Loop über Komponente und Einfügen in Attributenliste
       loop at lt_comp into ls_comp.
         lv_abs_name = ls_comp-type->absolute_name.
         "Folgende Zeichen werden entfernt: '/TYPE='
         shift lv_abs_name left by 6 places.
         lr_type ?= cl_abap_typedescr=>describe_by_name( p_name = lv_abs_name ).
         ls_component-name = ls_comp-name.
         ls_component-type = lr_type .
         append ls_component to lt_components.
       endloop.
       "Strukturtyp anhand der definierten Kompententen der internen Tabelle erzeugen
       lr_structdescr = cl_abap_structdescr=>create( p_components = lt_components ).
    *  "Neuen Kindknoten anlegen
       lo_nd_dyn_info = lo_nd_root_info->add_new_child_node( name                         = wd_this->gd_matchlist_nd_name
                                                             is_mandatory                 = abap_false
                                                             is_mandatory_selection       = abap_false
                                                             is_multiple                  = abap_true
                                                             is_multiple_selection        = abap_false
                                                             is_singleton                 = abap_false
                                                             is_initialize_lead_selection = abap_true
    *                                                        attributes                   = lt_attributes
                                                             is_static                    = abap_false
                                                             static_element_rtti          = lr_structdescr
                                                             "supply_method                =
                                                             "supply_object                =
                                                             "dispose_method               =
                                                             "dispose_object               =
                                                             "static_element_type          =

  • Error creating dynamic context node in Webdynpro for ABAP. Plesae help!

    Hi
       I am getting the following error while creating a dynamic context node with 2 attributes. Please help me resolve this problem.
    Note
    The following error text was processed in the system PET : Line types of an internal table and a work area not compatible.
    The error occurred on the application server FMSAP995_PET_02 and in the work process 0 .
    The termination type was: RABAX_STATE
    The ABAP call stack was:
    Method: IF_WD_CONTEXT_NODE~GET_STATIC_ATTRIBUTES_TABLE of program CL_WDR_CONTEXT_NODE_VAL=======CP
    Method: GET_REF_TO_TABLE of program CL_SALV_WD_DATA_TABLE=========CP
    Method: EXECUTE of program CL_SALV_WD_SERVICE_MANAGER====CP
    Method: APPLY_SERVICES of program CL_SALV_BS_RESULT_DATA_TABLE==CP
    Method: REFRESH of program CL_SALV_BS_RESULT_DATA_TABLE==CP
    Method: IF_SALV_WD_COMP_TABLE_DATA~MAP_FROM_SOURCE_DATA of program CL_SALV_WD_C_TABLE_V_TABLE====CP
    Method: IF_SALV_WD_COMP_TABLE_DATA~MAP_FROM_SOURCE of program CL_SALV_WD_C_TABLE_V_TABLE====CP
    Method: IF_SALV_WD_COMP_TABLE_DATA~UPDATE of program CL_SALV_WD_C_TABLE_V_TABLE====CP
    Method: IF_SALV_WD_VIEW~MODIFY of program CL_SALV_WD_C_TABLE_V_TABLE====CP
    Method: IF_SALV_WD_COMPONENT~VIEW_MODIFY of program CL_SALV_WD_A_COMPONENT========CP
    My code is like the following:
    TYPES: BEGIN OF t_type,
                CARRID TYPE sflight-carrid,
                CONNID TYPE sflight-connid,
             END OF t_type.
      Data:  i_struc type table of t_type,
      dyn_node   type ref to if_wd_context_node,
      rootnode_info   type ref to if_wd_context_node_info,
      i_node_att type wdr_context_attr_info_map,
      wa_node_att type line of wdr_context_attr_info_map.
          wa_node_att-name = 'CARRID'.
          wa_node_att-TYPE_NAME = 'SFLIGHT-CARRID'.
          insert wa_node_att into table i_node_att.
          wa_node_att-name = 'CONNID'.
          wa_node_att-TYPE_NAME = 'SFLIGHT-CONNID'.
          insert wa_node_att into table i_node_att.
    clear i_struc. refresh i_struc.
      select carrid connid into corresponding fields of table i_struc from sflight where carrid = 'AA'.
    rootnode_info = wd_context->get_node_info( ).
    rootnode_info->add_new_child_node( name = 'DYNFLIGHT'
                                       attributes = i_node_att
                                       is_multiple = abap_true ).
    dyn_node = wd_context->get_child_node( 'DYNFLIGHT' ).
    dyn_node->bind_table( i_struc ).
    l_ref_interfacecontroller->set_data( dyn_node ).
    I am trying to create a new node. That is
    CONTEXT
    - DYNFLIGHT
    CARRID
    CONNID
    As you see above I am trying to create 'DYNFLIGHT' along with the 2 attributes which are inside this node. The structure of the node that is, no.of attributes may vary based on some condition. Thats why I am trying to create a node dynamically.
    Also I cannot define the structure in the ABAP dictionary because it changes based on condition

    Ok, I think I found a bug... It seems for adobe forms in WD4A, the root context node must be 1-1 and you must nest the 1-n node within that... Not sure why, but it worked. So in my case my context would look like this:
    FOO_NODE (1-1)
         Widget (1-N)
              -Widget_info (1-1)
                   *Name
                   *Sku
                   *Description
              -Widget_plant (1-M)
                   *Plant_Code
                   *Plant_State
                   *Plant_City
              -Widget_pic (1-1)
                   *Picture

  • How to create dynamic context based on a structure defined in the program?

    Hi Experts,
             I need to create a dynamic context based on a structure wa_struc which i have define programatically.
    When I pass wa_struc to structure_name parameter of create_nodeinfo_from_struc, i get a runtime error:
    "Parameter STRUCTURE_NAME contains an invalid value wa_struc."
    How to create dynamic context based on a structure defined in the program?
    I have written the code like this:
    TYPES: BEGIN OF t_type,
                v_carrid TYPE sflight-carrid,
                v_connid TYPE sflight-connid,
             END OF t_type.
      Data:  i_struc type table of t_type,
             wa_struc type t_type.
      data: dyn_node   type ref to if_wd_context_node.
      data: rootnode_info   type ref to if_wd_context_node_info.
      rootnode_info = wd_context->get_node_info( ).
      clear i_struc. refresh i_struc.
      select carrid connid into corresponding fields of table i_struc from sflight where carrid = 'AA'.
    cl_wd_dynamic_tool=>create_nodeinfo_from_struct(
      parent_info = rootnode_info
      node_name = 'dynflight'
      structure_name = 'wa_struc'
      is_multiple = abap_true ).
    dyn_node = wd_context->get_child_node( name = 'dynflight' ).
    dyn_node->bind_table( i_struc ).
    Thanks
    Gopal
    Message was edited by: gopalkrishna baliga

    Hi Michelle,
              First of all Special thanks for your informative answers to my other forum questions. I really appreciate your help.
    Coming back to this question I am still waiting for an answer. Please help. Note that my structure is not in a dictionary.
    I am trying to create a new node. That is
    CONTEXT
    - DYNFLIGHT
    CARRID
    CONNID
    As you see above I am trying to create 'DYNFLIGHT' along with the 2 attributes which are inside this node. The structure of the node that is, no.of attributes may vary based on some condition. Thats why I am trying to create a node dynamically.
    Also I cannot define the structure in the ABAP dictionary because it changes based on condition
    I have updated my code like the following and I am getting error:
    TYPES: BEGIN OF t_type,
    CARRID TYPE sflight-carrid,
    CONNID TYPE sflight-connid,
    END OF t_type.
    Data: i_struc type table of t_type,
    dyn_node type ref to if_wd_context_node,
    rootnode_info type ref to if_wd_context_node_info,
    i_node_att type wdr_context_attr_info_map,
    wa_node_att type line of wdr_context_attr_info_map.
    wa_node_att-name = 'CARRID'.
    wa_node_att-TYPE_NAME = 'SFLIGHT-CARRID'.
    insert wa_node_att into table i_node_att.
    wa_node_att-name = 'CONNID'.
    wa_node_att-TYPE_NAME = 'SFLIGHT-CONNID'.
    insert wa_node_att into table i_node_att.
    clear i_struc. refresh i_struc.
    select carrid connid into corresponding fields of table i_struc from sflight where carrid = 'AA'.
    rootnode_info = wd_context->get_node_info( ).
    rootnode_info->add_new_child_node( name = 'DYNFLIGHT'
    attributes = i_node_att
    is_multiple = abap_true ).
    dyn_node = wd_context->get_child_node( 'DYNFLIGHT' ).
    dyn_node->bind_table( i_struc ).
    l_ref_interfacecontroller->set_data( dyn_node ).
    But now I am getting the following error :
    The following error text was processed in the system PET : Line types of an internal table and a work area not compatible.
    The error occurred on the application server FMSAP995_PET_02 and in the work process 0 .
    The termination type was: RABAX_STATE
    The ABAP call stack was:
    Method: IF_WD_CONTEXT_NODE~GET_STATIC_ATTRIBUTES_TABLE of program CL_WDR_CONTEXT_NODE_VAL=======CP
    Method: GET_REF_TO_TABLE of program CL_SALV_WD_DATA_TABLE=========CP
    Method: EXECUTE of program CL_SALV_WD_SERVICE_MANAGER====CP
    Method: APPLY_SERVICES of program CL_SALV_BS_RESULT_DATA_TABLE==CP
    Method: REFRESH of program CL_SALV_BS_RESULT_DATA_TABLE==CP
    Method: IF_SALV_WD_COMP_TABLE_DATA~MAP_FROM_SOURCE_DATA of program CL_SALV_WD_C_TABLE_V_TABLE====CP
    Method: IF_SALV_WD_COMP_TABLE_DATA~MAP_FROM_SOURCE of program CL_SALV_WD_C_TABLE_V_TABLE====CP
    Method: IF_SALV_WD_COMP_TABLE_DATA~UPDATE of program CL_SALV_WD_C_TABLE_V_TABLE====CP
    Method: IF_SALV_WD_VIEW~MODIFY of program CL_SALV_WD_C_TABLE_V_TABLE====CP
    Method: IF_SALV_WD_COMPONENT~VIEW_MODIFY of program CL_SALV_WD_A_COMPONENT========CP
    -Gopal
    Message was edited by: gopalkrishna baliga

  • Dynamic context binding in web dynpro alv

    I use dynamic context binding (see code below to show and edit the ALV table.
    'DB_TABLE' is a tranparent table. It works fine.
    But now this table should be expanded with additional fields which are only known at runtime and could be different from case to case.
    How can I get these fields in the context dynamically?
      DATA:
            rootnode_info TYPE REF TO if_wd_context_node_info,
            dyn_node      TYPE REF TO if_wd_context_node,
            tablename   TYPE string.
      rootnode_info = wd_context->get_node_info( ).
      tablename = 'DB_TABLE'.
      cl_wd_dynamic_tool=>create_nodeinfo_from_struct(
        parent_info = rootnode_info
        node_name = tablename
        structure_name = tablename
        is_multiple = abap_true ).
      DATA:
            stru_tab TYPE REF TO data.
      FIELD-SYMBOLS: <tab> TYPE table.
      CREATE DATA stru_tab TYPE TABLE OF (tablename).
      ASSIGN stru_tab->* TO <tab>.
      SELECT * FROM (tablename) INTO CORRESPONDING FIELDS OF TABLE <tab>.
      dyn_node = wd_context->get_child_node( name = tablename ).
      dyn_node->bind_table( <tab> ).

    You should create a structure dynamically and use this as the context structure. See the coding below, where a structure is created, which contains CARRID and CONNID.
    DATA: node_info type ref to if_wd_context_node_info,
          struct_type TYPE REF TO cl_abap_structdescr,
          table_type  type ref to cl_abap_tabledescr,
          comp_tab    TYPE cl_abap_structdescr=>component_table,
          comp        LIKE LINE OF comp_tab,
          my_table    type ref to data,
          my_row      type ref to data.
      field-symbols: <table> type table,
                     <row> type data,
                     <flight> type sflight.
    * build a structure description from the list of single fields
      comp-name = 'CARRID'.
      comp-type ?= cl_abap_datadescr=>describe_by_name( 'S_CARR_ID' ).
      APPEND comp TO comp_tab.
      comp-name = 'CONNID'.
      comp-type ?= cl_abap_datadescr=>describe_by_name( 'S_CONN_ID' ).
      APPEND comp TO comp_tab.
    * note this structure contains the fields "CONNID" and "CARRID"
      struct_type = cl_abap_structdescr=>create( comp_tab ).
    * now the nodeinfo is created
      node_info = wd_context->get_node_info( ).
      node_info = node_info->add_new_child_node(
        name                         = 'MY_NODE'
        IS_MANDATORY                 = ABAP_true
        IS_MULTIPLE                  = ABAP_true
        STATIC_ELEMENT_RTTI          = struct_type
        IS_STATIC                    = ABAP_false
    * fill new node;
      data: l_node type ref to if_wd_context_node,
            l_flight type STANDARD TABLE OF sflight.
      l_node = wd_context->get_child_node( 'MY_NODE' ).
      l_flight = wd_assist->get_flights( ).
    *  if you could create a local data type, would be fine, but if you have to do it dynamically ...
      struct_type = node_info->GET_STATIC_ATTRIBUTES_TYPE( ).
    * create tabledescriptor from structdescription (standard table, no keys)
      table_type = cl_abap_tabledescr=>create( p_line_type = struct_type ).
      create data my_table type handle table_type.
      assign my_table->* to <table>.
      loop at l_flight assigning <flight>.
        create data my_row type handle struct_type.
        assign my_row->* to <row>.
        move-corresponding <flight> to <row>.
        append <row> to <table>.
      endloop.
      l_node->bind_table( <table> ).

  • Dynamic Context Mapping in Web Dynpro ABAP

    Hi Experts,
    How can I create two dynamic Context nodes, one in ViewController and the other in Component Controller and finally create a context mapping between them?
    Regards,
    Johan Kriek.

    Hi Johan,
    I found a method IF_WD_CONTEXT_NODE_INFO~ADD_NEW_MAPPED_CHILD_NODE that seems to be the one that I am looking for.
    I do have same idea but i have been trying to give solution by using above method,unfortunately here my server is down.check the below code. i didnt check this code due to server down.
    DATA: lo_nd_purchase_header TYPE REF TO if_wd_context_node,
          lo_el_purchase_header TYPE REF TO if_wd_context_element,
    ls_purchase_header TYPE wd_this->element_purchase_header,
          lo_node_info type ref to if_wd_context_node_info,
          lo_child_node_info type ref to if_wd_context_node_info,
          MAPPING_INFO type WDR_CONTEXT_MAPPING_INFO.
    * navigate from <CONTEXT> to <PURCHASE_HEADER> via lead selection
      lo_nd_purchase_header = wd_context->get_child_node( name = wd_this->wdctx_purchase_header ).
                  CALL METHOD LO_ND_PURCHSE_HEADER->GET_NODE_INFO
                    RECEIVING
                      NODE_INFO = lo_node_info.
           MAPPING_INFO-controller = 'ZWDC_ALV'. "conponent name
           MAPPING_INFO-path = 'PURCHASE_HEADER'. "Controller context node name
          CALL METHOD LO_NODE_INFO->ADD_NEW_MAPPED_CHILD_NODE
            EXPORTING
              CHILD_NAME      = 'PURCHASE_HEADER'
              MAPPING_INFO    =  MAPPING_INFO
    *          IS_STATIC       = ABAP_TRUE
            RECEIVING
              CHILD_NODE_INFO = lo_child_node_info

  • To access a dynamic context node defined in a Used Component

    Hi Gurus,
    I need your help with something.
    I have a dynamic context node in ComponentA. I want it in Component B too.
    Component B uses Component A, but I am not able to get access to the context node.
    Is it possible to do this? Any suggestions how to proceed.
    PS: I am trying to do a dynamic mapping. The initial scenario was here, Set data into Model Node on Navigating from a View
    Thanks in advance,
    Anjana R.
    Message was edited by:
            Anjana Raghav

    Hi Gurus,
    Its working now. Earlier, the code was something like this....
    IWDNodeInfo compNode = wdThis.wdGet<i>Comp</i>Interface().wdGetAPI().getContext().getRootNodeInfo().getChild(nodeNm);
    viewNodeInfo.setMapping(compNode,true);
    and was trying to map it using
    iewNodeInfo.addMappedAttribute("order",".<i>Comp</i>."+ nodeNm + ".order");     
    Now, I am mapping like this.
    viewNodeInfo.addMappedAttribute("order","order");
    Thanks,
    Anjana R.

  • Adding dynamic context node

    Hello,
    I having problems with creating a dynamic context node.
    How can i add a new node to the context on runtime and not on design time.
    Best Regards,
    Smadar.

    Hi,
    IWDNodeInfo nodeinfo=wdContext.getNodeInfo();
    /* This will add a ValueNode */
    IWDNodeInfo customerNode=nodeinfo.addChild("Customer",null,true,true,true,false,false,true,null,null,null);
    /* This will add  a Attribute to the above Node */
    IWDAttributeInfo custAttr=customerNode.addAttribute("AttribName","com.sap.dictionary.string");
    Regards, Anilkumar

  • Dynamic Context Dynamic and UI table Dynamic

    Hello,
    I created a dynamic context and a dynamic table that use this dynamic context.  I have the following error:*     *   The following error text was processed in the system XAP : Could not find attribute AMOUNT2009**
    The error occurred on the application server sat190_XAP_00 and in the work process 0 .
    The termination type was: RABAX_STATE
    The ABAP call stack was:
          Method: IF_WD_CONTEXT_NODE_INFO~GET_ATTRIBUTE of program CL_WDR_CONTEXT_NODE_INFO======CP
          Method: GET_ATTRIBUTE_INFO of program CL_WDR_VIEW_ELEMENT_ADAPTER===CP
          Method: IF_WDR_VIEW_ELEMENT_ADAPTER~SET_CONTENT of program /1WDA/L3STANDARD==============CP
          Method: IF_WDR_VIEW_ELEMENT_ADAPTER~SET_CONTENT of program /1WDA/L3STANDARD==============CP
          Method: IF_WDR_VIEW_ELEMENT_ADAPTER~SET_CONTENT of program /1WDA/L3STANDARD==============CP
          Method: IF_WDR_VIEW_ELEMENT_ADAPTER~SET_CONTENT of program /1WDA/L3STANDARD==============CP
          Method: IF_WDR_VIEW_ELEMENT_ADAPTER~SET_CONTENT of program /1WDA/L8STANDARD==============CP
          Method: IF_WDR_VIEW_ELEMENT_ADAPTER~SET_CONTENT of program /1WDA/L8STANDARD==============CP
          Method: IF_WDR_VIEW_ELEMENT_ADAPTER~SET_CONTENT of program /1WDA/L8STANDARD==============CP
          Method: IF_WDR_VIEW_ELEMENT_ADAPTER~SET_CONTENT of program /1WDA/L7STANDARD==============CP
    AMOUNT2009 is a new attribute that add to my context, i made the next code, can you review and say me where i have the error?  I start with the second year is for this reason that i use a count.
    Reading FINCATYGROUP
      DATA lo_nd_fincatygroup TYPE REF TO if_wd_context_node.
      DATA lo_el_fincatygroup TYPE REF TO if_wd_context_element.
      DATA ls_fincatygroup TYPE wd_this->element_fincatygroup.
      DATA :  lv_year   type STRING,
              ls_attribute         type wdr_context_attribute_info, "To create dynamic node in the context
              lr_container         TYPE REF TO CL_WD_UIELEMENT_CONTAINER,
              lr_table             TYPE REF TO CL_WD_TABLE,
              lr_input_field       TYPE REF TO CL_WD_INPUT_FIELD,
              lr_cell_editor       TYPE REF TO if_wd_table_cell_editor,
              lr_column            TYPE REF TO CL_WD_TABLE_COLUMN,
              lr_column_header     TYPE REF TO CL_WD_CAPTION,
              lv_headerColumn      TYPE STRING,
              lv_id_input_field    TYPE STRING,
              lv_name              TYPE STRING,
              lv_id_table_column   TYPE STRING.
      DATA: lr_node_info TYPE REF TO if_wd_context_node_info, "To get node info
      lr_table_type TYPE REF TO cl_abap_tabledescr, "To get table and stuct descriptor
      lr_line_type TYPE REF TO cl_abap_structdescr,
      lt_components TYPE cl_abap_structdescr=>component_table, "To get component table
      ls_components_line LIKE LINE OF lt_components, "One line of component table
      lr_elem_type TYPE REF TO cl_abap_elemdescr.
        LOOP AT lv_periods_tt INTO lv_periods_ts.
      get all declared attributes
          lv_periods_ts->get_static_attributes(
            IMPORTING
              static_attributes = ls_wa_period ).
      navigate from <CONTEXT> to <FINCATYGROUP> via lead selection
          lo_nd_fincatygroup = wd_context->get_child_node( name = wd_this->wdctx_fincatygroup ).
          IF lv_cont = 1 OR lv_cont = 2.
            lv_cont = lv_cont + 1.
          ELSE.
      Create dynamic context and dynamic view
      get node_info
            lr_rootnodeinfo = lo_nd_fincatygroup->get_node_info( ).
            lv_year = ls_wa_period-zyear.
            SHIFT lv_year BY 15 PLACES LEFT.
            CONCATENATE 'AMOUNT' lv_year INTO lv_name.
      put attributes of add_attrbute node
            CONCATENATE 'Y' lv_year INTO ls_attribute-name.
            ls_attribute-name = lv_name.
            ls_attribute-type_name = '\TYPE=/RPM/TV_CURR_AMOUNT'.
            lr_rootnodeinfo->add_attribute( "Add attribute for amount of year
              EXPORTING
                attribute_info = ls_attribute ).
    ********************* table *******************************************************
    Get ROOTUIELEMENTCONTAINER
            lr_container ?= view1->get_element( 'ROOTUIELEMENTCONTAINER ' ).
    Get TABLEFCG
            lr_table ?= view1->get_element( 'TABLEFCG' ).
    Create cell_editor
            CONCATENATE 'TABLEFCGIF_Y' lv_year '_EDITOR' INTO lv_id_input_field.
            lr_input_field = cl_wd_input_field=>new_input_field(
                                  id = lv_id_input_field bind_value = ls_attribute-name ).
            CONCATENATE 'TABLEFCG_Y' lv_year '_EDITOR' INTO lv_headerColumn.
            lr_column_header = cl_wd_caption=>new_caption( id = lv_headerColumn ).
            lr_column_header->set_text( ls_attribute-name ).
    Create table column
            CONCATENATE 'TABLEFCG_' lv_year 'COLUMN' INTO lv_id_table_column.
            lr_column = cl_wd_table_column=>new_table_column( id = lv_id_table_column ).
            lr_column->set_table_cell_editor( lr_input_field ).
            lr_column->set_header( lr_column_header ).
            lr_table->add_grouped_column( lr_column ).
    ********************* end table *******************************************************
          ENDIF.
        ENDLOOP.
    Thanx.

    1.
    Code if the Transparent container's layout is Matrix ( method WDDOMODIFYVIEW )
    data lr_container type ref to cl_wd_transparent_container.
    data lr_input        type ref to cl_wd_input_field.
    data lr_layout_data type ref to cl_wd_matrix_head_data.
       lr_container ?= view->get_element( '<Transparent container ID>' ).
       lr_input = cl_wd_input_field=>new_input_field( bind_value = '<node>.<attribute>'                                                                               
    view = view
                                                                                    ID = 'INP' ).
       lr_layout_data = cl_wd_matrix_head_data=>new_matrix_head_data( element = lr_input width = '100%' ).
    2.
    Dynamic Context Attribute in a node.
    data lr_node     type ref to if_wd_context_node.
    data lr_info       type ref to if_wd_context_node_info.
    data ls_attr       type WDR_CONTEXT_ATTRIBUTE_INFO.
    lr_node = wd_context->get_child_node( '<Node_name>' ).
    lr_info   = lr_node->get_node_info( ).
    ls_attr-name = '<attribute_name>'.
    ls_attr-type_name = 'STRING'.
    lr_info->add_attribute( ls_attr ).

  • Dynamic context nodes

    Hi all,
    I want to create a dynamic context in this way.  But in this example I always need a data element in the dictionary for the describe by name method --> here ZREMARK
    I can use here describe_by_name( 'STRING' ) but then the column headerline is empty.
    How can I set the column headerline when I use this coding?
    comp-name = 'REMARK'.
    comp-type ?= cl_abap_datadescr=>describe_by_name( 'ZREMARK' ).
    APPEND comp TO comp_tab.
    not this structure contains the fields "CONNID" and "CARRID"
      struct_type = cl_abap_structdescr=>create( comp_tab ).
    now the nodeinfo is created
      node_info = wd_context->get_node_info( ).
      node_info = node_info->add_new_child_node(
        name                         = 'MY_NODE'
        is_mandatory                 = abap_false
        is_multiple                  = abap_true
        static_element_rtti          = struct_type
        is_static                    = abap_false
    regards

    >Is it possible to create the columns of the table control in a similar way?
    Yes you can create the table and its columns dynamically in WDDOMODIFYVIEW.  Here is a sample - I'm only creating one column, but it would be easy to adapt this logic to loop through some list of fields to create the columns.
    DATA lr_container TYPE REF TO cl_wd_uielement_container.
      DATA lr_input TYPE REF TO cl_wd_input_field.
      DATA lr_table TYPE REF TO cl_wd_table.
      DATA lr_caption TYPE REF TO cl_wd_caption.
      DATA lr_table_column TYPE REF TO cl_wd_table_column.
      DATA lr_table_standard_cell TYPE REF TO cl_wd_table_standard_cell.
      IF first_time = abap_true.
        lr_container  ?= view->get_element( 'ROOTUIELEMENTCONTAINER' ).
        cl_wd_table=>new_table(
          EXPORTING
            bind_data_source              = 'SFLIGHT.SFLIGHT'
            id                            = 'DYNTABLE'
          RECEIVING
             control                       = lr_table ).
        cl_wd_input_field=>new_input_field(
          EXPORTING
             bind_value             = 'SFLIGHT.SFLIGHT.CARRID'
             id                     = 'INPUT1'
          RECEIVING
            control                = lr_input ).
        lr_table_column = cl_wd_table_column=>new_table_column( ).
        lr_table_column->set_table_cell_editor( lr_input ).
        lr_caption = cl_wd_caption=>new_caption( ).
        lr_caption->set_text( 'Some text' ).
        lr_table_column->set_header( EXPORTING the_header = lr_caption ).
        lr_table->add_column( EXPORTING the_column = lr_table_column ).
    *       create the layout data of the text view
        DATA lr_grid_data TYPE REF TO cl_wd_grid_data.
        lr_grid_data = cl_wd_grid_data=>new_grid_data( lr_table ).
        lr_table->set_layout_data( lr_grid_data ).
        lr_container->add_child(
          EXPORTING
            the_child = lr_table ).
      ENDIF.

  • Create dynamic context node

    Hi Experts,
    I have tried the given example for Dynamic Context Node in Webdynpro ABAP
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/4c70444a-0801-0010-7688-9e4bd844b783
    But getting the Error when executing this application
    Note
    The following error text was processed in the system ISP : Adapter error in &VIEW_ELEMENT_TYPE& "TABLENAME" of view "ZWD_SACHIN_DYN_ALV.MAIN_VIEW": Context binding of property VALUE cannot be resolved: Node MAIN_VIEW.1.INPUT does not contain any elements
    The error occurred on the application server usirs254_ISP_01 and in the work process 0 .
    The termination type was: RABAX_STATE
    The ABAP call stack was:
    Method: RAISE_FOR of program CX_WDR_ADAPTER_EXCEPTION======CP
    Method: RAISE_BINDING_EXCEPTION of program CL_WDR_VIEW_ELEMENT_ADAPTER===CP
    Method: GET_BOUND_ELEMENT of program CL_WDR_VIEW_ELEMENT_ADAPTER===CP
    Please resolve this issue because when I am mapping the Attribute TableName in the InputGroup, it is throwing above Error.
    Thanks in advance
    Regards
    Sachin

    Hi Sachin,
    I am unable to understand why you are getting an error. I have tried the same tutorial myself and it works fine for me. Make sure that the TABLENAME attribute (which is of string type) is properly binded to the value property of the input field.
    Regards
    Arjun
    Edited by: Arjun Thakur on Mar 17, 2009 1:46 PM

  • Using Search Help with ALV and Dynamic context node

    The topic subject already describes my situation.
    I have to create, populate and remove context nodes at runtime, and bind them to an ALV, to let user display the data or modify the data. The nodes I create are always typed with a table name, but the table name is of course, dynamic.
    This is all working: what's not working is help for entries inside the ALV; since the table has foreign keys and domains with check tables or fixed values, I expected that search helps were detected and managed by the framework.
    Instead, no help search is displayed except the input help based on data-type of the one "Date" input fields.
    I think I have to work on the dynamic node creation, and not on the ALV itself, since the latter only takes the node/attributes information, but i could be wrong. I tried with both the two following codings:
      CALL METHOD lo_nd_info_root->add_new_child_node
        EXPORTING
          static_element_type          = vs_tabname
          name                         = 'SAMPLE_NODE_NAME'
    *    is_mandatory                 = abap_false
    *    is_mandatory_selection       = abap_false
         is_multiple                  = abap_true
         is_multiple_selection        = abap_false
    *    is_singleton                 = abap_false
          is_initialize_lead_selection = abap_false
          is_static                    = abap_false
        RECEIVING
          child_node_info              = lo_nd_info_data .
    cl_wd_dynamic_tool=>create_nodeinfo_from_struct(
          parent_info = lo_nd_info_root
          node_name = 'SAMPLE_NODE_NAME'
          structure_name = vs_tabname
          is_multiple = abap_true ).
    The result is the same...is there any way to let the ALV know what search helps it has to use, and doesn't force me to manually build a VALUE_SET to be bound on the single attributes? There are many tables, with many fields, and maintaining this solution would be very costly.

    I have checked with method GET_ATTRIBUTE_VALUEHELP_TYPE of interface IF_WD_CONTEXT_NODE_INFO, on an attribute which i know to have a search help (Foreign key of a check table).
    The method returns 'N', that is the constant IF_WD_VALUE_HELP_HANDLER~CO_VH_TYPE_NO_HELP. So, the framework was not able to find a suitable search help.
    Using method GET_ATTRIBUTE_VALUE_HELP of the same interface, on the same attribute, returns me '111', which is constant C_VALUE_HELP_MODE-AUTOMATIC.
    Therefore, the WD framework knows it has to automatically detect a value help, but fails to find one.
    Also, this means in my opinion that the ALV and the dynamic external mapping are not the culprits: since node creation, no help is detected for any attribute but the date. Honestly, I don't have a clue on what's happening.

  • Using dynamic context attributes with flashisland

    I recently started looking at flashislands.
    Going through the SDN tutorials on this topic, I noticed that the declarations of GACDATASOURCE and GACPROPERTY properties inside web dynpro and their counterpart variables inside flex are a bit static (all naming and binding is done at design time).
    So I'm asking if there's a way inside flex to dynamically capture the values of the attributes of a web dynpro context node that is bound to an ArrayCollection variable inside flex without knowing the names and the amount of the attributes of the context node?
    Here's my situation:
    I have a context node (REPORT_DATA) inside web dynpro that at design time has no attributes.
    The attributes and their names are created dynamically at runtime.
    It is even so, that over time the amount of attributes may vary.
    Inside the web dynpro, the contents of this context node (REPORT_DATA) are shown in a (dynamically built) table.
    Besides using the table, I'm trying to show the same contents as a piechart and as a columnchart in a flashisland.
    The ROOTUIELEMENTCONTAINER of the FlashIsland view in web dynpro only contains a GACDATASOURCE element at design time.
    The 'dataSource' property of this GACDATASOURCE is bound to the context node REPORT_DATA.
    The 'name' property of this GACDATASOURCE is bound to an ArrayCollection variable inside flex (named dataSource).
    So much for the static part created at design time.
    At runtime inside web dynpro the correct GACPROPERTY's are created, based on the - over time changing - amount and the names of the context node.
    Suppose my REPORT_DATA context node at runtime starts with 3 attributes: ATTR1, ATTR2 and ATTR3
    Also suppose the node contains 2 elements: [ {"1_1", "1_2", "1_3"} , {"2_1", "2_2", "2_3"} ]
    The dataSource variable inside flex also contains 2 entries with 3 elements each.
    The code to show the value of (for example) the first element of all entries inside the ArrayCollection variable would be:
    +for each( var o:Object in dataSource) {
    var s:String = o.ATTR1;
    Alert.show( "the 1st value = " + s ); // 1_1 for the first entry, 1_2 for the second
    }+
    I can then use the myAC variable inside flex as dataprovider for various other objects.
    This works fine.
    But inside flex I can only capture the value of an attribute when I know its name at design time (like ATTR1 in the sample code above).
    And that's not what I want.
    Inside flex I want to capture the value of the context attributes dynamically in a (correctly typed) flex variable without knowing the names and the amount of the context attributes.
    Is this possible?
    Thanks in advance for - any - response.
    Bart.

    Hi again,
    I tried the same thing by creating a dummy context node without any attributes, and adding all attributes at runtime using the add_attribute method. In that case too, it doesnt work. All the attributes are available in the dynamic attributes of the node element, but are not getting displayed.
    Any help would be greatly appreciated. Thank you.
    regards,
    nithya

  • ABAP: dynamic context node + attribute for DROP_DOWN_BY_KEY

    Hello,
    I need to create a Node with attributes dynamically and than assign it to a DROP_DOW_BY_KEY element in ABAP.
    I create drop down this way:
    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 ).
    However, here I bind to REPOSITORY.FIGURES. Instead of doing this I need to bind it to an attribute that I create.
    I can access wd_context but I am not sure how to create a node in wd_context, then attribute for that node that will contain items for drop down.
    bind_selected_key is type of String. If I create a node with attribute how do I cast it to a String so I can pass it to a constructor of a drop down?
    Thank you.

    Hi Georgy,
    There is a 3 - series weblog for this.
    The first one is:
    /people/thomas.szcs/blog/2005/12/28/dynamic-programming-in-web-dynpro-abap--introduction-and-part-i-understanding-ui-elements
    The following are the the general steps for creating a node and table where table name is input by the user:
    DATA:
      UI Elements
        group_1       TYPE REF TO cl_wd_uielement_container,
        new_tab       TYPE REF TO cl_wd_table,
      Context Nodes
        dyn_node      TYPE REF TO if_wd_context_node,
        tabname_node  TYPE REF TO if_wd_context_node,
      Node Info
        rootnode_info TYPE REF TO if_wd_context_node_info,
      Data Reference (for internal table)
        stru_tab      TYPE REF TO data,
      String (for table name)
        tablename     TYPE string.
      FIELD-SYMBOLS:
        <tab> TYPE table.
    1) * get node info of context root node
      rootnode_info = wd_context->get_node_info( ).
    2) * create sub node named TEST1 of structure (tablename)
      cl_wd_dynamic_tool=>create_nodeinfo_from_struct(
        parent_info = rootnode_info
        node_name = tablename
        structure_name = tablename
        is_multiple = abap_true ).
    3) * get instance of new node
      dyn_node = wd_context->get_child_node( name = tablename ).
    4) ***** create new UI element table *******************************************************
      new_tab = cl_wd_dynamic_tool=>create_table_from_node(
    ui_parent = group_1
    table_id  = 'TESTTAB'
    node      = dyn_node ).
    5) ***** fill context node with data *******************************************************
    create internal table of (tabletype)
      CREATE DATA stru_tab TYPE TABLE OF (tablename).
      ASSIGN stru_tab->* TO <tab>.
    Get table content
      SELECT * FROM (tablename) INTO CORRESPONDING FIELDS OF TABLE <tab>.
    Bind internal table to context node.
      dyn_node->bind_table( <tab> ).
    Regards,
    Srini.

  • Dynamic context mapping

    Hello,
    Is it possible to create dynamic mapping between contexts of view and e.g. custom controller at runtime? If it is possible, so how. I have not found any documentation about this.
    Thanks a lot for answers!
    With best regards
    Michael Belenki

    Hi,
    The problem is not getting solved.Am getting an error while trying to dynamically map a node in the view controller from the component controller in ABAP.
    I have a node
                  Const_data(node)
                       |_
                         Value(attribute)
    and it has an attribute 'value' .Both are created dynamically.
    Now when I try to map this context in the view controller.I use the following code.
    map_path = 'COMPONENTCONTROLLER.CONST_DATA.VALUE'.
    insert map_path into table path_mapping_table.
    struct_mapping_info-CONTROLLER = 'COMPONENTCONTROLLER'.
    struct_mapping_info-PATH = path_mapping_table.
    const_dat_info =
    context_root-ADD_NEW_MAPPED_CHILD_NODE
    (                                                    CHILD_NAME   = 'CONST_DATA'
    IS_STATIC    = abap_false                           MAPPING_INFO = struct_mapping_info) .
    Now when I try to get the value of attribute "value".
    I get an error message :
    Attribute COMPONENTCONTROLLER.1.VALUE could not be found
    Since I am not trying an external mapping I dont think I need set_mapping_complete method.

  • Dynamic context in web dynpro abap: recursion node is possible?

    Hi,
    i'm working with web dynpro ABAP and I need to create a dynamic recursion node. Is possible?
    thank you.
    Regards.
    Al

    Hello Saravanan,
    this is my code that creates a context node with recursion node, but supply_method i never called. why? could you help me?
          CALL METHOD lr_root_info->add_new_child_node
            EXPORTING
              name                         = y_name
              is_mandatory                 = abap_false
              is_multiple                  = abap_true
              is_mandatory_selection       = abap_false
              is_multiple_selection        = abap_true
              is_singleton                 = abap_true
              is_initialize_lead_selection = abap_true
              is_static                    = abap_true
              supply_method                = 'SUPPLY_NAV_LIST'
            RECEIVING
              child_node_info              = lr_node_info.
          ls_attribute-name = 'TEXT'.
          ls_attribute-type_name = 'STRING'.
          CALL METHOD lr_node_info->add_attribute
            EXPORTING
              attribute_info = ls_attribute.
          ls_attribute-name = 'ENABLED'.
          ls_attribute-type_name = 'WDY_BOOLEAN'.
          CALL METHOD lr_node_info->add_attribute
            EXPORTING
              attribute_info = ls_attribute.
          lr_node_info->add_recursive_child_node( child_name = y_name_nav child_info = lr_node_info is_static = abap_false ).
    Thank you.
    Al

Maybe you are looking for