This website is not affiliated with, sponsored by, or approved by SAP AG.

add in the string

Development (ABAP Development WorkBench, ABAP/4 programming)

Moderators: thx4allthefish, Snowy, Gothmog, YuriT

add in the string

Postby luzak » Wed Feb 22, 2012 7:54 pm

hi
i have value in string separated by : something like this
11:3:4
2:2
4:2:2:2:2
3:1
.....
I must add value from row. What is the beter way ? I don't now how many value is separated in one row by :

thx for a hint.

luzak
 
Posts: 15
Joined: Sat Sep 10, 2011 8:39 am

Re: add in the string

Postby Grogan » Wed Feb 22, 2012 9:17 pm

luzak wrote:I must add value from row

I am afraid your question is not quite clear. Do you mean just add a value to the end of the string ? If so then use CONCATENATE. If that is not what you mean then you will need to provide more detail and an example.

Cheers,
Grogan

Award cash if useful.
Grogan
 
Posts: 310
Joined: Thu Aug 04, 2005 7:16 pm
Location: Australia

Re: add in the string

Postby Rich » Thu Feb 23, 2012 2:15 am

Use SPLIT at ':' into a table for both the source strings and then loop around the resulting tables concatenating them back into a single string.
Regards

Rich

Image
Abap KC
SFMDR
Rich
 
Posts: 6919
Joined: Thu Oct 31, 2002 4:47 pm
Location: Geneva

Re: add in the string

Postby luzak » Thu Feb 23, 2012 2:20 pm

Yes, I want add value from one row to variable.

for example:
data: i_var type i.

table ztest have column name test1.
value test1:
row 1 have value - 11:3:4
row 2 - 2:2
row 3 - 4:2:2:2:2
row 4 -3:1
....

result form test1
i_var:
row 1 - 18
row 2 - 4
row 3 - 12
row 4 - 4
luzak
 
Posts: 15
Joined: Sat Sep 10, 2011 8:39 am

Re: add in the string

Postby Gothmog » Thu Feb 23, 2012 3:12 pm

So, as Rich said, for each row use SPLIT row AT ':' INTO TABLE itab, the sum the resulting table's rows.
68 74 74 70 3a 2f 2f 74 69 6e 79 75 72 6c 2e 63 6f 6d 2f 62 64 6f 37 6d 77 67
Gothmog
 
Posts: 1467
Joined: Wed Sep 12, 2007 4:46 am
Location: Probably not home

Re: add in the string

Postby luzak » Thu Feb 23, 2012 3:30 pm

Great works :D .
thx all.
luzak
 
Posts: 15
Joined: Sat Sep 10, 2011 8:39 am


Return to ABAP

Who is online

Users browsing this forum: 469snaw1o and 11 guests




This website is not affiliated with, sponsored by, or approved by SAP AG.