Skip to Content
avatar image
Former Member

move data from a column to a single textedit / textview

Hello,

does anybody knows how can I move data from a table/column to a single textedit?

for example a SELECT DISTINCT FIRST_NAME FROM ZTEST into stable.

so here I wanna move all the names stored into one text view.

I tried to loop internal table into my work area and concatenate values into a variable but

it didn't work, so please let me know if you have any other suggestions???

Regards,

Abdul.

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

4 Answers

  • Best Answer
    avatar image
    Former Member
    Jun 24, 2009 at 06:11 AM

    Hi Abdul,

    Create a context node with cardinality 1..1 and create an attribute a_text with the type string_table under the node and bind this attribute to your text edit.Now bind your internal table values to the attribute.

    data:

    lo_node type ref to if_wd_context_node,

    lo_element type ref to if_wd_context_element,

    ls_text type wd_this->element_nd_text.

    loop at stable into wa.

    append wa to ls_text.

    endloop.

    lo_element->set_static_attribute( exporting static_attributes = ls_text ).

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jun 24, 2009 at 04:03 AM

    Hi Radhika,

    I did check, and i also moved the value that is stored in my variable to the binded attribute, but what happened is that i got only one value inside that attribute.

    Regards,

    Abdul.

    Add comment
    10|10000 characters needed characters exceeded

    • Hi Abdul,

      This is simple. Suppose I am displaying data from SFLIGHT within my table & I want all the CARRID values to be populated into my TextEdit then I proceed as follows.

      I have a button & up on pressing this I want all my CARRID values from the CARRID column to be populated into the TextEdit. I have bound the value property of my TextEdit to an attribute by name STRING of type STRING. (i.e., MAIN.NODE.STRING ) My context node NODE has a cardinality of 1..1

      Below is the coding within my buttons action handler:

      METHOD onactioncopy_carrids .
        DATA: wd_node TYPE REF TO if_wd_context_node,
              lt_sflight TYPE wd_this->elements_sflight,
              wa_sflight TYPE wd_this->element_sflight,
              lv_string TYPE wd_this->element_node-string.
      
      ** Fetch reference of node containing the data of SFLIGHT
        wd_node = wd_context->get_child_node( name = 'SFLIGHT' ).
      
      ** Fetch all the data that is being displayed in the table
        CALL METHOD wd_node->get_static_attributes_table
          EXPORTING
            from  = 1
            to    = 2147483647
          IMPORTING
            table = lt_sflight.
      
      ** Loop through the records & concatenate CARRID data into a string variable lv_string
        LOOP AT lt_sflight INTO wa_sflight.
          CONCATENATE wa_sflight-carrid
                      lv_string INTO lv_string SEPARATED BY space.
          CLEAR wa_sflight-carrid.
        ENDLOOP.
      
      ** Obtain the reference of NODE & then set the value of the
      ** string attribute which we had created under it
        wd_node = wd_context->get_child_node( name = 'NODE' ).
        wd_node->set_attribute( EXPORTING name  = 'STRING'
                                          value = lv_string ).
      ENDMETHOD.

      Regards,

      Uday

  • avatar image
    Former Member
    Jun 24, 2009 at 03:43 AM

    Hi,

    Check if you have set the attribute that is bound to your text edit with the variable that has the concatenated value .

    Regards,

    Radhika.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jun 25, 2009 at 01:37 PM

    Heye guys,

    thanks for the reply unfortunately none of the suggestions work, and I can afford spend more time on it, so I am using a table instead.

    Regards,

    Abdul.

    Add comment
    10|10000 characters needed characters exceeded