cancel
Showing results for 
Search instead for 
Did you mean: 

binding a textview

Former Member
0 Kudos

hi

i have to display the id as text.

i have created a textview.

ive selected the id into an internal table, created a node for the id, when im binding the id to the node, im getting a dump

am i missing smthing?

Accepted Solutions (0)

Answers (2)

Answers (2)

uday_gubbala2
Active Contributor
0 Kudos

Hi Anjali,

I guess that it might be a problem with the nodes cardinality. Have you changed the cardinality from the default 1..1? Try using a cardinality of 0..1 or 1..n

Regards,

Uday

Former Member
0 Kudos

Hi,

Create a context node attributed of type STRING and bind thid to the text view in view layout. Donot map context NODE to text view.

Then set the value of the CONTEXT ATTRIBUTE and then this value you will appear in UI text view.

Regards,

Manne.

Former Member
0 Kudos

Hello ,

Do not bind the internal table to the node .

Use SET_ATTRIBUTE method of the node to set the id .

Refer to WDR_TEST_EVENTS component for more detail . There will be a view for TEXTVIEW UI elements.

Regards

Vivek

Former Member
0 Kudos

excuse me vivek

but how do u use the set_attribute to bind the internal table?

Former Member
0 Kudos

Hi,

Here are the detailed steps for dispalying text in text view.

1. Create a text view in layout of the view.

2. Create a context node CNODE and keep the defalut cardinality as 1:1

3. Now, create a context attribute in the above node called LV_TEXT type STRING

4. Map this context attribute LV_TEXT to the text view create in view

5. Finally, using SET_ATTRIBUTE method, set the text value to context attribute LV_TEXT that you want to see in UI

uday_gubbala2
Active Contributor
0 Kudos

Hi Anjali,

Try concatenating all your internal tables data into just 1 STRING variable. Then finally use this STRING variable & do a SET_ATTRIBUTE on your context attribute.

Suppose I have a node by name DATA_NODE & a string attribute by name TEXT under it. The DATA_NODE has a cardinality of 1..1, selection of 0..1 & the Initialization Lead Selection is checked.

I place a TextView in my layout and bind its "text" property to the attribute TEXT. (i.e., MAIN.DATA_NODE.TEXT )

Now within my WDDOINIT I am filling the attribute with a table of MATNR values. Just check the code snippet below.

METHOD wddoinit .
  DATA: lv_string TYPE string,
        wd_node TYPE REF TO if_wd_context_node,
        lt_matnr TYPE TABLE OF matnr,
        wa_matnr TYPE matnr.

  wd_node = wd_context->get_child_node( name = 'DATA_NODE' ).
  SELECT matnr FROM mara UP TO 20 ROWS INTO TABLE lt_matnr.
  SORT lt_matnr.

  LOOP AT lt_matnr INTO wa_matnr.
    IF sy-tabix = 1.
      lv_string = wa_matnr.
    ELSE.
      CONCATENATE lv_string
                  wa_matnr INTO lv_string SEPARATED BY SPACE.
    ENDIF.
  ENDLOOP.

  wd_node->set_attribute( EXPORTING name  = 'TEXT'
                                    value = lv_string ).
ENDMETHOD.

So when you finally test your component you would end up with 20 MATNR values being displayed in your TextView.

Regards,

Uday

Former Member
0 Kudos

thanks raja and uday!!!!

was really helpful