Application Development and Automation 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: 
Read only

Error when using SPLIT AT statement

Former Member
0 Likes
1,015

H Experts,

I was trying to call a webservice from ABAP. I got the data as string in the resuklt parameter using the statment

result = http_client->response->get_cdata( ).

Now i need to split it at carriage return in the string . I have used teh statment

SPLIT result AT cl_abap_char_utilities=>cr_lf INTO TABLE result_tab .

This is not working , even after this statement my result_tab is having only 1 records which is the full string .

Please suggest what could be wrong.

Many Thanks,

Neeraj

1 ACCEPTED SOLUTION
Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
885

>

> Now i need to split it at carriage return in the string . I have used teh statment

> SPLIT result AT cl_abap_char_utilities=>cr_lf INTO TABLE result_tab .

Hello,

You are trying to split at carriage return(CR) but in your code your are trying to split at Carriage Return + Line Feed

Try like this:

DATA:
      v_cr TYPE char1.
v_cr = cl_abap_char_utilities=>cr_lf+0(1).

SPLIT result AT v_cr INTO TABLE result_tab

BR,

Suhas

5 REPLIES 5
Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
886

>

> Now i need to split it at carriage return in the string . I have used teh statment

> SPLIT result AT cl_abap_char_utilities=>cr_lf INTO TABLE result_tab .

Hello,

You are trying to split at carriage return(CR) but in your code your are trying to split at Carriage Return + Line Feed

Try like this:

DATA:
      v_cr TYPE char1.
v_cr = cl_abap_char_utilities=>cr_lf+0(1).

SPLIT result AT v_cr INTO TABLE result_tab

BR,

Suhas

Read only

Former Member
0 Likes
885

Hi Suhas,

I need the data in this format . The string contains the full data in single line as it is a string. How can i achieve thsi>?

<?xml version="1.0" encoding="UTF-8" ?>

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

<soapenv:Body>

<ns0:FFecureIDAccount_By_UPI_ActiveResponse xmlns:ns0="urn:WB_DATA_RemoteAccessAccounts" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

<ns0:getListValues>

<ns0:Account_id>12345</ns0:Account_id>

<ns0:Account_Key />

<ns0:Account_Type>FFCURID</ns0:Account_Type>

<ns0:Assigned_To />

<ns0:Billable />

<ns0:Cost_Object_Type />

<ns0:Cost_Object_Value />

</ns0:getListValues>

</ns0:FFecureIDAccount_By_UPI_ActiveResponse>

</soapenv:Body>

</soapenv:Envelope>

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
885

Hello Niraj,

I think you got the entire XML parsed as a string & you want to display the XML in this format . Correct ?

What exactly is you req.?

Cheers,

Suhas

Read only

0 Likes
885

Hi,

Then try with new line attribute of the class cl_abap_char_utilities

data: c_new value cl_abap_char_utilities=>newline

Now split at c_new.

Regards,

Swarna Munukoti

Read only

Clemenss
Active Contributor
0 Likes
885

Hi Neera,

if it does not split into more than one record, then the string does not contain any cl_abap_char_utilities=>cr_lf. cl_abap_char_utilities=>cr_lf are two characters, a carriage return and a linefeed. This is something almost nobody uses except Bill Gates. Unix uses only a line feed. Try this.

Regards,

Clemens