cancel
Showing results for 
Search instead for 
Did you mean: 

move data from a column to a single textedit / textview

Former Member
0 Kudos

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.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

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 ).

Answers (3)

Answers (3)

Former Member
0 Kudos

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.

Former Member
0 Kudos

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.

Former Member
0 Kudos

Hi Abdul,

You can refer to standard webdynpro example for text edits WDR_TEST_TEXTEDIT. There are different kinds of context nodes & data types were used in this example and might be useful for you for quick reference.

Regards,

Manne.

uday_gubbala2
Active Contributor
0 Kudos

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

Former Member
0 Kudos

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.