SAP Function Modules

BBP_PDH_UNIT_CONVERSION SAP Function module - Konvertierung der Mengen für unterschiedliche Mengeneinheiten







BBP_PDH_UNIT_CONVERSION is a standard SAP function module available within R/3 SAP systems depending on your version and release level. Below is the pattern details for this FM showing its interface including any import and export parameters, exceptions etc as well as any documentation contributions (Comments) specific to the object.

See here to view full function module documentation and code listing, simply by entering the name BBP_PDH_UNIT_CONVERSION into the relevant SAP transaction such as SE37 or SE80.

Associated Function Group: BBP_PDH
Released Date: Not Released
Processing type: Normal fucntion module
Normal function module settings


Pattern for FM BBP_PDH_UNIT_CONVERSION - BBP PDH UNIT CONVERSION





CALL FUNCTION 'BBP_PDH_UNIT_CONVERSION' "Konvertierung der Mengen für unterschiedliche Mengeneinheiten
  EXPORTING
    iv_input =                  "               Menge
    iv_unit_in =                " t006-msehi    Maßeinheit
*   iv_numerator_in =           "
*   iv_denominator_in =         "
    iv_unit_out =               " t006-msehi    Mengeneinheiten des Produkts
*   iv_numerator_out =          "
*   iv_denominator_out =        "
*   iv_product_guid =           " comt_product_guid  Interner, eindeutiger Identifikator des Produkts
  IMPORTING
    ev_output =                 "               Ausgabewert
  EXCEPTIONS
    CONVERSION_NOT_FOUND = 1    "               Umrechnungsfaktor konnte nicht bestimmt werden
    DIVISION_BY_ZERO = 2        "               Division durch Null abgefangen
    INPUT_INVALID = 3           "               Eingabewert ist keine Zahl
    OUTPUT_INVALID = 4          "               der Ausgabeparameter OUTPUT ist keine Zahl
    OVERFLOW = 5                "               Feldüberlauf
    TYPE_INVALID = 6            "               ein Ausgabeparameter ist keine Zahl
    UNITS_MISSING = 7           "               keine Einheiten angegeben
    UNIT_IN_NOT_FOUND = 8       "               UNIT_IN ist nicht gepflegt
    UNIT_OUT_NOT_FOUND = 9      "               UNIT_OUT ist nicht gepflegt
    WRONG_CALL = 10             "               Falscher Aufruf
    BASE_UNIT_NOT_FOUND = 11    "               Basismengeneinheit wurde nicht gefunden
    .  "  BBP_PDH_UNIT_CONVERSION

ABAP code example for Function Module BBP_PDH_UNIT_CONVERSION





The ABAP code below is a full code listing to execute function module BBP_PDH_UNIT_CONVERSION including all data declarations. The code uses the latest in-line data DECLARATION SYNTAX but I have included an ABAP code snippet at the end to show how declarations would look using the original method of declaring data variables up front. This will allow you to compare and fully understand the new inline method. Please note some of the newer syntax such as the @DATA is not available until a later 4.70 service pack (SP8).

DATA:
ld_ev_output  TYPE STRING .

DATA(ld_iv_input) = 'some text here'.

SELECT single MSEHI
FROM T006
INTO @DATA(ld_iv_unit_in).

DATA(ld_iv_numerator_in) = 'some text here'.
DATA(ld_iv_denominator_in) = 'some text here'.

SELECT single MSEHI
FROM T006
INTO @DATA(ld_iv_unit_out).

DATA(ld_iv_numerator_out) = 'some text here'.
DATA(ld_iv_denominator_out) = 'some text here'.
DATA(ld_iv_product_guid) = 'Check type of data required'. . CALL FUNCTION 'BBP_PDH_UNIT_CONVERSION' EXPORTING iv_input = ld_iv_input iv_unit_in = ld_iv_unit_in * iv_numerator_in = ld_iv_numerator_in * iv_denominator_in = ld_iv_denominator_in iv_unit_out = ld_iv_unit_out * iv_numerator_out = ld_iv_numerator_out * iv_denominator_out = ld_iv_denominator_out * iv_product_guid = ld_iv_product_guid IMPORTING ev_output = ld_ev_output 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 WRONG_CALL = 10 BASE_UNIT_NOT_FOUND = 11 . " BBP_PDH_UNIT_CONVERSION
IF SY-SUBRC EQ 0. "All OK ELSEIF SY-SUBRC EQ 1. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 2. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 3. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 4. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 5. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 6. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 7. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 8. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 9. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 10. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 11. "Exception "Add code for exception here ENDIF.







ABAP code to compare 7.40 inline data declaration with original syntax

The below ABAP code uses the older none in-line data declarations. This allows you to see the coding differences/benefits of the later inline syntax. It may also be useful if you are using an older version of SAP as some of the newer syntax above, such as the @DATA is not available until 4.70 EHP 8.

DATA:
ld_ev_output  TYPE STRING ,
ld_iv_input  TYPE STRING ,
ld_iv_unit_in  TYPE T006-MSEHI ,
ld_iv_numerator_in  TYPE STRING ,
ld_iv_denominator_in  TYPE STRING ,
ld_iv_unit_out  TYPE T006-MSEHI ,
ld_iv_numerator_out  TYPE STRING ,
ld_iv_denominator_out  TYPE STRING ,
ld_iv_product_guid  TYPE COMT_PRODUCT_GUID .

ld_iv_input = 'some text here'.

SELECT single MSEHI
FROM T006
INTO ld_iv_unit_in.

ld_iv_numerator_in = 'some text here'.
ld_iv_denominator_in = 'some text here'.

SELECT single MSEHI
FROM T006
INTO ld_iv_unit_out.

ld_iv_numerator_out = 'some text here'.
ld_iv_denominator_out = 'some text here'.
ld_iv_product_guid = 'Check type of data required'.

Contribute (Add Comments)

Please help keep this info upto date and use the comments section below to add useful hints, tips and information specific to this SAP function. This will then be available for you and other users to easily find by simply searching on the object name BBP_PDH_UNIT_CONVERSION or its description.