cancel
Showing results for 
Search instead for 
Did you mean: 

0UNIT Conversion

Former Member
0 Kudos

I am using the UNIT_CONVERSION_SIMPLE FM to translate a unit field when it is not equal to 'CS'. The first thing I am checking is to see if the 'unit' coming in is equal to 'CS'. If it is not, then I call the FM to do some conversion. I get an error message saying that "COMM_STRUCUTRE does not have component called 'cases'.

IF COMM_STRUCTURE-CASES NE 'CS'.

WEIGHT = COMM_STRUCTURE-CASES_REV.

CALL FUNCTION 'UNIT_CONVERSION_SIMPLE'

EXPORTING

INPUT = COMM_STRUCTURE-CASES_REV

UNIT_IN = COMM_STRUCTURE-CASES

UNIT_OUT = 'CS'

IMPORTING

OUTPUT = WEIGHT

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.

ENDIF.

How can I check to make sure the unit coming in is NE to 'CS'?

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Nyrvole Vincent,

Try to write the same code in start routine(update rules).

Like

Loop at data_package.

IF Data_package-CASES NE 'CS'.

WEIGHT = Data_package-CASES_REV.

CALL FUNCTION 'UNIT_CONVERSION_SIMPLE'

EXPORTING

INPUT = Data_package-CASES_REV

UNIT_IN = Data_package-CASES

UNIT_OUT = 'CS'

IMPORTING

OUTPUT = WEIGHT

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.

ENDIF.

Endloop.

Hope it helps

Srini

Former Member
0 Kudos

It did not work. I get the same error that 'DATA_PACKAGE does not have component called CASES'. If I can't access this unit field, then how can I test to make sure that my data coming in is in the correct format?

Thanks for your help, Srini.

Former Member
0 Kudos

Srini,

I figured out the problem. I needed to have '/BIC/' in front of the COMM_STRUCTURE. "COMM_STRUCTURE-/BIC/CASES" NOT 'COMM_STRUCTURE-CASES'.

My code is not working perfectly, but I this error has been taken care of.

thanks,

Nyrvole

Former Member
0 Kudos

Hi Nyrvole Vincent,

I think the field CASES is not available in communication structure, check. or you are giving wrong name.

Include this field(CASES) in communication structure. Then only you can use as COMM_STRUCTURE-CASES.

Hope it Helps

Srini

Former Member
0 Kudos

CASES is included in the comm structure as a UNIT of measurement. If I am not allowed to access this field in my update routine, then how can I check to see what the unit field is for a transaction coming into my ODS?