‎2007 Oct 24 2:59 PM
data: ALPHA1(14) TYPE C value '10000.00' .
alpha1 has the value '10000.00'.
I want to remove the decimal part using the shift command and the string should be '10000 '.
How we can use the shift command to change the string as '10000'.
Thanks,
‎2007 Oct 24 3:06 PM
Abhishek,
Declare a integer variable and move the value of the decimal variable to that. you problem will get solved.. you need not to use shift statement.
<b>Reward for helpful answers</b>
Satish
Message was edited by:
Satish Panakala
‎2007 Oct 24 3:06 PM
Abhishek,
Declare a integer variable and move the value of the decimal variable to that. you problem will get solved.. you need not to use shift statement.
<b>Reward for helpful answers</b>
Satish
Message was edited by:
Satish Panakala
‎2007 Oct 24 8:28 PM
Hi Satish.
Only when the currency is without any decimal places like JPY I need to declare a integer variable and move the value of the decimal variable to that.
Is there any way to find out that whether the currency is having decmal places or not.
If the currency does not decimal placves like JPY or LIRA, then we will declare a integer variable and move the value of the decimal variable to that else we don't do any change.
How we can implement the code to check whether the currency is having decimal places or not. Pls suggest. Thanks
‎2007 Oct 24 3:10 PM
‎2007 Oct 24 3:12 PM
Hi abhishek,
try this
REPORT YCHATEST2.
DATA: ALPHA1(14) TYPE C VALUE '10000.00' .
SEARCH ALPHA1 FOR '...'.
IF SY-SUBRC EQ 0.
CLEAR ALPHA1+SY-FDPOS(3).
ENDIF.
WRITE : ALPHA1.
‎2007 Oct 24 3:17 PM
hi Abhishek,
is it necessary to use the SHIFT command?
You can easily do with SPLIT:
SPLIT alpha1 INTO ... AT '.'.
then you have 10000 and 00
ec
‎2007 Oct 25 3:22 AM
Hi
Possible Shift functions :
shifting strings by a given number of places
DATA: t1(10) TYPE c VALUE 'abcdefghij',
string1 LIKE t1.
string1 = t1.
WRITE string1.
SHIFT string1.
WRITE / string1.
string1 = t1.
SHIFT string1 BY 3 PLACES LEFT.
WRITE / string1.
string1 = t1.
SHIFT string1 BY 3 PLACES RIGHT.
WRITE / string1.
string1 = t1.
SHIFT string1 BY 3 PLACES CIRCULAR.
WRITE / string1.
SKIP.
ULINE.
shifting up to a given string
DATA: t2(10) TYPE c VALUE 'abcdefghij',
string2 LIKE t2,
str2(2) TYPE c VALUE 'ef'.
string2 = t2.
WRITE string2.
SHIFT string2 UP TO str2.
WRITE / string2.
string2 = t2.
SHIFT string2 UP TO str2 LEFT.
WRITE / string2.
string2 = t2.
SHIFT string2 UP TO str2 RIGHT.
WRITE / string2.
string2 = t2.
SHIFT string2 UP TO str2 CIRCULAR.
WRITE / string2.
SKIP.
ULINE.
shifting a string depending on the first or last sign
DATA: t3(14) TYPE c VALUE ' abcdefghij',
string3 LIKE t3,
str3(6) TYPE c VALUE 'ghijkl'.
string3 = t3.
WRITE string3.
SHIFT string3 LEFT DELETING LEADING space.
WRITE / string3.
string3 = t3.
SHIFT string3 RIGHT DELETING TRAILING str3.
WRITE / string3.
Thanks,
Praveen