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

Keyword 'Split'..

Former Member
0 Likes
2,423

IF WA_BRS-WAERS <> 'INR'.
SPLIT WA_BRS-WRBTR AT '.' INTO WA_BRS-WRBTR LV_STR1.
TRANSLATE WA_BRS-WRBTR USING ', '.
CONDENSE WA_BRS-WRBTR NO-GAPS.
ENDIF.

******************************************* Explanation***********************************************

Here i need only a part before '.'

For example:

1055.50

I need only '1055' and '50' i will not be using anywhere in my program.

So here WA_BRS-WRBTR  = '1055' and LV_STR1 = '50'.

While checking Extended Program Check it is showing,

No read access to LV_STR1.

Is there anyother keyword for getting only first part other than 'Split' ?

Thanks in advance.

Moderator Message: Basic ABAP syntax question - unmarked as question.

Message was edited by: Suhas Saha

16 REPLIES 16
Read only

kakshat
Product and Topic Expert
Product and Topic Expert
0 Likes
2,378

As per SAP keyword help:

If there are not enough data objects result1 result2 ... to record all the segments, dobj is only separated until all the data objects result1 result2 ... have been assigned values, except for the last data object. The remaining content of dobj is assigned to the final data object, without being separted.

Did you check what happens if you don't write LV_STR1?

Read only

Former Member
0 Likes
2,378

Ya its throwing error.

Read only

Former Member
0 Likes
2,378

Hi,

use trunc( val ). option to get only integer part.

data: hello type wrbtr value '123.44'.

write: hello.

hello = trunc( hello ).

thanks.

Read only

0 Likes
2,378

I tried this Aswatha but its telling 'trunc' keyword is not there. Please reply ASAP.

Read only

0 Likes
2,378

Hey its not a key word but its a method you can directly use.

data: hello type wrbtr value '123.44'.

write: hello.

hello = trunc( hello ).

thanks.

its there just try executing this.

thanks.

Read only

0 Likes
2,378

I am not getting you Ashwatha. Really sorry 😞

Read only

0 Likes
2,378

Hey i think you are not giving space inside the call to it..

hello(space)=(space)trunc((space)hello(space)).

replace (space) by space here u should not give space between trunc and ( ... and you should give spaces between ( and hello and ).

check here

http://help.sap.com/saphelp_nw2004s/helpdata/en/fc/eb3316358411d1829f0000e829fbfe/content.htm

Read only

0 Likes
2,378

Thank you so much. Its working now 🙂

Read only

0 Likes
2,378

No problem....

Read only

Former Member
0 Likes
2,378

Hi

Try moving that string to final internal table and do not dispaly it. (Do not prepare a fieldcat for that string)

Regards

Read only

Former Member
0 Likes
2,378

Hello Arun,

Split should work. first of all you need to move value of wa_brs-wrbtr to character type field because SPLIT will work for characters not currency fields.

PFA the screenshot for your reference.

Read only

0 Likes
2,378

Hi Deepthi,

Hey here i dont want to use lv_cnt2 itself..

Read only

0 Likes
2,378

I am not getting what's your exact requirement. As per blog i understood that you need data before decimal place. So in my attached screenshot , you will get in lv_cnt using split. you can use your own variables for this.

sorry if i misunderstood your requirment.

regards,

Deepti

Read only

0 Likes
2,378

Hey its ok. My requirement is without using split keyword i should get first part i.e Integer part. Got it Now. Thanks Deepti 🙂

Read only

0 Likes
2,378

Ok.No problem.

Regards,

Deepti

Read only

mangesh_sonawane
Participant
0 Likes
2,378

Hi Arun,

if u goto Attributes of program u just tick the check box 'Fixed point Arithmetic' and it will do rounding off the numeric values.So u will get the number before that '.'.

Regards,

Mangesh Sonawane.