cancel
Showing results for 
Search instead for 
Did you mean: 

Routine help : How to get rid of "#" ?

Former Member
0 Kudos

Hello,

I know this issue has already been discudded many times here, but I'm still having problem with invalid caracter "#". We are loading Plant Maintenance Orders every morning and the data load failed repeatedly due to the presence of a "#" character in the text line (fied C_TEXT = Slopklep gaat constant open en dicht#).

We've found that the "#" character is in fact interpreted by default, the corresponding hexadecimal code is "09".

We were unable to convince the R/3 team to correct the error on their side, therefore i tried to write the following abap routine :

Unfortunatly, I'm not really a great abaper , as you can see, and instead of beig corrected, the field is deleted.

Could you help me to write this routine ?

data : hex_char type X value '09',

hex_sp type X value ' ',

hex_text type Xstring ,

car_text like COMM_STRUCTURE-/BIC/C_TEXT.

move COMM_STRUCTURE-/BIC/C_TEXT to hex_text.

replace all occurrences of hex_char in hex_text

with hex_sp in byte mode.

move hex_text to car_text.

  • result value of the routine

RESULT = car_text .

Any help would be greatly appreciated.

Best Regards.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Did you try and add # to the list of allowable characters using Tcode RSKC. That should get rid of your data load problem. But you would still have it show up and displayed as #. For that the routine has to be there.

Cheers,

Kedar

Former Member
0 Kudos
  1. isn't the problem

  2. is just a dynpro trying to display hex 09 - it will still display # if it was hex 07

Former Member
0 Kudos

Hi Kedar,

Could you please provide me a full solution on how to remove the # symbol in my report.

Thanks in advance.

Regards,

Azimah

Answers (2)

Answers (2)

Former Member
0 Kudos

Sorry - I didn't answer your specific question

Try changing this...

hex_sp type X value ' ',

to

hex_sp type X value '20',

Former Member
0 Kudos

Hello,

Thank you for your answer, but it didn't solve my issue :

I tried to use "replace" without considering the hexadecimal characters.

data : car_text like COMM_STRUCTURE-/BIC/C_TEXT.

move COMM_STRUCTURE-/BIC/C_TEXT to car_text.

REPLACE ALL OCCURRENCES OF '#' IN car_text WITH SPACE.

result=car_text.

But it didn't work, the system uses character '#' for all hexadecimal values for which ABAP does not have an own character. In my case, the hexadecimal "09" is interpreted as "#".

I have returted to the initial routine :

data : hex_char type X value '09',

hex_sp type X value ' ',

hex_text type Xstring ,

car_text like COMM_STRUCTURE-/BIC/C_KTEXT.

move COMM_STRUCTURE-/BIC/C_KTEXT to hex_text.

  • I try here to convert the field C_KTEXT in hexadecimal

  • using the move intruction but it doesn't work.

  • hex_text remains blank

replace all occurrences of hex_char in hex_text

with hex_sp in byte mode.

move hex_text to car_text.

  • therefore car_text is not filled

  • result value of the routine

RESULT = car_text .

By debugging, the routine I have found that the follolwing

move COMM_STRUCTURE-/BIC/C_TEXT to hex_text.

Former Member
0 Kudos

Hi,

I think we can't replace the text with hexa values.

Its better to write like...

move COMM_STRUCTURE-/BIC/C_TEXT to hex_text.

REPLACE ALL OCCURRENCES OF '#' IN hex_text WITH SPACE.

*condense hex_text.(If you want to delete teh space also.)

Hope thsi helps.

Former Member
0 Kudos

Be careful # is not # (if that makes sense)

If the SAPGUI installation cannot display a non std ascii charcter then it displays #

The true value could be something like this .. (sorry the ASCII 197 won't display) - but type 198 or something on your numeric keypad (whilst holding down the ALT key)and you will see

Normally the data has got throught he SAPR3 dynpro checking via a BAPI, IDOC or somebody cutting and pasting values into a non validated field

Even SE16 will display hash #..

It could be a NULL (hex 00)

There are a number of ways of finding the true value - one is looking at the hex value to find the true ASCII equivelant the other is a raw SQL against the table to find it

BEst way to trap it... horses for courses - OSS note to fix the SAP applicationt hat let it in in the first place (good luck! - we are having trouble with this at the moment)

Or a piece of code int he update rules which loops around the string and replaces values eg less than than ASCII 32 with a space (Hex 20) or greaer than ASCII

Best find a ASCII table and decide what the max is to be

(normally though it is null and you need to replace < ASCII32 with a space)

Items less than ASCII 32/hex 20 are control characters (normally for controlling suff like old dot matix printers - eg 0D 0A - Carriage Return / Line Feed)

hex 09 is actually horizontal Tab (again imagine a dot matrix printer) - so not much good in a text field on the screen

Former Member
0 Kudos

DATA: l_r_not_allowed TYPE REF TO cl_abap_conv_in_ce.

DATA: w_not_allowed TYPE string.

CONSTANTS: c_not_allowed_char(32) TYPE x VALUE

'09'.

      • but you could add in other ascci < 32 character strings eg '0D0A09 etc....'

FORM compute_data_field

IF w_not_allowed IS INITIAL.

l_r_not_allowed =

cl_abap_conv_in_ce=>create( input = c_not_allowed_char ).

l_r_not_allowed->read( IMPORTING data = w_not_allowed ).

ENDIF.

RESULT = COMM_STRUCTURE-(FIELD).

WHILE RESULT CA w_not_allowed.

SHIFT RESULT+sy-fdpos LEFT.

ENDWHILE.