cancel
Showing results for 
Search instead for 
Did you mean: 

# charector in longtext

Former Member
0 Kudos

Hi,

We see a "#" in the long text TDLINE when we execute the function module READ_TEXT. We are developing a smart form and we want to remove it. We observed that, system puts a # charector whenever the user presses an enter key in the front end.

FIND, REPLACE, SPLIT..these are not reconginzing this charector. Please suggest how to remove this...

Ganapathi

Accepted Solutions (1)

Accepted Solutions (1)

robin_janke
Contributor

Hi Ganapathi,

use CL_ABAP_CHAR_UTILITIES=>CR_LF for the enter key (carriage return, line feed) in your find statement.

SAP renders a '#' when there is a special character it can't display in this case the 'enter'. So using the class CL_ABAP_CHAR_UTILITIES you can use FIND/SPLIT and replace with the attributes (special characters) found in that class.

Regards,

Robin

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi All,

Even i faced this issue (#) in long text - TDLine. Since user press enter key in the screen it is replaced as #. Not only for enter it could be for tab/new line character. Initially i used the below sentence.

Data:      c_hl(1)       TYPE c VALUE cl_abap_char_utilities=>horizontal_tab.

    REPLACE ALL OCCURRENCES OF c_hl in TABLE it_clongtxt WITH SPACE.

the # character were removed from few places only. Then i used all the below attributes of Class: cl_abap_char_utilities. It is because # is captured for new line character or tab character or vertical tab.

Data:

   c_nl(1)       TYPE c VALUE cl_abap_char_utilities=>NEWLINE,
   c_vl(1)       TYPE c VALUE cl_abap_char_utilities=>VERTICAL_TAB,
  c_ff(1)       TYPE c VALUE cl_abap_char_utilities=>FORM_FEED,
  c_lf(1)       TYPE c VALUE cl_abap_char_utilities=>CR_LF,
  c_bs(1)       TYPE c VALUE cl_abap_char_utilities=>BACKSPACE.

          REPLACE ALL OCCURRENCES OF c_vl in TABLE it_clongtxt WITH SPACE.
          REPLACE ALL OCCURRENCES OF c_nl in TABLE it_clongtxt WITH SPACE.
          REPLACE ALL OCCURRENCES OF c_lf in TABLE it_clongtxt WITH SPACE.
          REPLACE ALL OCCURRENCES OF c_ff in TABLE it_clongtxt WITH SPACE.
          REPLACE ALL OCCURRENCES OF c_bs in TABLE it_clongtxt WITH SPACE.

After using the above statements, All the # characters were removed completely from TDLINE longtext.

Thanks,

Saranya.

Former Member
0 Kudos

Hi

I have used this coding as well for my current issue but the changes didn't take affect.

It seems the field gt_ltxt (export parameter for longtext) is being not passed correctly to the smart forms.

Please assist to achieve my issue in this matter.

Regards

Alex

Former Member
0 Kudos

Hello,

Your developing a new smartform on copying and change standard one???

You can see the handling this code in BBP_PO form in intialization

Convert longtexts from c(132) to String and

  • replace linefeeds (##)

CALL FUNCTION 'BBP_OUTPUT_LONGTEXT_MAP_SMART'

EXPORTING

it_longtext = sf_po-it_longtext

IMPORTING

et_longtext = gt_ltxt.

***********************************************************

*This is to avoid the new line that is being inserted if

*the longtext exceeds 132 characters

DATA: ls_lngtxt TYPE LNGTXT_STRUCT,

ls_longtext_str TYPE LNGTXT_STRUCT_STR,

lt_lngtxt TYPE GT_LNGTXT_TEMP,

lt_tab type table of STRING,

ls_tab type STRING,

LV_LNGTXT TYPE STRING,

lt_longtext type GT_LNGTXT.

************HEADER-TEXT***************

LOOP AT gt_ltxt INTO ls_lngtxt WHERE tdid EQ 'HTXT'.

CONCATENATE LV_LNGTXT ls_lngtxt-tdline into LV_LNGTXT.

endloop.

clear ls_lngtxt-tdline.

REPLACE ALL OCCURRENCES OF cl_abap_char_utilities=>horizontal_tab IN lv_lngtxt WITH ' \t' .

REPLACE ALL OCCURRENCES OF '\t' IN lv_lngtxt WITH '' .

split LV_LNGTXT at cl_abap_char_utilities=>newline into table lt_tab.

LOOP AT lt_TAB INTO ls_TAB .

ls_lngtxt-tdline = ls_TAB .

MOVE-CORRESPONDING ls_lngtxt to ls_longtext_str.

APPEND ls_longtext_str to lt_longtext.

CLEAR: LS_LNGTXT-TDLINE ,ls_tab, LV_LNGTXT ,ls_longtext_str .

ENDLOOP .

APPEND LINES OF lt_longtext to gt_longtext.

clear: lt_lngtxt , ls_lngtxt , lt_longtext, lt_tab.

*******************ITEM TEXT*******************

loop at sf_po-it_item into lw_item.

loop at GT_LTXT into ls_lngtxt WHERE tdid eq 'ITXT' AND guid eq

lw_item-guid.

CONCATENATE LV_LNGTXT ls_lngtxt-tdline into LV_LNGTXT.

endloop.

clear ls_lngtxt-tdline.

REPLACE ALL OCCURRENCES OF cl_abap_char_utilities=>horizontal_tab IN lv_lngtxt WITH ' \t' .

REPLACE ALL OCCURRENCES OF '\t' IN lv_lngtxt WITH '' .

split LV_LNGTXT at cl_abap_char_utilities=>newline into table lt_tab.

LOOP AT lt_TAB INTO ls_TAB .

ls_lngtxt-tdline = ls_TAB .

MOVE-CORRESPONDING ls_lngtxt to ls_longtext_str.

APPEND ls_longtext_str to lt_longtext.

CLEAR: LS_LNGTXT-TDLINE , ls_tab , LV_LNGTXT ,ls_longtext_str .

ENDLOOP .

APPEND LINES OF lt_longtext TO gt_longtext.

clear: lt_lngtxt, lt_tab.

endloop.

Regards,

Neelima

Former Member
0 Kudos

Dear R. Janke , Kezia Layug,S Neelima,

Thaks all of you for the reply. The issue is solved.

Ganapathi

Former Member
0 Kudos

hi,

try to split the text using CL_ABAP_CHAR_UTILITIES=>NEWLINE.

e.g.

SPLIT lv_line AT cl_abap_char_utilities=>newline INTO TABLE lt_lines.

regards.