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: 

to convert quan field to char

Former Member
0 Kudos

Hi ,

I have a field I_MARC-EISBE which is of type quan.

If this field EISBE is initial , I need to give blank field but not 00.000

Similarily VBBE-VMENG is initial , i need to to give blank field but not 0.000

How to convert quan to char and give blank????

Points will be rewarded

Thnaks in advance

9 REPLIES 9

Former Member
0 Kudos

data: quan like VBBE-VMENG

data:char(16).

char = quan.

Former Member
0 Kudos
chk this FM  CEVA_CONVERT_FLOAT_TO_CHAR

or

data : v_char(25).

v_char = I_MARC-EISBE.

Former Member
0 Kudos

Move the quantity value into a variable of type Characrter, please try NUMC too.

Former Member
0 Kudos

data: v1(16) type c.

move quantity to v1.

write:/ v1.

alos, try checking CEVA_CONVERT_FLOAT_TO_CHAR fm

Former Member
0 Kudos

Execute the code and see if this works for u .

data : val1 like vbbe-vmeng,
       val2(13) type c.
val1  = 2.
val1 = val1 * 0.
write:/ val1.

move val1 to val2.

if val2 eq 0.  "---> Condition if zero
val2 = space.
write:/ 'hi', val2.
endif.

val2 from 0.00 to space .

regards,

vijay

Former Member
0 Kudos

Hi Jayasree,

As abap uses internal Conversions between any Basic Data types, you can create a variable and assign this quant field to it, for whatever result type you want.

If you are trying to display the EISBE (Please refere the Piece of code i given below).

For your information refer Conversin Routine (CONVERSION_EXIT_QUANT_INPUT or CONVERSION_EXIT_QUANT_OUTPUT ) these routines converts Decimal (1) to Decimal (2) and vice versa.

**********************************070108 (DZ8Z6L)

tables: marc,

vbbe.

data: begin of t_marc occurs 0,

matnr like marc-matnr,

werks like marc-werks,

eisbe like marc-eisbe,

end of t_marc.

select matnr

werks

eisbe

from marc

into corresponding fields of table t_marc.

loop at t_marc.

if sy-tabix = 2.

t_marc-eisbe = '22.22'.

endif.

write:/ t_marc-matnr,

t_marc-werks,

t_marc-eisbe no-zero.

endloop.

For any further detaisl let me know...

Regards,

Manjunatha

Message was edited by:

MANJUNATHA KS

Former Member
0 Kudos

hI Jayashree,

DATA : V_EISBE(100) TYPE C.

IF I_MARC-EISBE IS INITIAL.

V_EISBE = I_MARC-EISBE.

ENDIF.

IF I_VBBE-VMENG IS INITIAL.

V_VMENG = I_VBBE-VMENG.

ENDIF.

WRITE : V_EISBE,

V_VMENG.

Thanks

Vikranth Khimavath

0 Kudos

Assign quan field to CHAR field or use FM CEVA_CONVERT_FLOAT_TO_CHAR

anversha_s
Active Contributor
0 Kudos

hi,

try this.

Take a character field of length which can acccomdate Quantity field and use Move statement.

data: v1(16) type c. 

move quantity to v1. 

write:/ v1.

Regards

Anver