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: 

How to display special character in ABAP report program.

former_member230666
Participant
0 Kudos

Hi Experts,

I have an issue with displaying special characters in ABAP ALV report program. The text supposed to be displayed in the ALV is "Testing-#testing PO" but it is displayed as "Testing- testing PO". The special character "#" is missing and there is a space in between. Can you please advise me? Or is this a standard problem in SAP ALV Report? Is this an unicode issue? I tried to search for solutions via google but not successful.  Please help..

8 REPLIES 8

PeterJonker
Active Contributor
0 Kudos

It is not a standard ALV problem, because I just created a testreport where I concatenate -# into fields and it dispalys w/o any problem.

What is the datatype of the field where this values are in ?

0 Kudos

Hi Peter,

Thanks for your reply. In the ABAP program, it is declared as string. I used the below standard function call to display the ALV. It still display as blank in between. Not sure if i need to add any codes to this?

CALL METHOD cl_salv_table=>factory

         IMPORTING

           r_salv_table = alv_table

         CHANGING

           t_table      = lt_output.

0 Kudos

I used EXACTLY the same and it is working. Are you sure (debug) the special character is there in lt_output when you call the factory method ?

0 Kudos

Hi Peter,

When i debug, the character "#" is in the internal table. This internal table is then pass into the method to call the ALV. When the ALV report was displayed, the "#" is missing and displayed as "Testing-testing PO". This is very weird and cannot understand why this happens.

0 Kudos

Hi,

As mentioned in my last reply, please check the hex value when you in debug mode, when you see a # in any string value while debug, it is not always a #, as SAP will convert some invisible character into # for display, and the debugger is one of the UI will do this conversion.

Do a test when you in debug mode by edit the problematic value by adding some # at the end and see the result.

Regards

Bill

0 Kudos

Did you read the question of Chie Bill ? Please answer this as well.

The question is: Is this special character actually in the string (did you place it there) or is it a representation of a hex value in debug ?

Former Member
0 Kudos

Hi,

Did you tried to go into debug mode and check the HEX value of the character? (It should be Hex 23)

As far as I know, some UI in sap (e.g. SE16 standard list) will convert some invisible character (e.g. new line) into # but ALV will just show it as a space.

Regards

Bill

former_member241258
Active Participant
0 Kudos

hi

see below code will help.

REPORT ZDEMO2.

TYPE-POOLS:SLIS.

TYPES:BEGIN OF TY_FINAL,
        VALUE TYPE C LENGTH 50,
       END OF TY_FINAL,
       TT_FINAL TYPE STANDARD TABLE OF TY_FINAL.

DATA:LT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
      LS_FIELDCAT TYPE SLIS_FIELDCAT_ALV.


DATA:GT_FINAL TYPE TT_FINAL,
      GS_FINAL TYPE TY_FINAL.


START-OF-SELECTION.


CLEAR GS_FINAL.
GS_FINAL-VALUE = 'Testing-#testing PO'.
APPEND GS_FINAL TO GT_FINAL.

CLEAR LS_FIELDCAT.
LS_FIELDCAT-FIELDNAME = 'VALUE'.
LS_FIELDCAT-SELTEXT_L = 'VALUE'.
APPEND LS_FIELDCAT TO LT_FIELDCAT.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
  EXPORTING
    I_CALLBACK_PROGRAM                = SY-REPID
    IT_FIELDCAT                       = LT_FIELDCAT
  TABLES
    T_OUTTAB                          = GT_FINAL
  EXCEPTIONS
    PROGRAM_ERROR                     = 1
    OTHERS                            = 2.


this is not suitable, then send ur report source code.


i will modify and send u.