cancel
Showing results for 
Search instead for 
Did you mean: 

webdynpro abap

Former Member
0 Kudos

Hi expert ,

i need to display the records in text view one by one from a table

this is my code ,

LOOP AT lt_question INTO wa_question.

attribute_data->set_attribute( name = 'RECORDS' value = wa_question-qtext ).

ENDLOOP.

but it assigns the last value only in the textview , what should i do?

Regards

Sankar.M

Accepted Solutions (1)

Accepted Solutions (1)

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

Of course that would be the case with the code that you provided. When you use set_attribute, it overwrites the current value with the new value. You need concatenate the text together. I would suggest something like this.

data l_string type string.
LOOP AT lt_question INTO wa_question.
 concatenate l_string wa_question cl_abap_char_utilities=>cr_lf into l_string. 
ENDLOOP.

attribute_data->set_attribute( name = 'RECORDS' value = l_string ).

Former Member
0 Kudos

Excellent Thomas thanks a lot but one more thing ,

These are displayed in same line , if i want to display one after other how can i do that one

Regards

Sankar.M

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

That is what the cl_abap_char_utilities=>cr_lf was for - if it didn't work; try cl_abap_char_utilities=>newline.

Former Member
0 Kudos

hi thomas,

now also it is displayed in same line even i used that

concatenate l_string wa_question-qtext cl_abap_char_utilities=>newline into l_string.

is there any other way available ?

Regards

Sankar.M

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

newline should work according to the online help:

Note that each occurrence of cl_abap_char_utilities=>newline in this property is replaced by a line break in the browser display.

http://help.sap.com/saphelp_nw70ehp1/helpdata/en/7d/c8f641091b5f24e10000000a1550b0/frameset.htm

Former Member
0 Kudos

OK THOMAS ,

One more doubt ,

I need to create the textview dynamically by coding ,

could you send me that code ?

Regards

Sankar.M

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

For help with Dynamic coding check out these sources:

Have a look at the documentation for the WDDOMODIFYVIEW section of the phase model:

http://help.sap.com/saphelp_nw70ehp1/helpdata/en/d2/8acd409cc4dd50e10000000a1550b0/frameset.htm

There is also the class CL_WD_DYNAMIC_TOOL:

http://help.sap.com/saphelp_nw70ehp1/helpdata/en/67/6935425394033be10000000a1550b0/frameset.htm

Also have a look at the example application DEMODYNAMIC.

I've got an eLearning on the topic here as well:

https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/201ddd3b-b4ce-2b10-8883-880ae814...

You just need to adapt these sample to the textView UI element. The textView UI element class is CL_WD_TEXT_VIEW.

Answers (0)