12-14-2015 12:08 PM
Dear forumers,
I have a bit of an issue with a long text display for a smartform in CRM. Hope you can help me out.
Here's what I've done so far:-
A sample text input is initially in a string data type as shown above – in this example, it has 808 characters of length in total.
Next, this text input is passed to the FM, CONV_TEXTSTRING_TO_ITF.
(I had earlier used the FM, G_SPLIT_LINE, but this didn't work well because it had a limitation of 500 characters of length for the text input.)
The text input is broken down into multiple lines as shown above after it is processed by the FM, CONV_TEXTSTRING_TO_ITF.
The text lines here have a maximum length of 132 characters per line.
Next, these text lines will processed by the FM, FORMAT_TEXTLINES.
The text lines are finally formatted as above after it is processed by the FM, FORMAT_TEXTLINES (this is meant to limit the length of text up to 100 characters per line, solely for the smartform display purposes).
These text lines now have a maximum length of 100 characters per line.
How may I resolve the issues as highlighted in the red bubbles?
Appreciate any of your help here.
Thanks in advance.
12-14-2015 12:57 PM
You should collect string in to internal table then make a loop.
DATA: lv_string TYPE string,
lt_split TYPE TABLE OF char40,
lt_char128 TYPE TABLE OF char128,
lv_wa_str TYPE string,
lv_len TYPE int4,
lr_split TYPE REF TO char40,
lr_char128 TYPE REF TO char128.
DO 50 TIMES.
CONCATENATE lv_string
`This is hello world program`
INTO lv_string.
ENDDO.
SPLIT lv_string AT space INTO TABLE lt_split.
LOOP AT lt_split REFERENCE INTO lr_split.
lv_len = STRLEN( lv_wa_str ) + STRLEN( lr_split->* ).
IF lv_len LT 128.
CONCATENATE lv_wa_str lr_split->* INTO lv_wa_str SEPARATED BY space.
ELSE.
APPEND lv_wa_str TO lt_char128.
lv_wa_str = lr_split->*.
ENDIF.
ENDLOOP.
APPEND lv_wa_str TO lt_char128.
12-14-2015 12:47 PM
Hi,
could you provide the code before using FM /converting,
thanks
12-14-2015 12:57 PM
You should collect string in to internal table then make a loop.
DATA: lv_string TYPE string,
lt_split TYPE TABLE OF char40,
lt_char128 TYPE TABLE OF char128,
lv_wa_str TYPE string,
lv_len TYPE int4,
lr_split TYPE REF TO char40,
lr_char128 TYPE REF TO char128.
DO 50 TIMES.
CONCATENATE lv_string
`This is hello world program`
INTO lv_string.
ENDDO.
SPLIT lv_string AT space INTO TABLE lt_split.
LOOP AT lt_split REFERENCE INTO lr_split.
lv_len = STRLEN( lv_wa_str ) + STRLEN( lr_split->* ).
IF lv_len LT 128.
CONCATENATE lv_wa_str lr_split->* INTO lv_wa_str SEPARATED BY space.
ELSE.
APPEND lv_wa_str TO lt_char128.
lv_wa_str = lr_split->*.
ENDIF.
ENDLOOP.
APPEND lv_wa_str TO lt_char128.
12-15-2015 3:09 AM
Thanks much, Avirat. But after populating LT_CHAR128, any idea on how I should convert this data to the internal table of the type, TLINE?