SAP Function Modules

POSTAL_CODE_CHECK SAP Function module - Check of postal code and region







POSTAL_CODE_CHECK 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 POSTAL_CODE_CHECK into the relevant SAP transaction such as SE37 or SE80.

Associated Function Group: SSRV2
Released Date: 14.04.1998
Processing type: Normal fucntion module
Normal function module settings


Pattern for FM POSTAL_CODE_CHECK - POSTAL CODE CHECK





CALL FUNCTION 'POSTAL_CODE_CHECK' "Check of postal code and region
  EXPORTING
    country =                   " kna1_bf-land1
    country =                   " kna1_bf-land1  Country Key
*   one_time_account = SPACE    " boole-boole   Indicator for one-time transactions (one-time account)
*   postal_code = SPACE         " kna1_bf-pstlz  Postal code
*   postal_code_po_box = SPACE  " kna1_bf-pstl2  P.O. Box postal code
*   po_box = SPACE              " kna1_bf-pfach
*   po_box = SPACE              " kna1_bf-pfach  PO Box
*   region = SPACE              " kna1_bf-regio
*   region = SPACE              " kna1_bf-regio  Region (federal state, stae, privince, county)
  IMPORTING
    postal_code =               " kna1_bf-pstlz  Postal code
    ev_postal_code =            " kna1_bf-pstlz  Formats Postal Code
    ev_postal_code_po_box =     " kna1_bf-pstl2  Formats Postal Code of P.O. Box
  EXCEPTIONS
    NOT_VALID = 1               "               Check not successful
    .  "  POSTAL_CODE_CHECK

ABAP code example for Function Module POSTAL_CODE_CHECK





The ABAP code below is a full code listing to execute function module POSTAL_CODE_CHECK 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_postal_code  TYPE KNA1_BF-PSTLZ ,
ld_ev_postal_code  TYPE KNA1_BF-PSTLZ ,
ld_ev_postal_code_po_box  TYPE KNA1_BF-PSTL2 .


DATA(ld_country) = some text here

DATA(ld_country) = some text here

DATA(ld_one_time_account) = some text here

DATA(ld_postal_code) = some text here

DATA(ld_postal_code_po_box) = some text here

DATA(ld_po_box) = some text here

DATA(ld_po_box) = some text here

DATA(ld_region) = some text here

DATA(ld_region) = some text here . CALL FUNCTION 'POSTAL_CODE_CHECK' EXPORTING country = ld_country country = ld_country * one_time_account = ld_one_time_account * postal_code = ld_postal_code * postal_code_po_box = ld_postal_code_po_box * po_box = ld_po_box * po_box = ld_po_box * region = ld_region * region = ld_region IMPORTING postal_code = ld_postal_code ev_postal_code = ld_ev_postal_code ev_postal_code_po_box = ld_ev_postal_code_po_box EXCEPTIONS NOT_VALID = 1 . " POSTAL_CODE_CHECK
IF SY-SUBRC EQ 0. "All OK ELSEIF SY-SUBRC EQ 1. "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_postal_code  TYPE KNA1_BF-PSTLZ ,
ld_country  TYPE KNA1_BF-LAND1 ,
ld_country  TYPE KNA1_BF-LAND1 ,
ld_ev_postal_code  TYPE KNA1_BF-PSTLZ ,
ld_one_time_account  TYPE BOOLE-BOOLE ,
ld_ev_postal_code_po_box  TYPE KNA1_BF-PSTL2 ,
ld_postal_code  TYPE KNA1_BF-PSTLZ ,
ld_postal_code_po_box  TYPE KNA1_BF-PSTL2 ,
ld_po_box  TYPE KNA1_BF-PFACH ,
ld_po_box  TYPE KNA1_BF-PFACH ,
ld_region  TYPE KNA1_BF-REGIO ,
ld_region  TYPE KNA1_BF-REGIO .


ld_country = some text here

ld_country = some text here

ld_one_time_account = some text here

ld_postal_code = some text here

ld_postal_code_po_box = some text here

ld_po_box = some text here

ld_po_box = some text here

ld_region = some text here

ld_region = some text here

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 POSTAL_CODE_CHECK or its description.