Scrol

SAP Trainings contact sap.sreeram@gmail.com or 091-9916083157, 001-210-399-8414

SAP BI Routines Volume in Cubic Decimeters.


Volume in Cubic Decimeters.
DATA: VOLUME LIKE COMM_STRUCTURE-VOLUME_DL.

  IF COMM_STRUCTURE-BILL_RULE CA '45'.
    RETURNCODE = 4.
    EXIT.
  ENDIF.

  IF COMM_STRUCTURE-VOLUMEUNIT NE 'CDM'.
    VOLUME = COMM_STRUCTURE-VOLUME_DL.
    CALL FUNCTION 'UNIT_CONVERSION_SIMPLE'
         EXPORTING
              INPUT                = COMM_STRUCTURE-VOLUME_DL
              UNIT_IN              = COMM_STRUCTURE-VOLUMEUNIT
              UNIT_OUT             = 'CDM'
         IMPORTING
              OUTPUT               = VOLUME
         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 NE 0.
      CLEAR MONITOR.
      MONITOR-msgno = '010'.
      MONITOR-msgid = 'SDBW'.
      MONITOR-msgty = c_msgty_e.
      MONITOR-msgv1 = COMM_STRUCTURE-VOLUMEUNIT.
      append MONITOR.
      RETURNCODE = 4.
    ELSE.
      RESULT = VOLUME.
      RETURNCODE = 0.
    ENDIF.
  ELSE.
    RESULT = COMM_STRUCTURE-VOLUME_DL.
    RETURNCODE = 0.
  ENDIF.

  IF COMM_STRUCTURE-DOC_CATEG CA DEB_CRED.
    RESULT = RESULT * ( -1 ).
  ENDIF.

DATA: WEIGHT LIKE COMM_STRUCTURE-NET_WGT_DL.

  IF COMM_STRUCTURE-BILL_RULE CA '45'.
    RETURNCODE = 4.
    EXIT.
  ENDIF.