SAP Function Modules

CKMCD_MLCD_READ SAP Function module







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

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


Pattern for FM CKMCD_MLCD_READ - CKMCD MLCD READ





CALL FUNCTION 'CKMCD_MLCD_READ' "
  EXPORTING
    i_from_bdatj =              " ckmlpp-bdatj
    i_from_poper =              " ckmlpp-poper
*   i_to_bdatj =                " ckmlpp-bdatj
*   i_to_poper =                " ckmlpp-poper  Posting Period
*   i_untper =                  " ckmlpp-untper  Value Structure Type
*   i_run_id =                  " ckml_run_id   Number of Costing Runs for Material Ledger
*   i_no_buffer =               " boole_d
*   i_refresh_buffer =          " boole_d
*   i_online = 'X'              " boole_d
*   i_no_mlcd_create =          " boole_d
  TABLES
    it_kalnr =                  " ckmv0_matobj_tbl
    ot_mlcd =                   " mlcd
*   ot_mlcd_not_alloc =         " mlcd
  EXCEPTIONS
    DATA_ERROR = 1              "
    .  "  CKMCD_MLCD_READ

ABAP code example for Function Module CKMCD_MLCD_READ





The ABAP code below is a full code listing to execute function module CKMCD_MLCD_READ 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_it_kalnr  TYPE STANDARD TABLE OF CKMV0_MATOBJ_TBL,"TABLES PARAM
wa_it_kalnr  LIKE LINE OF it_it_kalnr ,
it_ot_mlcd  TYPE STANDARD TABLE OF MLCD,"TABLES PARAM
wa_ot_mlcd  LIKE LINE OF it_ot_mlcd ,
it_ot_mlcd_not_alloc  TYPE STANDARD TABLE OF MLCD,"TABLES PARAM
wa_ot_mlcd_not_alloc  LIKE LINE OF it_ot_mlcd_not_alloc .


SELECT single BDATJ
FROM CKMLPP
INTO @DATA(ld_i_from_bdatj).


SELECT single POPER
FROM CKMLPP
INTO @DATA(ld_i_from_poper).


SELECT single BDATJ
FROM CKMLPP
INTO @DATA(ld_i_to_bdatj).


SELECT single POPER
FROM CKMLPP
INTO @DATA(ld_i_to_poper).


SELECT single UNTPER
FROM CKMLPP
INTO @DATA(ld_i_untper).

DATA(ld_i_run_id) = 'Check type of data required'.
DATA(ld_i_no_buffer) = 'Check type of data required'.
DATA(ld_i_refresh_buffer) = 'Check type of data required'.
DATA(ld_i_online) = 'Check type of data required'.
DATA(ld_i_no_mlcd_create) = 'Check type of data required'.

"populate fields of struture and append to itab
append wa_it_kalnr to it_it_kalnr.

"populate fields of struture and append to itab
append wa_ot_mlcd to it_ot_mlcd.

"populate fields of struture and append to itab
append wa_ot_mlcd_not_alloc to it_ot_mlcd_not_alloc. . CALL FUNCTION 'CKMCD_MLCD_READ' EXPORTING i_from_bdatj = ld_i_from_bdatj i_from_poper = ld_i_from_poper * i_to_bdatj = ld_i_to_bdatj * i_to_poper = ld_i_to_poper * i_untper = ld_i_untper * i_run_id = ld_i_run_id * i_no_buffer = ld_i_no_buffer * i_refresh_buffer = ld_i_refresh_buffer * i_online = ld_i_online * i_no_mlcd_create = ld_i_no_mlcd_create TABLES it_kalnr = it_it_kalnr ot_mlcd = it_ot_mlcd * ot_mlcd_not_alloc = it_ot_mlcd_not_alloc EXCEPTIONS DATA_ERROR = 1 . " CKMCD_MLCD_READ
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_i_from_bdatj  TYPE CKMLPP-BDATJ ,
it_it_kalnr  TYPE STANDARD TABLE OF CKMV0_MATOBJ_TBL ,
wa_it_kalnr  LIKE LINE OF it_it_kalnr,
ld_i_from_poper  TYPE CKMLPP-POPER ,
it_ot_mlcd  TYPE STANDARD TABLE OF MLCD ,
wa_ot_mlcd  LIKE LINE OF it_ot_mlcd,
ld_i_to_bdatj  TYPE CKMLPP-BDATJ ,
it_ot_mlcd_not_alloc  TYPE STANDARD TABLE OF MLCD ,
wa_ot_mlcd_not_alloc  LIKE LINE OF it_ot_mlcd_not_alloc,
ld_i_to_poper  TYPE CKMLPP-POPER ,
ld_i_untper  TYPE CKMLPP-UNTPER ,
ld_i_run_id  TYPE CKML_RUN_ID ,
ld_i_no_buffer  TYPE BOOLE_D ,
ld_i_refresh_buffer  TYPE BOOLE_D ,
ld_i_online  TYPE BOOLE_D ,
ld_i_no_mlcd_create  TYPE BOOLE_D .


SELECT single BDATJ
FROM CKMLPP
INTO ld_i_from_bdatj.


"populate fields of struture and append to itab
append wa_it_kalnr to it_it_kalnr.

SELECT single POPER
FROM CKMLPP
INTO ld_i_from_poper.


"populate fields of struture and append to itab
append wa_ot_mlcd to it_ot_mlcd.

SELECT single BDATJ
FROM CKMLPP
INTO ld_i_to_bdatj.


"populate fields of struture and append to itab
append wa_ot_mlcd_not_alloc to it_ot_mlcd_not_alloc.

SELECT single POPER
FROM CKMLPP
INTO ld_i_to_poper.


SELECT single UNTPER
FROM CKMLPP
INTO ld_i_untper.

ld_i_run_id = 'Check type of data required'.
ld_i_no_buffer = 'Check type of data required'.
ld_i_refresh_buffer = 'Check type of data required'.
ld_i_online = 'Check type of data required'.
ld_i_no_mlcd_create = '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 CKMCD_MLCD_READ or its description.