‎2006 Nov 02 12:51 PM
Hi friends,
I have two questions in scripts
1. I want to display a value without decimals
ex: 45.000 output 45
2.I want to bring the negative sign before
ex : 5.55- output -5.55
Please tell me how to do it.
Regards,
‎2006 Nov 02 1:24 PM
Hi Venu ,
for values in teh scripts do this .
&itab-value(4.0)&
or
&itab-value(C.0)&
<b>IN UR DRIVER PROGRAM</b>
for sign use fm
CLOI_PUT_SIGN_IN_FRONT
declare one field as V_VAR(10) type c,
CLOI_PUT_SIGN_IN_FRONT
v_var now contains value -55.5
now in the display in the script
&v_var&
regards,
Vijay.
ensure that v_var is in global symbols .
Message was edited by: Vijay
‎2006 Nov 02 12:52 PM
hi,
<i>Easiest way is to move it to a field with no decimals. check the example.</i>
report zXYZ_0001.
data: p1 type p decimals 2 value '11.44'.
data: p2 type p decimals 0.
p2 = p1.
write:/ p2.
p1 = '11.88'.
p2 = p1.
write:/ p2.
<i>minu sign before a value</i>
data : shkzg type c value 'E'.
data: p type p decimals 2 value 100.
data: c(18) type c.
if shkzg = 'E'.
p = p * -1.
c = p.
concatenate '-' c into c.
condense c no-gaps.
else.
c = p.
endif.
write:/ c.
*******************************
if itab-shkzg = 'H'.
v_amount = itab-shkzg.
else.
CALL FUNCTION 'CLOI_PUT_SIGN_IN_FRONT'
CHANGING
VALUE = itab-shkzg.
v_amount = itab-shkzg
endif
Message was edited by: Anversha s
‎2006 Nov 02 1:11 PM
Hi Anwersha,
This is my subroutine I am getting values in decimals even though, pls tell me how to do it,
FORM sub2 TABLES input STRUCTURE itcsy
output STRUCTURE itcsy.
READ TABLE input WITH KEY 'VBDPR-FKIMG'.
ifkimg = input-value.
ifkimg = ifkimg * 20.
MOVE ifkimg TO ofkimg.
LOOP AT output.
IF sy-tabix = 1.
output-value = ofkimg.
MODIFY output INDEX sy-tabix.
ENDIF.
ENDLOOP.
ENDFORM. "SUB2
Regards,
Venu
‎2006 Nov 02 1:28 PM
hi venu,
try this.
i am getting it correctly.
data: p1 type p decimals 2 value '11.44'.
data: p2 type p decimals 0.
p2 = p1.
write:/ p2.
p1 = '11.88'.
p2 = p1.
write:/ p2.
rgds
anver
‎2006 Nov 02 12:55 PM
Hi Venu,
1. I want to display a value without decimals
- WRITE AMOUNT decimals 0.
2.I want to bring the negative sign before
CLOI_PUT_SIGN_IN_FRONT
Reward points if this helps.
Manish
‎2006 Nov 02 1:24 PM
Hi Venu ,
for values in teh scripts do this .
&itab-value(4.0)&
or
&itab-value(C.0)&
<b>IN UR DRIVER PROGRAM</b>
for sign use fm
CLOI_PUT_SIGN_IN_FRONT
declare one field as V_VAR(10) type c,
CLOI_PUT_SIGN_IN_FRONT
v_var now contains value -55.5
now in the display in the script
&v_var&
regards,
Vijay.
ensure that v_var is in global symbols .
Message was edited by: Vijay
‎2006 Nov 02 1:48 PM
Hi venu ,
for the query dont change any data type whenever u r doing this decimal conversions ..
simply take a character variable and move ..
remember that in the scripts do not use space for alignment , strictly do it with the tab positions ..
also in debugging change the values to the maximum number
and check the alignment .
once u do this check with print out okay .
______________________________
to anversha ,
ur logic is right .
regards,
Vijay.
‎2006 Nov 02 2:04 PM
Hi Vijay,
Yes I got the output, Thanx a lot.
But if want to move a value little, byt using tab it is not possible, How to do at that time.
Regards,
Venu
‎2006 Nov 02 2:06 PM
Hi venu
1. Display a value without decimals in SAP Scripts
&symbol(.N)&
eg. &EKPO-MENGE& -> 1,234.560
&EKPO-MENGE&(.0)& -> 1,235
2. Bring the negative sign before in SAP Scripts
&symbol(<)&
eg. &ITCDP-TDULPOS& -> 100.00-
&ITCDP-TDULPOS(<)& -> -100.00
Regards,
Sreekanth
‎2006 Nov 02 2:16 PM
thats what i was referring to
//
But if want to move a value little, byt using tab it is not possible, How to do at that time.
//
see besides u will be having paragraph format
like
Z1 |,,,,&itab-value,, |
now go to the paragraph format of Z1
,, is one tab number
,,,, is 2 tab number
in tabs for the occurance of the tabs
,,,,,, above i used this
Number Tab position Alignment
1 3mm left
2 9mm left
3 45mm left
tabs ---
now if i want to move the value now work on number 2
slightly decrease or increase by +-2mm and check the value .
change the alignment to right or left ..
<b>u have to do it the alignment in the tabs ...</b>
just do the manipulations u will see the change
regards,
vijay
Message was edited by: Vijay