fROM PPV report
Month search help:
include rmcs0f0m.
s_month for s001-spmon
at selection-screen on value-request for s_month-low.
perform monat_f4.
Get BOM components:CSAP_MAT_BOM_READ (do UNIT CONVERSION
between assembly and conponent,or between BOM and Material Master)
Get open po qty:MB_ADD_PURCHASE_ORDER_QUANTITY
Get plant stock:MD_STOCK_REQUIREMENTS_LIST_API
Convert to HKD:CONVERT_TO_LOCAL_CURRENCY
LOOP AT LT_STPO INTO LS_STPO.
CLEAR LS_COST.
READ TABLE LT_COST INTO LS_COST BINARY SEARCH
WITH KEY MATERIAL = LS_STPO-COMPONENT.
IF SY-SUBRC EQ 0.
IF LS_COST-COST_UNIT NE 0.
IF LS_STPO-COMP_QTY IS NOT INITIAL .
PERFORM GET_FLOAT_FROM_CHAR USING LS_STPO-COMP_QTY CHANGING LV_COMP_QTY."Need convert
ENDIF.
IF LS_STPO-COMP_SCRAP IS NOT INITIAL .
PERFORM GET_FLOAT_FROM_CHAR USING LS_STPO-COMP_SCRAP CHANGING LV_COMP_SCRAP."Need convert
ENDIF.
ENDIF.
ENDIF.
ENDLOOP.
FORM GET_FLOAT_FROM_CHAR USING PV_CHAR CHANGING CS_FLOAT.
CALL FUNCTION 'HRCM_STRING_TO_AMOUNT_CONVERT'
EXPORTING
STRING = PV_CHAR
DECIMAL_SEPARATOR = '.'
THOUSANDS_SEPARATOR = ','
IMPORTING
BETRG = CS_FLOAT
EXCEPTIONS
CONVERT_ERROR = 1
OTHERS = 2.
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. " GET_FLOAT_FROM_CHAR
FORM GET_UNIT_CONVERSION
USING PV_INPUT
PV_UNIT_IN TYPE T006-MSEHI
PV_UNIT_OUT TYPE T006-MSEHI
CHANGING CV_OUT.
CALL FUNCTION 'UNIT_CONVERSION_SIMPLE'
EXPORTING
INPUT = PV_INPUT
* NO_TYPE_CHECK = 'X'
* ROUND_SIGN = ' '
UNIT_IN = PV_UNIT_IN
UNIT_OUT = PV_UNIT_OUT
IMPORTING
* ADD_CONST =
* DECIMALS =
* DENOMINATOR =
* NUMERATOR =
OUTPUT = CV_OUT
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.
ENDFORM. " GET_UNIT_CONVERSION