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

parse numc or SPLIT

Former Member
0 Likes
1,048

Hello Friends,

I have a value of form HH:MM:SS and I have to parse it as follows:

I have to take HH saprate and multiple it with 60 and then add in MM ?

Do we have somthing in ABAP that I can split this HH:MM:SS ?

What do you guys suggest, should I make the type of HH:MM:SS as numc or string ?

Regards,

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
878

Hi Shah,

Make the value as string and using split command you can do it.

parameters: time type string.

Data: min(4) type n,

hour(2) type n,

seconds(2) type n.

Split time at ':' into: hour min seconds.

min = min + hour * 60.

Regards,

Chander

6 REPLIES 6
Read only

Former Member
0 Likes
878

Hi SHAH,

take it as string and use the command SPLIT string

data: zs_string type string,

zs_1(2) type c,

zs_2(2) type c,

zs_3(2) type c.

zs_string = 'HH:MM:SS'

split zs_string at ':' into zs_1 zs_string.

split zs_string at ':' into zs_2 zs_string.

zs_3 = ( zs_1 * 60 ) + zs_2.

Message was edited by:

mukesh kumar

Read only

0 Likes
878

Hi mukesh ,

Can I then multiple the string with 60 ?

How it will works ?

Regards,

Read only

0 Likes
878

convert to string and use the split statement at ':'. Now convert each value to int and multiply.

Read only

Former Member
0 Likes
878

hi shah,

yes there is an abap command which split the varialbe...

use the following command...

split time at ' : ' into HH, MM, SS.

after this,

HH = will be having some value...from above

MM =

SS =

hope this will help u out...

please reward points in case usefull...

regards,

prashant

Read only

Former Member
0 Likes
879

Hi Shah,

Make the value as string and using split command you can do it.

parameters: time type string.

Data: min(4) type n,

hour(2) type n,

seconds(2) type n.

Split time at ':' into: hour min seconds.

min = min + hour * 60.

Regards,

Chander

Read only

Former Member
0 Likes
878

Thanks all of you ...

Regards,