SAP Function Modules

J_2GCUSTOMER_CHECK_AFM SAP Function module - Greek customer tax number (AFM) check (for SAPMF02D)







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

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


Pattern for FM J_2GCUSTOMER_CHECK_AFM - J 2GCUSTOMER CHECK AFM





CALL FUNCTION 'J_2GCUSTOMER_CHECK_AFM' "Greek customer tax number (AFM) check (for SAPMF02D)
  EXPORTING
    i_kna1 =                    " kna1          General Data in Customer Master
*   i_check_only_new_afms = 'X'  "              Perform the checks only if new AFM has been entered
*   i_duplicate_afm_action = '2'  "             What to do if customer w/ same AFM exist ('1'=Allow, '2'=Ask, '3'=Stop)
*   i_default_option = '2'      "               Default option if user is asked what to do ('1' Save / '2' Cancel)
  EXCEPTIONS
    BLANK_AFM = 1               "               AFM not specified
    INVALID_AFM = 2             "               AFM is not valid
    INVALID_VAT = 3             "               VAT Registration Nr is not valid (see documentation)
    DUPLICATE_AFM = 4           "               Other customer accounts use the same AFM
    .  "  J_2GCUSTOMER_CHECK_AFM

ABAP code example for Function Module J_2GCUSTOMER_CHECK_AFM





The ABAP code below is a full code listing to execute function module J_2GCUSTOMER_CHECK_AFM 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_i_kna1) = 'Check type of data required'.
DATA(ld_i_check_only_new_afms) = 'some text here'.
DATA(ld_i_duplicate_afm_action) = 'some text here'.
DATA(ld_i_default_option) = 'some text here'. . CALL FUNCTION 'J_2GCUSTOMER_CHECK_AFM' EXPORTING i_kna1 = ld_i_kna1 * i_check_only_new_afms = ld_i_check_only_new_afms * i_duplicate_afm_action = ld_i_duplicate_afm_action * i_default_option = ld_i_default_option EXCEPTIONS BLANK_AFM = 1 INVALID_AFM = 2 INVALID_VAT = 3 DUPLICATE_AFM = 4 . " J_2GCUSTOMER_CHECK_AFM
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 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_i_kna1  TYPE KNA1 ,
ld_i_check_only_new_afms  TYPE STRING ,
ld_i_duplicate_afm_action  TYPE STRING ,
ld_i_default_option  TYPE STRING .

ld_i_kna1 = 'Check type of data required'.
ld_i_check_only_new_afms = 'some text here'.
ld_i_duplicate_afm_action = 'some text here'.
ld_i_default_option = 'some text here'.

SAP Documentation for FM J_2GCUSTOMER_CHECK_AFM


Cheks the customer's tax number, the so called AFM (field I_KNA1-STCD2). The function is suitable to be used in SAP's customer master enhancement ...See here for full SAP fm documentation

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