04-20-2006 4:03 AM
Hello experts,
I have been asked by my boss to modify a certain report to use ALV. Now, I have added all the fields required for fieldcatalog. Problem is, the last 3 fields value were fetched using FM READ_TEXT. Here it is:
REFRESH : lt_lines.
CALL FUNCTION 'READ_TEXT'
EXPORTING
id = '0002'
language = sy-langu
name = ls_thead-tdname
object = 'VBBP'
TABLES
lines = lt_lines
EXCEPTIONS
id = 1
language = 2
name = 3
not_found = 4.
IF sy-subrc = 0.
**- by wengbaga 03/14/2004 for SHIP-TO-PARTY
CLEAR ls_lines.
READ TABLE lt_lines INTO ls_lines INDEX 2.
WRITE (100) : ls_lines-tdline.
CLEAR ls_lines.
READ TABLE lt_lines INTO ls_lines INDEX 3.
WRITE (30) : ls_lines-tdline.
CLEAR ls_lines.
READ TABLE lt_lines INTO ls_lines INDEX 4.
WRITE (18) : ls_lines-tdline.
Now, how can I put ls_lines into fieldcatalog? I declared my fieldcatalog below. Only those 3 above remains.
FORM build_fieldcatalog.
fieldcatalog-fieldname = 'VGBEL'.
fieldcatalog-seltext_m = 'Ref. Doc.'.
fieldcatalog-col_pos = 0.
fieldcatalog-outputlen = 10.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'POSNR'.
fieldcatalog-seltext_m = 'Item'.
fieldcatalog-col_pos = 1.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'MATNR'.
fieldcatalog-seltext_m = 'Material'.
fieldcatalog-col_pos = 2.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'ARKTX'.
fieldcatalog-seltext_m = 'Description'.
fieldcatalog-col_pos = 3.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'KWMENG'.
fieldcatalog-seltext_m = 'Qty'.
fieldcatalog-col_pos = 4.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'ZIEME'.
fieldcatalog-seltext_m = 'Unit'.
fieldcatalog-col_pos = 5.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
04-20-2006 6:30 AM
it looks to me like you want to only include 3 lines of the text. If this is so why not include 3 extra fields in your table, each one of type tdline, put the read lines in there. The fieldcatalog can be changed to refer to the 3 new fields.
04-20-2006 4:08 AM
Hi,
It doesn't make sense to display a long text as the line item of the ALV, as it could run into multiple pages. What I suggest is, declare a one CHAR column and set that to display as PUSH BUTTON.
Activate the events and when the user presses the button, POP UP the TEXT EDITOR (CL_GUI_TEXTEDIT) using a DIALOG CONTAINER and display the text of that specific line item by fetching the data using READ_TEXT.
If you have to display, some part of the text, declare the column as TDLINE, get the first line of the text using READ_TEXT and change the DATA table with the first line of the text.
Regards,
Ravi
Note :Please mark the helpful answers
04-20-2006 6:18 AM
04-20-2006 6:29 AM
Hi,
I don't think so, even if you are able to succesfully do that, ALV does NOT have a WORD WRAP functionality so your text will be displayed in one single line, imagine a paragraph being displayed in one single line, the user will have scroll so much to read the line and if there are fields after that, they will NOT be visible at all.
regards,
Ravi
04-20-2006 7:05 AM
Hello again friends,
sorry for too many questions as I am new to ABAP. How do I declare a char column as a pushbutton then use FM CL_GUI_TEXTEDIT then fetch data using FM READ_TEXT all these in the ALV display output.
Again, thanks for your very helpful replies.
04-20-2006 7:24 AM
Hi,
Take a look at this weblog which talks about the text editor.https:///people/igor.barbaric/blog/2005/06/06/the-standard-text-editor-oo-abap-cfw-class
Take a look at these programs for events
BCALV_TEST_GRID_EVENTS - If you are using a ALV Control
BCALV_TEST_FULLSCREEN_EVENTS - If you are using REUSE function.
All you have to set the BUTTON field in the fieldcatalog for that column.
Regards,
Ravi
04-20-2006 6:30 AM
it looks to me like you want to only include 3 lines of the text. If this is so why not include 3 extra fields in your table, each one of type tdline, put the read lines in there. The fieldcatalog can be changed to refer to the 3 new fields.