SAP Function Modules

CREATE_ASSET SAP Function module







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

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


Pattern for FM CREATE_ASSET - CREATE ASSET





CALL FUNCTION 'CREATE_ASSET' "
  EXPORTING
    i_anla =                    " anla
*   i_anlv =                    " anlv
*   i_anlz =                    " anlz
*   i_ranln1 = SPACE            " ra02s-ranl1
*   i_ranln2 = SPACE            " ra02s-ranl2
*   i_rbukrs = SPACE            " ra02s-rbukr
*   i_subno = SPACE             " t020-koart
*   i_nassets = '001'           " ra02s-nassets  Number of similar assets
*   i_nassets_max = '000'       " ra02s-nassets
*   i_dark = SPACE              " t020-koart
*   i_bukrs_fix = 'X'           " t020-koart
*   i_nassets_fix = 'X'         " t020-koart
*   i_called_by_purchase_order = ' '  " t020-koart
* TABLES
*   t_assets =                  " raist06
  EXCEPTIONS
    MISSING_COMPANY_CODE = 1    "
    MISSING_ASSET_CLASS = 2     "
    MISSING_ASSET_MAINNUMBER = 3  "
    INTERNAL_ERROR = 4          "
    .  "  CREATE_ASSET

ABAP code example for Function Module CREATE_ASSET





The ABAP code below is a full code listing to execute function module CREATE_ASSET 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_t_assets  TYPE STANDARD TABLE OF RAIST06,"TABLES PARAM
wa_t_assets  LIKE LINE OF it_t_assets .

DATA(ld_i_anla) = 'Check type of data required'.
DATA(ld_i_anlv) = 'Check type of data required'.
DATA(ld_i_anlz) = 'Check type of data required'.

DATA(ld_i_ranln1) = some text here

DATA(ld_i_ranln2) = some text here

DATA(ld_i_rbukrs) = some text here

SELECT single KOART
FROM T020
INTO @DATA(ld_i_subno).


DATA(ld_i_nassets) = Check type of data required

DATA(ld_i_nassets_max) = Check type of data required

SELECT single KOART
FROM T020
INTO @DATA(ld_i_dark).


SELECT single KOART
FROM T020
INTO @DATA(ld_i_bukrs_fix).


SELECT single KOART
FROM T020
INTO @DATA(ld_i_nassets_fix).


SELECT single KOART
FROM T020
INTO @DATA(ld_i_called_by_purchase_order).


"populate fields of struture and append to itab
append wa_t_assets to it_t_assets. . CALL FUNCTION 'CREATE_ASSET' EXPORTING i_anla = ld_i_anla * i_anlv = ld_i_anlv * i_anlz = ld_i_anlz * i_ranln1 = ld_i_ranln1 * i_ranln2 = ld_i_ranln2 * i_rbukrs = ld_i_rbukrs * i_subno = ld_i_subno * i_nassets = ld_i_nassets * i_nassets_max = ld_i_nassets_max * i_dark = ld_i_dark * i_bukrs_fix = ld_i_bukrs_fix * i_nassets_fix = ld_i_nassets_fix * i_called_by_purchase_order = ld_i_called_by_purchase_order * TABLES * t_assets = it_t_assets EXCEPTIONS MISSING_COMPANY_CODE = 1 MISSING_ASSET_CLASS = 2 MISSING_ASSET_MAINNUMBER = 3 INTERNAL_ERROR = 4 . " CREATE_ASSET
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_anla  TYPE ANLA ,
it_t_assets  TYPE STANDARD TABLE OF RAIST06 ,
wa_t_assets  LIKE LINE OF it_t_assets,
ld_i_anlv  TYPE ANLV ,
ld_i_anlz  TYPE ANLZ ,
ld_i_ranln1  TYPE RA02S-RANL1 ,
ld_i_ranln2  TYPE RA02S-RANL2 ,
ld_i_rbukrs  TYPE RA02S-RBUKR ,
ld_i_subno  TYPE T020-KOART ,
ld_i_nassets  TYPE RA02S-NASSETS ,
ld_i_nassets_max  TYPE RA02S-NASSETS ,
ld_i_dark  TYPE T020-KOART ,
ld_i_bukrs_fix  TYPE T020-KOART ,
ld_i_nassets_fix  TYPE T020-KOART ,
ld_i_called_by_purchase_order  TYPE T020-KOART .

ld_i_anla = 'Check type of data required'.

"populate fields of struture and append to itab
append wa_t_assets to it_t_assets.
ld_i_anlv = 'Check type of data required'.
ld_i_anlz = 'Check type of data required'.

ld_i_ranln1 = some text here

ld_i_ranln2 = some text here

ld_i_rbukrs = some text here

SELECT single KOART
FROM T020
INTO ld_i_subno.


ld_i_nassets = Check type of data required

ld_i_nassets_max = Check type of data required

SELECT single KOART
FROM T020
INTO ld_i_dark.


SELECT single KOART
FROM T020
INTO ld_i_bukrs_fix.


SELECT single KOART
FROM T020
INTO ld_i_nassets_fix.


SELECT single KOART
FROM T020
INTO ld_i_called_by_purchase_order.

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