Skip to Content
avatar image
Former Member

0UNIT Conversion

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'?

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • avatar image
    Former Member
    May 01, 2006 at 04:02 PM

    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

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      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?

  • avatar image
    Former Member
    May 01, 2006 at 04:31 PM

    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

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      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