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: 

[Help] Can't remove CR/LF - character

Former Member
0 Kudos


Dear All,

Can you help me about the problem stated in this thread.

Basically, I have program that Get data from the SAP Server AL11.

The problem is  i cannot strip the CR/LF from the file: The file looks like this - " BE10#A#L1211000#ZZZZZZZZ#WD-5#9:00 " .

Ive used the following method but none of them worked.

  • lc_hash TYPE char1 VALUE cl_abap_char_utilities=>cr_lf
  • FM: SF_SPECIALCHAR_DELETE'
  • REPLACE ALL OCCURRENCES OF '#' IN lv_char WITH space.

Note: the file if rom a EXCEL -> then i copy it to a NOTEPAD -> then upload it using CG3Z.

You response is highly appreciated.

1 ACCEPTED SOLUTION

rosenberg_eitan
Active Contributor
0 Kudos

Hi,

Please use the debugger to find out what is this pesky character....

Here we can see a string that was composed using:

DATA: my_string TYPE string .

  CONSTANTS: c_ccc TYPE string VALUE 'aaaa'  .

  CONCATENATE c_ccc cl_abap_char_utilities=>horizontal_tab
              c_ccc cl_abap_char_utilities=>horizontal_tab
              c_ccc cl_abap_char_utilities=>horizontal_tab
              c_ccc cl_abap_char_utilities=>horizontal_tab
    INTO my_string .
   
This is a Unicode system.

we can see the 0900 which is the cl_abap_char_utilities=>horizontal_tab

6100 6100 6100 6100 0900 610061006100610009006100610061006100090061006100610061000900



Regards.

15 REPLIES 15

nabheetscn
Active Contributor
0 Kudos

Hi Mark

Did you try using split statement. It may look like # but can be a junk character not sure

Nabheet

Former Member
0 Kudos

Hi

You should use your first method (based on cl_abap_char_utilities=>cr_lf)

Max

Tomas_Buryanek
Active Contributor
0 Kudos

cl_abap_char_utilities=>cr_lf has length char 2


This does not work?


REPLACE ALL OCCURRENCES OF cl_abap_char_utilities=>cr_lf IN lv_char WITH space.

-- Tomas --

SuhaSaha
Advisor
Advisor
0 Kudos

I think it's the horizontal tab & not the CR/LF character

0 Kudos

Yeah, it looks like it.

By the way Marky, you can check hex value of # in debbuger and see what exactly it is...

-- Tomas --

Former Member
0 Kudos

Hi Nabheet.

yes iused also Split..     

SPLIT '#' AT lv_cr INTO: lv_bukrs
          lv_mkoar
          lv_vkont
          lv_bkont
          lv_date
          lv_time.


and

      SPLIT    cl_abap_char_utilities=>cr_lf  AT  lv_cr INTO: lv_bukrs
          lv_mkoar
          lv_vkont
          lv_bkont
          lv_date
          lv_time.

No good .. ..

Hello MAX...

yes.. that should be used, but i dont know why it WONT worked.

rosenberg_eitan
Active Contributor
0 Kudos

Hi,

Please use the debugger to find out what is this pesky character....

Here we can see a string that was composed using:

DATA: my_string TYPE string .

  CONSTANTS: c_ccc TYPE string VALUE 'aaaa'  .

  CONCATENATE c_ccc cl_abap_char_utilities=>horizontal_tab
              c_ccc cl_abap_char_utilities=>horizontal_tab
              c_ccc cl_abap_char_utilities=>horizontal_tab
              c_ccc cl_abap_char_utilities=>horizontal_tab
    INTO my_string .
   
This is a Unicode system.

we can see the 0900 which is the cl_abap_char_utilities=>horizontal_tab

6100 6100 6100 6100 0900 610061006100610009006100610061006100090061006100610061000900



Regards.

0 Kudos

Thank you also Eitan,

For lending a help to remind about reading HEX values from debugger.


Former Member
0 Kudos

HI all,

If you notice LV_CHAR from the right pane has NO VALUE '#'

     but in the left pane LV_CHAR HAS a value '#'.

its kind a weird to see this event.: the process is removing '#' is SUCCESS but the actual outcome is NOT success.

the hex value is "2004500310030000900410009004C0031003200310031003000300030000900"

0 Kudos

Did you notice the repeating hex value '0900'? I think you now know which character you need to use.

0 Kudos

Hi,

Have you try the split with cl_abap_char_utilities=>horizontal_tab ?

Regards.

0 Kudos

Hi Suhas,

Thanks for reminding me.. the '0900' value..

I've already solved the problem.

Its just on my previous developments as always assumed that is always CR/LF. anyways thanks again for the hint.

kiran_k8
Active Contributor
0 Kudos

Marky,

It seems you are dealing with a file where the fields are separated by #.

Open dataset

Do.

read dataset

if sy-subrc = 0.

using split statement append the data into an internal table.

else.

exit.

endif.
Enddo.

Close dataset.

cr_lf  denotes end of the line.I think there is no need to consider that as long as you are reading the data from app server and not writting the data to appserver.cr_lf will be used to denote end of the line while writting a file to the appserver.

K.Kiran.

Former Member
0 Kudos

Probably that means # is not CR/LF

Max

Former Member
0 Kudos


Dear all,

Problem is solved.

thank you..