Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

alv grid display

Former Member
0 Likes
549

hi freinds,

i want to display a data that is 1000 chars in one of the fields in the alv display.

but i dont want to display it in single line but in two lines.

kindly help me out

hi freinds,

i want to display a data that is 1000 chars in one of the fields in the alv display.

but i dont want to display it in single line but in two lines.

kindly help me out

3 REPLIES 3
Read only

Former Member
0 Likes
522

Hi

Generally this type of data is stored in Long texts and is fetched and displayed using the fun modules READ_TEXT.

What data you wants to display exactly in ALV grid? fetched from database tables or from some where else?

A report output which can be generally used to printing purpose is 255 char and we generally displays such data in the report.

if it is more than 255 char we can just display in the output but can't print .

Anyhow declare two fields of 500 CHAR each ina ainternal table and try to display the same in the grid display

Reward points if useful

Regards

Anji

Read only

Former Member
0 Likes
522

Take out one internal it will have four fields

data : begin of i_data occurs 0,

fld1(250) type c,

end of i_data.

data v_data type string.

do not take two fields since you can display max 255 charcters for each line,so i have taken 1 field in internal table.

pass the your 1000 charcters to v_data.

now call the FM

CALL FUNCTION 'SWA_STRING_SPLIT'

EXPORTING

INPUT_STRING = v_data

MAX_COMPONENT_LENGTH = 250

  • TERMINATING_SEPARATORS =

  • OPENING_SEPARATORS =

TABLES

STRING_COMPONENTS = i_data

  • EXCEPTIONS

  • MAX_COMPONENT_LENGTH_INVALID = 1

  • OTHERS = 2

.

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

Now see the i_data will have 4 lines and each line will have 250 charcters,now display the data into ALV Grid.

Reward Points if it is helpful

Thanks

Seshu

Read only

0 Likes
522

Hi Guys,

I have the same problem, my client wants to see a long text for the material in one line of ALV, with at least 1000 characters.

I have used this but it's not working:

DATA: BEGIN OF i_tab OCCURS 0,

text TYPE c LENGTH 1000,

END OF i_tab.

DATA: BEGIN OF i_tabs OCCURS 0.

INCLUDE STRUCTURE tline.

DATA: END OF i_tabs.

itb_fieldcat-fieldname = 'TEXT'.

itb_fieldcat-seltext_l = 'POD Text'.

itb_fieldcat-col_pos = 35.

itb_fieldcat-outputlen = 1000.

itb_fieldcat-emphasize = 'X'.

APPEND itb_fieldcat TO itb_fieldcat.

CLEAR itb_fieldcat.

FORM reading_text.

gv_repid = sy-repid.

SELECT SINGLE ebeln INTO i_tab-ebeln FROM ekpo WHERE matnr = i_tab-matnr.

line_id = 'BEST'.

line_name = i_tab-matnr.

line_lang = sy-langu.

line_object = 'MATERIAL'.

CLEAR i_tabs.

REFRESH i_tabs.

CALL FUNCTION 'READ_TEXT'

EXPORTING

id = line_id

language = line_lang

name = line_name

object = line_object

TABLES

lines = i_tabs

EXCEPTIONS

id = 1

language = 2

name = 3

not_found = 4

object = 5

reference_check = 6

wrong_access_to_archive = 7

OTHERS = 8.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

  • break-point.

LOOP AT i_tabs.

CONDENSE i_tabs-tdline.

CONCATENATE i_tab-text i_tabs-tdline INTO i_tab-text SEPARATED BY space.

ENDLOOP.

MODIFY i_tab TRANSPORTING text.

ENDFORM. "reading_i_tab-text text

Regards,

Fred