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: 

Replacing New Line character in a hexadecimal string in ECC5.0

Former Member
0 Kudos

Hi,

I am trying to create an XML document using ABAP.

I have created one DOM and later used the DOM to get the XML content into an internal table in form of Hexadecimal String. In that internal table(which contains XML in form of hexadecimal content), I want to search for the new line character and replace it by Space.

I have used class CL_XML_DOCUMENT to create such document.

Now, the keyword 'SEARCH' which searches the New Line character, works on the hexadecimal content of the internal table in 46C and I get an XML document. I get the position of the New Line in SY-FDPOS and can do whatever I want. But SEARCH on hexadecimal content is not permitted in ECC 5.0. I get a syntax error when I try to do so. Tried many options but could not succed.

Would apreciate if anyone can help in finding and replacing characters like new line, tab etc in a hexadecimal string.

Thanks.

Can anyone

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

Try declaring the hexadecimal char using class attribute.

like

class CL_ABAP_CHAR_UTILITIES definition load.

data:v_nl type ABAP_CHAR1 value

CL_ABAP_CHAR_UTILITIES=>NEWLINE.

and try search.

Thanks,

Vamsi.

3 REPLIES 3

christian_wohlfahrt
Active Contributor
0 Kudos

Hi!

When you say hexadecimal string, you mean variable - otherwise string (= character) operations would work?

Then you have to go for hex handling -> do it yourself. Make something like

data: lf type x value '0A',
      sp type x value '20', 
      i type i.
I = 0.
while sy-subrc = 0.
  if hex_string+i(1) = lf.
    hex_string+i(1) = sp.
  endif.
  add 1 to i.
endwhile.

Regards,

Christian

Former Member
0 Kudos

Hi,

Try declaring the hexadecimal char using class attribute.

like

class CL_ABAP_CHAR_UTILITIES definition load.

data:v_nl type ABAP_CHAR1 value

CL_ABAP_CHAR_UTILITIES=>NEWLINE.

and try search.

Thanks,

Vamsi.

0 Kudos

Thanks for the suggestions.

The problem is solved.

Handling of hexadecimal characters is done in a different manner in ECC 5.0.

Using the class CL_ABAP_CHAR_UTILITIES can solve problems for some cases (certainly for new line and line feed).

In order to resolve the issue I have come across, I have used a different approach than in 46C.

SAP has provided some sample reports ( Search for BCCIXML* in SE38 ). We have various interfaces and Classes that can help in XML processing.