SAP Function Modules

CP_CC_S_COLLAPSE_ITM_BY_PATH SAP Function module







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

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


Pattern for FM CP_CC_S_COLLAPSE_ITM_BY_PATH - CP CC S COLLAPSE ITM BY PATH





CALL FUNCTION 'CP_CC_S_COLLAPSE_ITM_BY_PATH' "
  EXPORTING
    i_key_date_s =              " sy-datum
    i_application =             " tc04-capid
    i_material_root =           " mbm_class_data-matnr
    i_plant_root =              " mbm_class_data-werks
    i_usage_root =              " mbm_class_data-stlan
    i_alternative_root =        " mbm_class_data-stlal
    i_sales_order_root =        " kbm_class_data-vbeln
    i_sales_order_item_root =   " kbm_class_data-vbpos
*   i_required_quantity_root = 1  " itm_class_data-menge
    i_path =                    " stpf-kante_v
  IMPORTING
    e_path_parent =             " ctex_path_parent_id_tb_type
  EXCEPTIONS
    ROOT_IS_LOCKED_EXCLUSIVELY = 1  "
    .  "  CP_CC_S_COLLAPSE_ITM_BY_PATH

ABAP code example for Function Module CP_CC_S_COLLAPSE_ITM_BY_PATH





The ABAP code below is a full code listing to execute function module CP_CC_S_COLLAPSE_ITM_BY_PATH 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_e_path_parent  TYPE CTEX_PATH_PARENT_ID_TB_TYPE .

DATA(ld_i_key_date_s) = '20210129'.

SELECT single CAPID
FROM TC04
INTO @DATA(ld_i_application).


DATA(ld_i_material_root) = some text here

DATA(ld_i_plant_root) = some text here

DATA(ld_i_usage_root) = some text here

DATA(ld_i_alternative_root) = some text here

DATA(ld_i_sales_order_root) = some text here

DATA(ld_i_sales_order_item_root) = Check type of data required

DATA(ld_i_required_quantity_root) = Check type of data required

SELECT single KANTE_V
FROM STPF
INTO @DATA(ld_i_path).
. CALL FUNCTION 'CP_CC_S_COLLAPSE_ITM_BY_PATH' EXPORTING i_key_date_s = ld_i_key_date_s i_application = ld_i_application i_material_root = ld_i_material_root i_plant_root = ld_i_plant_root i_usage_root = ld_i_usage_root i_alternative_root = ld_i_alternative_root i_sales_order_root = ld_i_sales_order_root i_sales_order_item_root = ld_i_sales_order_item_root * i_required_quantity_root = ld_i_required_quantity_root i_path = ld_i_path IMPORTING e_path_parent = ld_e_path_parent EXCEPTIONS ROOT_IS_LOCKED_EXCLUSIVELY = 1 . " CP_CC_S_COLLAPSE_ITM_BY_PATH
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_e_path_parent  TYPE CTEX_PATH_PARENT_ID_TB_TYPE ,
ld_i_key_date_s  TYPE SY-DATUM ,
ld_i_application  TYPE TC04-CAPID ,
ld_i_material_root  TYPE MBM_CLASS_DATA-MATNR ,
ld_i_plant_root  TYPE MBM_CLASS_DATA-WERKS ,
ld_i_usage_root  TYPE MBM_CLASS_DATA-STLAN ,
ld_i_alternative_root  TYPE MBM_CLASS_DATA-STLAL ,
ld_i_sales_order_root  TYPE KBM_CLASS_DATA-VBELN ,
ld_i_sales_order_item_root  TYPE KBM_CLASS_DATA-VBPOS ,
ld_i_required_quantity_root  TYPE ITM_CLASS_DATA-MENGE ,
ld_i_path  TYPE STPF-KANTE_V .

ld_i_key_date_s = '20210129'.

SELECT single CAPID
FROM TC04
INTO ld_i_application.


ld_i_material_root = some text here

ld_i_plant_root = some text here

ld_i_usage_root = some text here

ld_i_alternative_root = some text here

ld_i_sales_order_root = some text here

ld_i_sales_order_item_root = Check type of data required

ld_i_required_quantity_root = Check type of data required

SELECT single KANTE_V
FROM STPF
INTO ld_i_path.

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