Skip to Content
avatar image
Former Member

Table Creation

Hi all,

I have a requirement wherein i want to create a table in my webdynpro screen.

The table should have two rows

Columns are given below:

Activity Owner ActivityStatus

-


-


-


In the table two rows should appear. (two rows of data)

Data:

1) Technical Solution Owner Initiated

2) Pricing Owner Initiated

As you can see from the data, the activity field is filled with static data

The owner column should have drop downs for both rows. Each drop down should have same data

Status again is static with Initiated as data in both rows

Please suggest how the context should be, what should be coded, to be enable such a table as shown above.

Thanks

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Best Answer
    avatar image
    Former Member
    Mar 20, 2009 at 03:50 AM

    Hi Yogesh,

    You can create a table with three columns.

    1) In the first column Cell editor select Text view.

    2) Second column select the cell editor as dropdownbykey.

    3) Status again you can keep it as text view.

    Let say you have craeted a node named *ActivityTable* under the context node with Selection cardinality as 0:n (so that you can perfornm multiple selction in the table if you want) and Collection cardinality as 0:n (which means there can be 0 to n values in this table).

    Create 3 attributes under this node:

    *1) Activity*

    *2) Owner*

    *3) ActivityStatus*

    Now bind this node as DataSource of the table. And for each column bind the attributes of the node and for each cell editor bind the text property to the respective attribute.

    Like for:

    *-- Columns 1 bind its text property with Activity*

    *-- Columns 2 bind its text property with Owner*

    *-- Columns 3 bind its text property with ActivityStatus*

    --> Now Create a simple type structure with those value which you want in drop down. Set these values in the enumeration.

    Let say:

    1 - text 1

    2 - text 2

    3 - text 3

    4 - text 4

    5 - text 5

    So these values will come in drop down after you bind the datatype propert of Owner attribute with this simple type. You can get various exmaple of doing this binding on SDN or www.help.sap.com.

    Now write following code in the wdDoModify function:

    	  IActivityTableElement ele = wdContext.nodeActivityTable().createAndAddActivityTableElement();
    	  ele.setActivity("Technical Solution Owner Initiated");
    	  ele.setActivityStatus("Initiated");
    	  
    	    
    	  IActivityTableElement ele2 = wdContext.nodeActivityTable().createAndAddActivityTableElement();
    	  ele2.setActivity("Pricing Owner Initiated");
    	  ele2.setActivityStatus("Initiated");
    

    I hope this solves the issue. Please revert back if you have any further doubts.

    Thanks and Regards

    Pravesh

    Edited by: Pravesh Verma on Mar 19, 2009 11:52 PM

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Mar 20, 2009 at 03:40 AM

    Culd not quite get your query. You want to create a table with 3 columns, (visible row count = 2) and in one of the columns you want the cell editor to be a drop down ...am I right?

    For this while creating table binding you should choose cell editor as dropdownByKey or dropdownByIndex (accordingly bind to the context).

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi Yogesh,

      Create a simple type in dictionary called Owner. In this enter values which you want to appear in drop down.

      Create a context node with 3 attributes called activity, owner and status.

      Add a table in your layout, right click -> create binding. select the node and all three elements under it. Choose the cell editor of 2nd column to be dropdownByKey (bound to simple type owner).

      In your init method, write code to create two node element and set the static values for Activity as "Technical Solution" in one and "Pricing & Commercials" in the 2nd element. Similary set the status value for Activity in both node elements.

      Since all the values are supposed to be static in your case, I would suggest not to use the wdDoModify method. You should avoid the use of wdDoModify view (except if you want to use only for firstTime or you want to reference the UI elements directly - which is not required here).

      Hope this helps,

      Regards,

      Anagha

  • avatar image
    Former Member
    Mar 20, 2009 at 03:59 AM

    >

    > Hi all,

    > I have a requirement wherein i want to create a table in my webdynpro screen.

    >

    > The table should have two rows

    >

    > Columns are given below:

    >

    > Activity Owner ActivityStatus

    > -


    -


    -


    >

    >

    > In the table two rows should appear. (two rows of data)

    >

    > Data:

    >

    > 1) Technical Solution Owner Initiated

    > 2) Pricing Owner Initiated

    >

    > As you can see from the data, the activity field is filled with static data

    >

    > The owner column should have drop downs for both rows. Each drop down should have same data

    >

    > Status again is static with Initiated as data in both rows

    >

    >

    > Please suggest how the context should be, what should be coded, to be enable such a table as shown above.

    >

    > Thanks

    Hi,

    If you want to create a Table UI element on the Web Dynpro Screen dynamically - it is a little complex.

    You will need to use Dynamic programming - what this means is that you will need to first create the context as per your requirement.

    For example (Just an example - think aout your requirement before you actually design the context):

    Context Root

    --->TableData (Cardinality = 0..n, Selection = 0..1, this node will store the data values)

    -


    >Activity

    -


    >Owner

    -


    >ActivityStatus

    --->TableHeaderData (Cardinality = 0..n, Selection = 0..1, this node will store the table metadata like names of columns, maybe table cell editor types, selection and cardinality values of the )

    Now the catch is that since you want to create the table dynamically - you will also need to create the context (above) dynamically and bind the properties to the dynamically created table.

    A general (but not complete) procedure for table creation dynamically:

    1.) In the wdDoInit() of your Component Controller - create the context as you have planned - to store the table data (values appearing in the table columns) and table metadata (column names, data types of columns) etc. Use the IWDNodeInfo class (see the 04S JavaDocs for more information or search SDN for dynmaic tutorial programs)

    2.) Next - you need to write code in the wdDoModifyView() of the view whre the table will be created. You will need to use the "firstTime" variable to ensure performance.

    3.) After creating the UI - you need to bind the step 1 data in the step 2 ui elements.

    I know thi si a very, very rough solution to your question - but the dynamic programming topic is a little complex - you will need to try out several of the SDNs examples before attempting this.

    Please revert if there are more specific issues.

    I hope that this solution will at least point you in the right direction.

    [SAPs Help on DP|http://help.sap.com/saphelp_nw04s/helpdata/en/94/29984197eb2e7be10000000a1550b0/frameset.htm]

    Thanks.

    p256960.

    Add comment
    10|10000 characters needed characters exceeded