Application Development 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: 

Include Text in Smartforms returning special characters

Pavithrra
Participant
0 Kudos

Dear ABAP Team,

I am facing a strange problem in the Smart form.

I am using the Include text inside the Smart forms where I am populating the the document number through the work are as shown below.

Strangely, after seeing the print preview of the billing document for that material  it is showing '#' in the end of the text.

Can you please throw some points on why the special character '#' is coming. There are no special characters while uploading the file through notepad.


Thanks and Regards.

Pavithrra

1 ACCEPTED SOLUTION

raymond_giuseppi
Active Contributor
0 Kudos

Usual solution for those copied texts with special characters is usage of FM CONVERT_ITF_TO_ASCII.

Hint: Look for OSS notes released for your version, as SAP has already corrected some programs.

Regards,

Raymond

17 REPLIES 17

mauro_blanc3
Active Participant
0 Kudos

Try using CL_ABAP_CHAR_UTILITIES=>CR_LF for the line break.

0 Kudos

Hi Blanc,

Sorry my system was down from morning.

Can you please tell me where exactly do I have to add this class, because from the driver program i  am passing this document number to the work area.

Thanks,

Pavithrra

0 Kudos

Yo can code it directly in the smartform. Or in your program prior to call the smartform FM.

0 Kudos

Thanks Blanc, I will try that and let you know.

Regards,

Pavithrra

Former Member
0 Kudos

Did you check how the text is maintained in STXH table?

0 Kudos

Hi Sandeep,

Inside the STXH table it is not showing any text. even i checked inside the STXL table.

Thanks,

Pavithrra

suresh_kutam
Participant
0 Kudos

Hello Pavithrra,

Check those standard text first - See do you have any space in the end of the line. Just press a back space at end of the line in standard text.

See whether that could be causing the proble ?

Thanks,

SK

0 Kudos

Hi SK,

Thanks for the input.

It is not a standard text, As far as i knew the functional is uploading the data through the note pad that data is passed inside the document number under the Item Texts tab and having the space which creates the #.

But he is not adding any space in the file then how come it is creating space.

Thanks and Regards,

Pavithrra

raymond_giuseppi
Active Contributor
0 Kudos

Usual solution for those copied texts with special characters is usage of FM CONVERT_ITF_TO_ASCII.

Hint: Look for OSS notes released for your version, as SAP has already corrected some programs.

Regards,

Raymond

Pavithrra
Participant
0 Kudos

Adding some more points to my original post. below are the attached screen-shot of the issue I am facing:

Inside the editor:

Former Member
0 Kudos

Item texts will have an entry in STXH/STXL tables. Please check carefully with the right parameters. The other way to check this is executing READ_TEXT function module. Click on the header like shown below and you could find the correct parameters used to execute READ_TEXT or STXH table

0 Kudos

Hi,

from your screenshot (good you showed the contents of the "old" ITF editor) we can see that the # is already contained there. I assume this is an artefact created somehow by uploading/importing the text from notepad into the ITF editor... Could it be that the person doing the import is using cut-and-paste from notepad into the "PC" editor?

I believe this has nothing to do with smart forms INCLUDE operation.

Regards,

  Alex

0 Kudos

Hi Sandeep,

Thanks I got it after your screen-shot. The texts are stored with # but while the functional is uploading there was no #. I think the read_text converts the space to #.

Regards,

Pavithrra

0 Kudos

AFAIK the conversion from "invisible" character to "special" character displayed as # occurs during first save.

(Also standard report may be using FM CONVERT_ITF_TO_STREAM_TEXT before displaying text)

Regards,

Raymond

Former Member
0 Kudos

Good. So the text is saved with special characters and hence you are getting on the form too. From your screenshot, Go to the SAPScript editor and delete the # sign. The old editor might have considered space as #. So try doing that or go to your functional consultant and ask him to correct the same.

0 Kudos

Hi Raymond,

Thanks for suggesting the function module   CONVERT_ITF_TO_ASCII.

Sorry I am using this for the first time, can you please let me know anything do I have to pass in the tab substitute. after doing the below way the '#' is not removed in the text.

Below is my sample code:

DATA: lt_lines type TLINE_T,

             ls_lines type tline,

             ls_ascii TYPE string,

            lt_ascii  TYPE tdtab_c132,

            lv_text type char72,

             lv_name TYPE THEAD-TDNAME.

       lv_name = ls_manual_adj-manual_desc.


       CALL FUNCTION 'READ_TEXT'

         EXPORTING

*         CLIENT                        = SY-MANDT

           ID                            = '0001'

           LANGUAGE                      = sy-langu

           NAME                          = lv_name

           OBJECT                        = 'VBBP'

         TABLES

           LINES                         = lt_lines.

     

check not lt_lines is initial.

     

CALL FUNCTION 'CONVERT_ITF_TO_ASCII'

  EXPORTING

    CODEPAGE                = '0000'

    FORMATWIDTH             = 72

*   LANGUAGE                = SY-LANGU

    TABLETYPE               = 'ASC'

*   TAB_SUBSTITUTE          = 'C#'

*   LF_SUBSTITUTE           = ' #'

**   REPLACE_SYMBOLS         = ' '

*   REPLACE_SAPCHARS        = '#'

  IMPORTING

*   FORMATWIDTH_E           =

*   X_DATATAB               =

     C_DATATAB               = lt_ascii

*   X_SIZE                  =

   TABLES

     ITF_LINES               = lt_lines

* EXCEPTIONS

*   INVALID_TABLETYPE       = 1

*   OTHERS                  = 2

           .

check lt_ascii[] is not initial.


loop at lt_lines into ls_lines.

   read table lt_ascii into ls_ascii index sy-tabix.

   ls_lines-tdline = ls_ascii.

   modify lt_lines from ls_lines index sy-tabix.

endloop.


Kindly, let me know anything I am doing wrong.


THanks everyone for your time and inputs. Learnt a lot.


Regards,

Pavithrra

Pavithrra
Participant
0 Kudos

I tried using the fm CONVERT_ITF_TO_STREAM_TEXT which converts the text with # into normal text.

THanks everyone for your valid points.

Thread is closed.