How to create a node with attributes at runtime in webdynpro for ABAP?

Hi Experts,
         How to create a node with attributes at runtime in webdynpro for ABAP? What classes or interfaces I should use? Please provide some sample code.
I have checked IF_WD_CONTEXT_NODE_INFO and there is ADD_NEW_CHILD_NODE method. But this is not creating any node. I this this creates only a "node info" object.
I even check IF_WD_CONTEXT_NODE but i could not find any method that creates a node with attribute.
Please help!
Thanks
Gopal

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
Message was edited by: gopalkrishna baliga

Similar Messages

  • How to create a node with attribute?

    hi,
    does anyone can help with creating an XML node with only attributes but no value?
    e.g.
    <root>
       <category node_id='ND1'>
          <value id='1'>some value in here</value>
          *<extra_node desc="this is the new node i want to create"/>*
       </category>
       <category node_id='ND2'>
          <value id='1'>some value in here</value>
       </category>
    </root>in the example, what i want to do is to get the category using XPath, and insert one attribute node into it.
    anyone can help? sincerely appreciated!

    No, the question was not about attributes with no value, it was about elements with no value.
    Now I know that the "value" of an element is a meaningless term in XML, but the OP's example shows that the question was how to produce an empty element. Even though the text describes the operation as "insert one attribute node", which doesn't agree with the example.
    It's easy to create an empty element using DOM, but we have no idea whether the OP is talking about DOM programming or what.

  • How to create sharepoint Group with read only permissions using powershell for entire site ?

    How to create sharepoint Group with read only permissions using powershell for entire site (including subsites and top level site)

    Hi
    using (SPSite site = new SPSite(url))
    using (SPWeb web = site.OpenWeb())
    SPUserCollection users = Web.AllUsers;
    SPUser owner = users[string.Format("{0}{1}", "Domain", "Owner Username")];
    SPMember member = users[string.Format("{0}{1}", "Domain", "Default Member Username")];
    SPGroupCollection groups = Web.SiteGroups;
    string GroupName = “Super Exclusive”;//your group name
    string GroupDescription = “Super exclusive group description.”;
    groups.Add(GroupName, owner, member, GroupDescription);
    SPGroup NewSPGroup = groups[GroupName];
    SPRoleDefinition role = Web.RoleDefinitions["Read"];
    SPRoleAssignment roleAssignment = new SPRoleAssignment(NewSPGroup);
    roleAssignment.RoleDefinitionBindings.Add(role);
    Web.RoleAssignments.Add(roleAssignment);
    Web.Update();
    Please 'propose
    as answer' if it helped you, also 'vote
    helpful' if you like this reply.

  • How to create a report with data using the Crystal Reports for Java SDK

    Hi,
    How do I create a report with data that can be displayed via the Crystal Report for Java SDK and the Viewers API?
    I am writing my own report designer, and would like to use the Crystal Runtime Engine to display my report in DHTML, PDF, and Excel formats.  I can create my own report through the following code snippet:
    ReportClientDocument boReportClientDocument = new ReportClientDocument();
    boReportClientDocument.newDocument();
    However, I cannot find a way to add data elements to the report without specifying an RPT file.  Is this possible?  I seems like it is since the Eclipse Plug In allows you to specify your database parameters when creating an RPT file.
    is there a way to do this through these packages?
    com.crystaldecisions.sdk.occa.report.data
    com.crystaldecisions.sdk.occa.report.definition
    Am I forced to create a RPT file for the different table and column structures I have? 
    Thank you in advance for any insights.
    Ted Jenney

    Hi Rameez,
    After working through the example code some more, and doing some more research, I remain unable to populate a report with my own data and view the report in a browser.  I realize this is a long post, but there are multiple errors I am receiving, and these are the seemingly essential ones that I am hitting.
    Modeling the Sample code from Create_Report_From_Scratch.zip to add a database table, using the following code:
    <%@ page import="com.crystaldecisions.sdk.occa.report.application.*"%>
    <%@ page import="com.crystaldecisions.sdk.occa.report.data.*"%>
    <%@ page import="com.crystaldecisions.sdk.occa.report.document.*"%>
    <%@ page import="com.crystaldecisions.sdk.occa.report.definition.*"%>
    <%@ page import="com.crystaldecisions.sdk.occa.report.lib.*" %>
    <%@ page import = "com.crystaldecisions.report.web.viewer.*"%>
    <%
    try { 
                ReportClientDocument rcd = new ReportClientDocument();
                rcd.newDocument();
    // Setup the DB connection
                String database_dll = "Sqlsrv32.dll";
                String db = "qa_start_2012";
                String dsn = "SQL Server";
                String userName = "sa";
                String pwd = "sa";
                // Create the DB connection
                ConnectionInfo oConnectionInfo = new ConnectionInfo();
                PropertyBag oPropertyBag1 = oConnectionInfo.getAttributes();
                // Set new table logon properties
                PropertyBag oPropertyBag2 = new PropertyBag();
                oPropertyBag2.put("DSN", dsn);
                oPropertyBag2.put("Data Source", db);
                // Set the connection info objects members
                // 1. Pass the Logon Properties to the main PropertyBag
                // 2. Set the Server Description to the new **System DSN**
                oPropertyBag1.put(PropertyBagHelper.CONNINFO_CRQE_LOGONPROPERTIES, oPropertyBag2);
                oPropertyBag1.put(PropertyBagHelper.CONNINFO_CRQE_SERVERDESCRIPTION, dsn);
                oPropertyBag1.put("Database DLL", database_dll);
                oConnectionInfo.setAttributes(oPropertyBag1);
                oConnectionInfo.setUserName(userName);
                oConnectionInfo.setPassword(pwd);
                // The Kind of connectionInfos is CRQE (Crystal Reports Query Engine).
                oConnectionInfo.setKind(ConnectionInfoKind.CRQE);
    // Add a Database table
              String tableName = "Building";
                Table oTable = new Table();
                oTable.setName(tableName);
                oTable.setConnectionInfo(oConnectionInfo);
                rcd.getDatabaseController().addTable(oTable, null);
        catch(ReportSDKException RsdkEx) {
                out.println(RsdkEx);  
        catch (Exception ex) {
              out.println(ex);  
    %>
    Throws the exception
    com.crystaldecisions.sdk.occa.report.lib.ReportSDKException: java.lang.NullPointerException---- Error code:-2147467259 Error code name:failed
    There was other sample code on SDN which suggested the following - adding the table after calling table.setDataFields() as in:
              String tableName = "Building";
                String fieldname = "Building_Name";
                Table oTable = new Table();
                oTable.setName(tableName);
                oTable.setAlias(tableName);
                oTable.setQualifiedName(tableName);
                oTable.setDescription(tableName) ;
                Fields fields = new Fields();
                DBField field = new DBField();
                field.setDescription(fieldname);
                field.setHeadingText(fieldname);
                field.setName(fieldname);
                field.setType(FieldValueType.stringField);
                field.setLength(40);
                fields.add(field);
                oTable.setDataFields(fields);
                oTable.setConnectionInfo(oConnectionInfo);
                rcd.getDatabaseController().addTable(oTable, null);
    This code succeeds, but it is not clear how to add that database field to a section.  If I attempt to call the following:
    FieldObject oFieldObject = new FieldObject();
                oFieldObject.setDataSourceName(field.getFormulaForm());
                oFieldObject.setFieldValueType(field.getType());
                // Now add it to the section
                oFieldObject.setLeft(3120);
                oFieldObject.setTop(120);
                oFieldObject.setWidth(1911);
                oFieldObject.setHeight(226);
                rcd.getReportDefController().getReportObjectController().add(oFieldObject, rcd.getReportDefController().getReportDefinition().getDetailArea().getSections().getSection(0), -1);
    Then I get an error (which is not unexpected)
    com.crystaldecisions.sdk.occa.report.lib.ReportDefControllerException: The field was not found.---- Error code:-2147213283 Error code name:invalidFieldObject
    How do I add one of the table.SetDataFields()  to my report to be displayed?
    Are there any other pointers or suggestions you may have?
    Thank you

  • How to create endpoint in the creation of webservice in webdynpro for java

    hi all,
    I have created a EjbModule project in webdynpro. Now when i create a new > other>webservie--> virtual interface, it is asking for an endpoint. How to create this endpoint

    Hi Pinki,
    Chk this link..
    http://help.sap.com/saphelp_nw04/helpdata/en/da/2bf042493ef54499a77394ef6be096/frameset.htm (Section abt Endpoints while Creating a Web Service for an Enterprise JavaBean)
    GS

  • How to create a node with XML

    Hi everybody,
    How can I create an XML node?
    I try whith createnode, but don't work
    Thanks
    Carles

    Thanks Gordon,
    I try do understand, but i can't
    I have:
    oNodo = oDocument.SelectSingleNode("BOM/BO/Documents/row/vers")
    if vers doesn't exist, then i have to create it
    <bom>
    <bo>
    <Documents>
    <row>
    <vers>here i want to set a value</vers>
    </row>
    </Documents>
    </bo>
    </bom>
    I've tried with oNewNodo = oDocument.CreateElement("vers") and it works, but doesn't put where i want
    thanks
    Carles

  • Create dinamic nodes and attributes

    Hi Forum!
    I have created a WDA with 2 views. On the START_VIEW, the user can input details from an installation.  I want to display an error on the START_VIEW when a condition is false.
    How I can create a node with an attribute dinamically to display this error if the message Text View is not defined on the view?
    Could you give me a any sample of code, please?
    Thank you very mucha and regards,
    Manuel.

    Hi Manuel,
    Pleaes try this out. This is how to create an attribute dynamically.
    DATA: attribute      TYPE wdr_context_attribute_info.
    DATA: main_node  TYPE REF TO if_wd_context_node_info.
      "get main node
      main_node = wd_context->get_node_info( ).
      "set name for this attribute
      attribute-name = 'SOME_NAME_4_ATTR'.
      "set data type for this attribute
      attribute-type_name = 'SOME_DATA_TYPE'.
      "add attribute into context node
      main_node->add_attribute( attribute_info = attribute ).
    Thanks.
    Regards,
    Georgy Norkin

  • How can create a JTree with cellRender is checkbox realized multiple selec

    How can create a JTree with cellRender is checkbox realized multiple selection function.thanks for every
    one's help.

    Hi,
    1. Create a value node in your context name Table and set its cardinality to 0:n
    2. Create 2 value attributes within the Table node name value1 and value2
    3. Goto Outline view> Right click on TransparentUIContainer>Apply Template> Select Table>mark the node Table and it's attributes.
    you have created a table and binded its value to context
    Table UI properties
    4.Set Selection Mode to Multi
    5.Set Visible Row Count to 5
    6.ScrollableColCount to 5
    In your implemetaion, you can add values to table as follow:
    IPrivate<viewname>.ITableElement ele = wdContext.nodeTable().createTableElement();
    ele.setValue1(<value>);
    ele.setValue2(<value>);
    wdContext.nodeTable().addElement(ele);
    The above code will allow you to add elements to your table node.
    Regards,
    Murtuza

  • How to create Event Node in smartform

    Hi Experts,
    could you please tell me how to create event node in smartform
    Thanks in Advance,
    Thanks&Regards
    Geetha

    HI,
    plz explain your problem in deeply.
    And as per me you first create page and righ click on it
    Then create window as per your requirement.
    if you want to put condition ot events true or false Righ click on your window
    then goto flow logic -> Altenative
    You can found 2 events in Condition.
    So you can assign this events.If you want to put condition or event on test then goto Text here in General Attributes in bottom side you can find even on page.
    Try it.

  • I need your expert opinion on how to create a map with multiple conditions.

    Hello.
    I need your expert opinion on how to create a map with multiple conditions.
    I have a procedure (which i cannot import or re-create in OWB due to the bug), so i am trying to create a map instead :-(
    How can i create a cursors within the map?
    My function creates table and cursor.
    Then it will have to check for duplicates in the tables (the one created and another table) - the criteria for finding duplicates is a number of fields.I then need to place few different conditions (if some attributes are not available) and it has to load cursor based on this conditions. The next step is to fetch the data into the cursor based on what attributes are missing.
    The next thing it will do is insert the data into table (if record doesn't exist), output the error in separate table is record is corrupted, or update the record with changed information.
    In short i need to re-create match / merge but with conditions, iterations etc 'built into' it.
    I can read up on available functions - it's just what would be the best options? and what would be the best approach to do so?
    In my function i use %rowtype - but cannot use it in owb - so what would be the alternative? i don't really want to create a lot of variables and then have a nightmare of maintaing it. are there any tips regarding this?
    having looked through Oracle dedupe - it's not really what i need because it is just DISTINCT.
    I would appreciate any help / advise on this.
    Thank you very much

    thanks a lot for your reply - i will look into this option :-)
    it is a bit more complicated now as i have to re-create the match / merge and then somehow 'tweak' it to achieve the result i need.
    At the moment i am looking to breakdown the package into smaller chunks 'functions' and try creating the map that way.
    Anyway, thank you very much for your suggestion.

  • How to create a function with ref_cursor as parameter in OWB 10.1

    Hi,
    Can any one help me how to create a function with ref_cursor as parameter in OWB 10.1.?
    Its urgent. Please help me.
    Thanks,
    Siv

    Hi David,
    Thanks for your reply.
    Before going for this function, I need to create a package in transformation node in owb module.
    My package is as follows,
    Create or replace package 123
    type xxx is RECORD ( parameters);
    type yyy is RECORD (parameters);
    type aaa is table of yyy;
    type bbb is REF CURSOR return xxx;
    type ccc is record (parameters);
    type ddd is ref cursor return eee;
    END;
    How can I create the above kind of package manually in OWB 10.1 (Should not to import the package)
    Please help me its urgent.
    Thanks,
    Siv

  • How to create a window with its own window border other than the local system window border?

    How to create a window with its own window border other than the local system window border?
    For example, a border: a black line with a width 1 and then a transparent line with a width 5. Further inner, it is the content pane.
    In JavaSE, there seems to have the paintComponent() method for the JFrame to realize the effect.

    Not sure why your code is doing that. I usually use an ObjectProperty<Point2D> to hold the initial coordinates of the mouse press, and set it to null on a mouse release. That seems to avoid the dragging being confused by mouse interaction with other nodes.
    import javafx.application.Application;
    import javafx.application.Platform;
    import javafx.beans.property.ObjectProperty;
    import javafx.beans.property.SimpleObjectProperty;
    import javafx.collections.FXCollections;
    import javafx.event.ActionEvent;
    import javafx.event.EventHandler;
    import javafx.geometry.Point2D;
    import javafx.geometry.Pos;
    import javafx.scene.Node;
    import javafx.scene.Scene;
    import javafx.scene.control.Button;
    import javafx.scene.control.ChoiceBox;
    import javafx.scene.input.MouseEvent;
    import javafx.scene.layout.AnchorPane;
    import javafx.scene.layout.StackPane;
    import javafx.scene.layout.VBox;
    import javafx.scene.paint.Color;
    import javafx.stage.Stage;
    import javafx.stage.StageStyle;
    import javafx.stage.Window;
    public class CustomBorderExample extends Application {
      @Override
      public void start(Stage primaryStage) {
      AnchorPane root = new AnchorPane();
      root.setStyle("-fx-border-color: black; -fx-border-width: 1px; ");
      enableDragging(root);
      StackPane mainContainer = new StackPane();
        AnchorPane.setTopAnchor(mainContainer, 5.0);
        AnchorPane.setLeftAnchor(mainContainer, 5.0);
        AnchorPane.setRightAnchor(mainContainer, 5.0);
        AnchorPane.setBottomAnchor(mainContainer, 5.0);
      mainContainer.setStyle("-fx-background-color: aliceblue;");
      root.getChildren().add(mainContainer);
      primaryStage.initStyle(StageStyle.TRANSPARENT);
      final ChoiceBox<String> choiceBox = new ChoiceBox<>(FXCollections.observableArrayList("Item 1", "Item 2", "Item 3"));
      final Button closeButton = new Button("Close");
      VBox vbox = new VBox(10);
      vbox.setAlignment(Pos.CENTER);
      vbox.getChildren().addAll(choiceBox, closeButton);
      mainContainer.getChildren().add(vbox);
        closeButton.setOnAction(new EventHandler<ActionEvent>() {
          @Override
          public void handle(ActionEvent event) {
            Platform.exit();
      primaryStage.setScene(new Scene(root,  300, 200, Color.TRANSPARENT));
      primaryStage.show();
      private void enableDragging(final Node n) {
       final ObjectProperty<Point2D> mouseAnchor = new SimpleObjectProperty<>(null);
       n.addEventHandler(MouseEvent.MOUSE_PRESSED, new EventHandler<MouseEvent>() {
          @Override
          public void handle(MouseEvent event) {
            mouseAnchor.set(new Point2D(event.getX(), event.getY()));
       n.addEventHandler(MouseEvent.MOUSE_RELEASED, new EventHandler<MouseEvent>() {
          @Override
          public void handle(MouseEvent event) {
            mouseAnchor.set(null);
       n.addEventHandler(MouseEvent.MOUSE_DRAGGED, new EventHandler<MouseEvent>() {
          @Override
          public void handle(MouseEvent event) {
            Point2D anchor = mouseAnchor.get();
            Scene scene = n.getScene();
            Window window = null ;
            if (scene != null) {
              window = scene.getWindow();
            if (anchor != null && window != null) {
              double deltaX = event.getX()-anchor.getX();
              double deltaY = event.getY()-anchor.getY();
              window.setX(window.getX()+deltaX);
              window.setY(window.getY()+deltaY);
      public static void main(String[] args) {
      launch(args);

  • Creating context node with dynamic type

    When we are creating context node thru wizard,  Dictionary type must be filled. I'm trying to create Context node manually.Did any one tried created Context node class with Dynamic type.

    Hi Prasad,
    I have a similar requirement.
    Can you please share with me how did you create context node with dynamic table data?
    Thanks
    Vicky

  • How to create excise invoice with reference thorugh credit memo

    Hi All,
    Please provide any solution for the following qurey:
    How to create excise invoice with reference thorugh credit memo

    Hi murali,
    i am unable to understand your requirement i think there is no like this scenario requirement for any client
    if any requirement is there kindly explain detail
    cheers

  • How to create a complaint with pre-decessor document Inovice?

    Hello experts,
    I need create a complaint with reference to a pre-decessor document type Invoice (apart from other types such as sales order and service order). Can someone enlighten me
    1) how to create an invoice in IC Web Client and backend?
    2) how to create a complaint with reference to this created invoice in IC Web client and backend?
    Thanks a lot!!!

    Hi Easwar
    Thanks  a lot for answering the question.
    Yes I do have CRM Billing documents. But the problem is
    a) either the billing document doesn't have Transfer to Accounting status Transferred or
    b) a transferred billing document, but all items have error "Unable to offset billing item 90003458 0000000060" etc.
    Do you know
    1) how I can make a billing document have "Transferred" status? Pressing "Transfer to Accounting" button in the billing document overview page will only set the status to "Being transferred". And it's always being tranfered.
    2) What does the error "Unable to offset billing item ... "mean? How to get rid of them?
    Thanks a lot!

Maybe you are looking for