SAP Function Modules

K_SC_COSTS_COMPLETE SAP Function module







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

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


Pattern for FM K_SC_COSTS_COMPLETE - K SC COSTS COMPLETE





CALL FUNCTION 'K_SC_COSTS_COMPLETE' "
* EXPORTING
*   von_periode =               " cosp-perbl
*   bis_periode =               " cosp-perbl
*   i_tabname = SPACE           "
*   i_new_sc_vrgng = SPACE      "
*   i_kokrs = SPACE             " tka01-kokrs
*   i_ratmp = 1                 " tka07-ratmp   Plan price calculation: Determination method
  TABLES
    t_all =                     "
    t_cosel =                   " cosel         Selection Table
  EXCEPTIONS
    WRONGE_TABLE = 1            "
    MISSING_PARAMETER = 2       "
    .  "  K_SC_COSTS_COMPLETE

ABAP code example for Function Module K_SC_COSTS_COMPLETE





The ABAP code below is a full code listing to execute function module K_SC_COSTS_COMPLETE 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_all  TYPE STANDARD TABLE OF STRING,"TABLES PARAM
wa_t_all  LIKE LINE OF it_t_all ,
it_t_cosel  TYPE STANDARD TABLE OF COSEL,"TABLES PARAM
wa_t_cosel  LIKE LINE OF it_t_cosel .


SELECT single PERBL
FROM COSP
INTO @DATA(ld_von_periode).


SELECT single PERBL
FROM COSP
INTO @DATA(ld_bis_periode).

DATA(ld_i_tabname) = 'some text here'.
DATA(ld_i_new_sc_vrgng) = 'some text here'.

SELECT single KOKRS
FROM TKA01
INTO @DATA(ld_i_kokrs).


SELECT single RATMP
FROM TKA07
INTO @DATA(ld_i_ratmp).


"populate fields of struture and append to itab
append wa_t_all to it_t_all.

"populate fields of struture and append to itab
append wa_t_cosel to it_t_cosel. . CALL FUNCTION 'K_SC_COSTS_COMPLETE' * EXPORTING * von_periode = ld_von_periode * bis_periode = ld_bis_periode * i_tabname = ld_i_tabname * i_new_sc_vrgng = ld_i_new_sc_vrgng * i_kokrs = ld_i_kokrs * i_ratmp = ld_i_ratmp TABLES t_all = it_t_all t_cosel = it_t_cosel EXCEPTIONS WRONGE_TABLE = 1 MISSING_PARAMETER = 2 . " K_SC_COSTS_COMPLETE
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 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_von_periode  TYPE COSP-PERBL ,
it_t_all  TYPE STANDARD TABLE OF STRING ,
wa_t_all  LIKE LINE OF it_t_all,
ld_bis_periode  TYPE COSP-PERBL ,
it_t_cosel  TYPE STANDARD TABLE OF COSEL ,
wa_t_cosel  LIKE LINE OF it_t_cosel,
ld_i_tabname  TYPE STRING ,
ld_i_new_sc_vrgng  TYPE STRING ,
ld_i_kokrs  TYPE TKA01-KOKRS ,
ld_i_ratmp  TYPE TKA07-RATMP .


SELECT single PERBL
FROM COSP
INTO ld_von_periode.


"populate fields of struture and append to itab
append wa_t_all to it_t_all.

SELECT single PERBL
FROM COSP
INTO ld_bis_periode.


"populate fields of struture and append to itab
append wa_t_cosel to it_t_cosel.
ld_i_tabname = 'some text here'.
ld_i_new_sc_vrgng = 'some text here'.

SELECT single KOKRS
FROM TKA01
INTO ld_i_kokrs.


SELECT single RATMP
FROM TKA07
INTO ld_i_ratmp.

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