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

Convert Volume

Former Member
0 Likes
3,613

Hello Friends

Please tell me How Can I convert Volume

from Unit CDM

to Unit M3

Is there any function module available for that.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,935

Hi,

use the following FM's

<b>POPUP_UNIT_CONVERSION

UNIT_CONVERSION_SIMPLE</b>.

parameters: p_qtyi type p decimals 2,

p_uomi type t006a-msehi,

p_uomo type t006a-msehi,

p_qtyo type p decimals 2.

at selection-screen.

call function 'UNIT_CONVERSION_SIMPLE'

exporting

input = p_qtyi

  • NO_TYPE_CHECK = 'X'

  • ROUND_SIGN = ' '

unit_in = p_uomi

unit_out = p_uomo

importing

  • ADD_CONST =

  • DECIMALS =

  • DENOMINATOR =

  • NUMERATOR =

output = p_qtyo

  • EXCEPTIONS

  • CONVERSION_NOT_FOUND = 1

  • DIVISION_BY_ZERO = 2

  • INPUT_INVALID = 3

  • OUTPUT_INVALID = 4

  • OVERFLOW = 5

  • TYPE_INVALID = 6

  • UNITS_MISSING = 7

  • UNIT_IN_NOT_FOUND = 8

  • UNIT_OUT_NOT_FOUND = 9

  • OTHERS = 10

.

if sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

endif.

<b>*Reward points</b>

regards

6 REPLIES 6
Read only

Former Member
0 Likes
1,935

Hi KVC,

Check this link.

Hope it helps.

Thanks

Aneesh.

Read only

Former Member
0 Likes
1,936

Hi,

use the following FM's

<b>POPUP_UNIT_CONVERSION

UNIT_CONVERSION_SIMPLE</b>.

parameters: p_qtyi type p decimals 2,

p_uomi type t006a-msehi,

p_uomo type t006a-msehi,

p_qtyo type p decimals 2.

at selection-screen.

call function 'UNIT_CONVERSION_SIMPLE'

exporting

input = p_qtyi

  • NO_TYPE_CHECK = 'X'

  • ROUND_SIGN = ' '

unit_in = p_uomi

unit_out = p_uomo

importing

  • ADD_CONST =

  • DECIMALS =

  • DENOMINATOR =

  • NUMERATOR =

output = p_qtyo

  • EXCEPTIONS

  • CONVERSION_NOT_FOUND = 1

  • DIVISION_BY_ZERO = 2

  • INPUT_INVALID = 3

  • OUTPUT_INVALID = 4

  • OVERFLOW = 5

  • TYPE_INVALID = 6

  • UNITS_MISSING = 7

  • UNIT_IN_NOT_FOUND = 8

  • UNIT_OUT_NOT_FOUND = 9

  • OTHERS = 10

.

if sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

endif.

<b>*Reward points</b>

regards

Read only

Former Member
0 Likes
1,935

Hi KVC,

M3 = CDM / 1000.

Regards, Dieter

Read only

Former Member
0 Likes
1,935

data : inputval type i,

outval type i.

inputval = 69.

CALL FUNCTION 'UNIT_CONVERSION_SIMPLE'

EXPORTING

INPUT = inputval

NO_TYPE_CHECK = 'X'

  • ROUND_SIGN = ' '

UNIT_IN = 'KG'

UNIT_OUT = 'LB'

IMPORTING

  • ADD_CONST =

  • DECIMALS =

  • DENOMINATOR =

  • NUMERATOR =

OUTPUT = outval

EXCEPTIONS

CONVERSION_NOT_FOUND = 1

DIVISION_BY_ZERO = 2

INPUT_INVALID = 3

OUTPUT_INVALID = 4

OVERFLOW = 5

TYPE_INVALID = 6

UNITS_MISSING = 7

UNIT_IN_NOT_FOUND = 8

UNIT_OUT_NOT_FOUND = 9

OTHERS = 10

.

IF SY-SUBRC <> 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

write outval.

Read only

Former Member
0 Likes
1,935

Hi

Check the fun modules

UNIT_CONVERSION_SIMPLE and

MD_CONVERT_MATERIAL_UNIT

Reward points if useful

Regards

Anji

Read only

dev_parbutteea
Active Contributor
0 Likes
1,935

HI,

you can use fm /cwm/convert_to_unit_of_val.