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

function module for converting weight unit to another unit.

0 Likes
6,518

What is the function module for converting weight unit to another unit.

I want to convert LB to KG.

Tried with fm UNIT_CONVERSION_SIMPLE.

INPUT                           100

NO_TYPE_CHECK

ROUND_SIGN                      X

UNIT_IN                         LB

UNIT_OUT                        KG

But there is no output.

Can some one help.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,669

This code is working fine for me..

DATA: a TYPE i VALUE 10,

       b type i.

CALL FUNCTION 'UNIT_CONVERSION_SIMPLE'

   EXPORTING

     input                      = a

    UNIT_IN                    = 'LB'

    UNIT_OUT                   = 'KG'

  IMPORTING

    OUTPUT                     = b

           .

WRITE b.

6 REPLIES 6
Read only

Former Member
0 Likes
2,670

This code is working fine for me..

DATA: a TYPE i VALUE 10,

       b type i.

CALL FUNCTION 'UNIT_CONVERSION_SIMPLE'

   EXPORTING

     input                      = a

    UNIT_IN                    = 'LB'

    UNIT_OUT                   = 'KG'

  IMPORTING

    OUTPUT                     = b

           .

WRITE b.

Read only

Former Member
0 Likes
2,669

The trick here is we need decalre input output with non-character data type like VBPLK-BRGEW.

We can test using normal SE37.

I tested and this program worked fine:

   data: UNIT_IN  LIKE T006-MSEHI,
       UNIT_OUT LIKE T006-MSEHI,
       output LIKE VBPLK-BRGEW,
       input LIKE VBPLK-BRGEW.

input = 10.
  CALL FUNCTION 'UNIT_CONVERSION_SIMPLE'
       EXPORTING
            INPUT    = INPUT
            UNIT_IN  = 'LB' "UNIT_IN
            UNIT_OUT = 'KG' "UNIT_OUT
       IMPORTING
            OUTPUT   = OUTPUT.

  write: output.

Read only

RaymondGiuseppi
Active Contributor
0 Likes
2,669

Recreate your code using pattern option and giving FM name, there is an exported parameter : OUTPUT so it should appear in IMPORTING part of the signature in the calling program.

Also check conversion-exit CUNIT for unit of measure.

Regards,

Raymond

Read only

sivaganesh_krishnan
Contributor
0 Likes
2,669

hi suresh,

yes , this is strange while executing in se37 there is no output but while executing in report the values are comming correctly.

Read only

0 Likes
2,669

This is not strange actually if you look closely in your program you are passing typed parameters to the FM which you are not doing in Se37

Nabheet

Read only

0 Likes
2,669

Got that