Skip to Content
avatar image
Former Member

Table UI Element

Hi,

I have a Table UI element. When i click on a Add New Row button then a new row should appear in the table and when i enter the data and click on the lead selection button then the row should get saved in the database.

Can anybody help me out with this problem.

Regards,

Kanakaraj V A

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Feb 24, 2009 at 04:58 AM

    Hi Kanka,

    You can go thru the Component - WDR_TEST_TABLE in ur sap system.

    I hope this will helps you.

    Regards

    Manoj Kumar

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Feb 24, 2009 at 04:59 AM

    hi,

    Catch the table events and do the intented action,

    for getting the help on table events, use the sap help and find it.

    http://help.sap.com/saphelp_nw04s/helpdata/en/fc/501b42b5815133e10000000a155106/frameset.htm

    Best regards,

    Rohit

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Feb 24, 2009 at 05:00 AM

    Hi,

    Create a node with suitable attributes and bind it to the table. The node cardinality should be 0:n.

    After you bind the node to the table uielement, double click on the table uielement in the layout and create an onAction method for the event onLeadselect.

    There you code the code to save the entries in the database.

    In the layout add one button, and in its onAction method, code the addition of a single row to the table.

    Regards,

    Prosenjit.

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi Kanak,

      Choose the cell editor of the rows as inputfield.

      Create an attribute rowcount of type I in the context node.

      Double click on the table uielement.

      Then bind the visibleRowCount property to this attribute.

      In the onaction method of the 'add new row' button, code the following,

      DATA lo_el_context TYPE REF TO if_wd_context_element.

      DATA ls_context TYPE wd_this->element_context.

      DATA lv_rowcount LIKE ls_context-rowcount.

      • get element via lead selection

      lo_el_context = wd_context->get_element( ).

      • get single attribute

      lo_el_context->get_attribute(

      EXPORTING

      name = `ROWCOUNT`

      IMPORTING

      value = lv_rowcount ).

      lv_rowcount = lv_rowcount + 1.

      CALL METHOD lo_el_context->set_attribute

      EXPORTING

      value = lv_rowcount

      name = 'ROWCOUNT'

      .

      Check this out.

      Also, in the WDDOMODIFYVIEW write the following code to display a default number of rows.

      DATA lo_el_context TYPE REF TO if_wd_context_element.

      DATA ls_context TYPE wd_this->element_context.

      DATA lv_rowcount LIKE ls_context-rowcount.

      DATA lv_default_rowcount TYPE i.

      • get element via lead selection

      lo_el_context = wd_context->get_element( ).

      lv_default_rowcount = 5.

      IF first_time = abap_true.

      CALL METHOD lo_el_context->set_attribute

      EXPORTING

      value = lv_default_rowcount

      name = 'ROWCOUNT'.

      ENDIF.

      Regards,

      Prosenjit.

      Edited by: prosenjit chaudhuri on Feb 24, 2009 6:16 AM

      Edited by: prosenjit chaudhuri on Feb 24, 2009 6:17 AM

      Edited by: prosenjit chaudhuri on Feb 24, 2009 7:45 AM