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: 

Uploading file has NULL characters... And in itab it is coming as #

Former Member
0 Kudos

Hi all,

I have a flat file which is coming from Third party system (Non SAP). That file has NULL characters.

When i am trying to upload it with GUI upload, the NULL characters are coming as #.

I want the NULL characters to be converted into space.

Is there any codepage exists for this ? or there is any other method to achieve this .

Thanks in advance .

Regards,

Sunny.

5 REPLIES 5

Former Member
0 Kudos

Hi Termi,

Use HORIZONTAL_TAB method of class CL_ABAP_CHAR_UTILITIES

      • symbol is used for new line carried feed variable. It can be replaced with the following code.

Replace all occurances of CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB in string with space

Regards

Abhii

0 Kudos

Hi Abhi,

Thanks for replying.

In fact the # which is coming is not for the line feed. When i open the file which I am uploading in Notepad++ editor, there i can see it as NULL.

Eg : if there are 4 columns

123 NULL ¦ test1 NULL ¦ X NULL ¦ 0011222 ¦

Something like above .

So when i see the Itab after GUI_UPLOAD FM, the places where ever NULL is there it is getting replaced by #.

For GUI_UPLOAD we pass PAGE CODE as import parameter.

There must be some page code for this NULL character.

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

Yes, I had a similar issue a couple weeks ago, and I basically couldn't tell what the # stood for, was it a tab? a CR_LF?, something else? None of the attributes in CL_ABAP_CHAR_UTILITIES would match. So I had to go with a much more ugly approach. Check the value against readable characters. Like this.

So here we check that the value is not any Alpha characters, then we check if it is not any numeric characters, then we check against other readable characters, and if the actual value is only one character long, then we clear out the value, expecting that it is a non-printable character.

IF  ls_rowdata-colvalue(1) NA sy-abcde
              AND ls_rowdata-colvalue(1) NA '0123456789'
              AND ls_rowdata-colvalue(1) NA '<>?:"';/.,-_=+[]{}\|!@#$%^&*()`~'
              AND STRLEN( ls_rowdata-colvalue ) = 1.
            CLEAR ls_rowdata-colvalue.
          ENDIF.

Regards,

Rich Heilman

0 Kudos

Hi Heilman,

Thanks for replying.

I guess there will be some page code defined for this which we can pass to the GUI_UPLOAD FM.

If nothing is found then, i guess your code can be the alternative. However we dont know at what place the # is coming so that I can replace it. It can come at any position in 4 columns of the itab as shown in example above.

Regards,

Sunny.

Edited by: Termi S on Dec 9, 2009 4:55 PM

0 Kudos

Hi Termis,

Just have a look at this link about the code pages :-

[;

Regards

Abhii