SAP Function Modules

PSC_CALCULATE_AVG_API SAP Function module - Calculate Average API







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

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


Pattern for FM PSC_CALCULATE_AVG_API - PSC CALCULATE AVG API





CALL FUNCTION 'PSC_CALCULATE_AVG_API' "Calculate Average API
  EXPORTING
    bukrs =                     " t8psc_lift-bukrs  Company Code
    psc_name =                  " t8psc_lift-psc_name  PSC Name
    product =                   " t8psc_lift-psc_product  PSC Product
    vname =                     " t8psc_lift-vname  Joint venture
    etype =                     " t8psc_lift-etype  Equity type
    psc_year =                  " t8psc_lift-psc_year  Fiscal year
  TABLES
    avg_api =                   " t8psc_avg_api  PSC Average API
  EXCEPTIONS
    NO_FLAT_API = 1             "               Flat API does not exists
    MISSING_PARAMETER = 2       "               Required input parameter missing
    NO_EXISTS = 3               "               PSC does not exists
    .  "  PSC_CALCULATE_AVG_API

ABAP code example for Function Module PSC_CALCULATE_AVG_API





The ABAP code below is a full code listing to execute function module PSC_CALCULATE_AVG_API 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:
it_avg_api  TYPE STANDARD TABLE OF T8PSC_AVG_API,"TABLES PARAM
wa_avg_api  LIKE LINE OF it_avg_api .


SELECT single BUKRS
FROM T8PSC_LIFT
INTO @DATA(ld_bukrs).


SELECT single PSC_NAME
FROM T8PSC_LIFT
INTO @DATA(ld_psc_name).


SELECT single PSC_PRODUCT
FROM T8PSC_LIFT
INTO @DATA(ld_product).


SELECT single VNAME
FROM T8PSC_LIFT
INTO @DATA(ld_vname).


SELECT single ETYPE
FROM T8PSC_LIFT
INTO @DATA(ld_etype).


SELECT single PSC_YEAR
FROM T8PSC_LIFT
INTO @DATA(ld_psc_year).


"populate fields of struture and append to itab
append wa_avg_api to it_avg_api. . CALL FUNCTION 'PSC_CALCULATE_AVG_API' EXPORTING bukrs = ld_bukrs psc_name = ld_psc_name product = ld_product vname = ld_vname etype = ld_etype psc_year = ld_psc_year TABLES avg_api = it_avg_api EXCEPTIONS NO_FLAT_API = 1 MISSING_PARAMETER = 2 NO_EXISTS = 3 . " PSC_CALCULATE_AVG_API
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 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_bukrs  TYPE T8PSC_LIFT-BUKRS ,
it_avg_api  TYPE STANDARD TABLE OF T8PSC_AVG_API ,
wa_avg_api  LIKE LINE OF it_avg_api,
ld_psc_name  TYPE T8PSC_LIFT-PSC_NAME ,
ld_product  TYPE T8PSC_LIFT-PSC_PRODUCT ,
ld_vname  TYPE T8PSC_LIFT-VNAME ,
ld_etype  TYPE T8PSC_LIFT-ETYPE ,
ld_psc_year  TYPE T8PSC_LIFT-PSC_YEAR .


SELECT single BUKRS
FROM T8PSC_LIFT
INTO ld_bukrs.


"populate fields of struture and append to itab
append wa_avg_api to it_avg_api.

SELECT single PSC_NAME
FROM T8PSC_LIFT
INTO ld_psc_name.


SELECT single PSC_PRODUCT
FROM T8PSC_LIFT
INTO ld_product.


SELECT single VNAME
FROM T8PSC_LIFT
INTO ld_vname.


SELECT single ETYPE
FROM T8PSC_LIFT
INTO ld_etype.


SELECT single PSC_YEAR
FROM T8PSC_LIFT
INTO ld_psc_year.

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