Application Development 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: 

Netwr without decimal point

Former Member
0 Kudos

I need to write NETWR into a file without the decimal point. So I am looking to assign it to another variable. How to do this

Say NETWR is 900.00

then var = 90000

1 ACCEPTED SOLUTION

ferry_lianto
Active Contributor
0 Kudos

Hi,

Please try this.


DATA: LV_NETWR1 LIKE VBAP-NETWR VALUE '900.00',
      LV_NETWR2(10) TYPE C.
                                                                        
MOVE LV_NETWR1 TO LV_NETWR2.
TRANSLATE LV_NETWR2 USING '. '.
CONDENSE LV_NETWR2 NO-GAPS.
WRITE LV_NETWR2 TO LV_NETWR2 RIGHT-JUSTIFIED.
TRANSLATE LV_NETWR2 USING ' 0'.
WRITE: / LV_NETWR2.

Regards,

Ferry Lianto

9 REPLIES 9

ferry_lianto
Active Contributor
0 Kudos

Hi,

Please try this.


DATA: LV_NETWR1 LIKE VBAP-NETWR VALUE '900.00',
      LV_NETWR2 TYPE I.
                                                                        
MOVE LV_NETWR1 TO LV_NETWR2.    
WRITE: / LV_NETWR1, LV_NETWR2.

OR

DATA: LV_NETWR1 LIKE VBAP-NETWR VALUE '900.00',
      LV_NETWR2(6) TYPE C.
                                                                        
MOVE LV_NETWR1 TO LV_NETWR2.
TRANSLATE LV_NETWR2 USING '. '.
CONDENSE LV_NETWR2 NO-GAPS.
                                                                        
WRITE: / LV_NETWR1, LV_NETWR2.

Regards,

Ferry Lianto

former_member181962
Active Contributor
0 Kudos

Hi Megan,

MOve it to a char type variable and then use the replace command.

v_char = v_netwr.

replace all occurances of '.' with '' into v_char.

*Now v_char wil have a value without decimal

Regards,

Ravi

Former Member
0 Kudos

Hi,

do this way


data: p type p decimals 3 value '1000.00'.
data: i type i.
move p to i.
write:/ i.

Regards,

Santosh

Message was edited by:

Santosh Kumar Patha

Former Member
0 Kudos

Hello,

try with this code:


DATA: P_TEXT(16) ."VALUE 'vasanth'.

DATA: NETWR LIKE VBAP-NETPR VALUE '900.00'.

MOVE NETWR TO P_TEXT.
REPLACE '.' WITH SPACE INTO P_TEXT.
CONDENSE P_TEXT NO-GAPS..
WRITE: P_TEXT NO-GAP.

REgards,

Vasanth

Former Member
0 Kudos

Hi Megan,

data:NETWR type f value '10319.972'.

data:netwr1 type i.

move netwr to netwr1.

write:/netwr1.

used these code u can solve the Problem.

Thanks & Regards,

Nelson

Former Member
0 Kudos

hi,

u can do like this

<b> write NETWR no decimals.</b>

reward points if this helps u

ravi

Former Member
0 Kudos

If netwr is 900.00

var(10) type c

var should be 0000090000

0 Kudos

Hi Megan,

do this way


DATA: C(20) .

DATA: NETWR TYPE NETWR VALUE '900.00'.

MOVE NETWR TO C.


REPLACE  ALL OCCURRENCES OF '.' IN C WITH SPACE.

CONDENSE C NO-GAPS..



CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
  EXPORTING
    INPUT         = C
 IMPORTING
   OUTPUT        = C
          .

WRITE: C NO-GAP.

Message was edited by:

Santosh Kumar Patha

ferry_lianto
Active Contributor
0 Kudos

Hi,

Please try this.


DATA: LV_NETWR1 LIKE VBAP-NETWR VALUE '900.00',
      LV_NETWR2(10) TYPE C.
                                                                        
MOVE LV_NETWR1 TO LV_NETWR2.
TRANSLATE LV_NETWR2 USING '. '.
CONDENSE LV_NETWR2 NO-GAPS.
WRITE LV_NETWR2 TO LV_NETWR2 RIGHT-JUSTIFIED.
TRANSLATE LV_NETWR2 USING ' 0'.
WRITE: / LV_NETWR2.

Regards,

Ferry Lianto