SAP Function Modules

CS_SO_COPY_MATERIAL SAP Function module







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

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


Pattern for FM CS_SO_COPY_MATERIAL - CS SO COPY MATERIAL





CALL FUNCTION 'CS_SO_COPY_MATERIAL' "
  EXPORTING
    i_stufe =                   " stpox-stufe
    i_wegxx =                   " stpox-wegxx
    i_matnr =                   " rc29l-matnr
    i_werks =                   " rc29l-werks
    i_capid =                   " rc29l-capid
*   i_vbeln =                   " vbap-vbeln
*   i_vbpos =                   " rc29l-vbpos
*   i_pspnr =                   " rc29l-pspnr
    i_datum =                   " sy-datum
    i_matnr_top =               " rc29l-matnr
*   i_werks_top =               " rc29l-werks
    i_cuobj =                   " vbap-cuobj
*   i_cus_mode =                " csdata-xfeld
*   i_prj_mode =                " csdata-xfeld
  EXCEPTIONS
    NO_COPY_OF_ROOT_MATERIAL = 1  "
    PROBLEMS_WITH_BOM_READ = 2  "
    STRUCTURE_HAS_CHANGED = 3   "
    PROBLEMS_WITH_MATERIAL_CREATE = 4  "
    PARENT_NOT_ORDER_BOM = 5    "
    PROBLEMS_WITH_BOM_WRITE = 6  "
    WRONG_INPUT = 7             "
    .  "  CS_SO_COPY_MATERIAL

ABAP code example for Function Module CS_SO_COPY_MATERIAL





The ABAP code below is a full code listing to execute function module CS_SO_COPY_MATERIAL 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_i_stufe) = Check type of data required

DATA(ld_i_wegxx) = Check type of data required

DATA(ld_i_matnr) = some text here

DATA(ld_i_werks) = some text here

DATA(ld_i_capid) = some text here

SELECT single VBELN
FROM VBAP
INTO @DATA(ld_i_vbeln).


DATA(ld_i_vbpos) = Check type of data required

DATA(ld_i_pspnr) = Check type of data required
DATA(ld_i_datum) = '20210129'.

DATA(ld_i_matnr_top) = some text here

DATA(ld_i_werks_top) = some text here

SELECT single CUOBJ
FROM VBAP
INTO @DATA(ld_i_cuobj).


DATA(ld_i_cus_mode) = some text here

DATA(ld_i_prj_mode) = some text here . CALL FUNCTION 'CS_SO_COPY_MATERIAL' EXPORTING i_stufe = ld_i_stufe i_wegxx = ld_i_wegxx i_matnr = ld_i_matnr i_werks = ld_i_werks i_capid = ld_i_capid * i_vbeln = ld_i_vbeln * i_vbpos = ld_i_vbpos * i_pspnr = ld_i_pspnr i_datum = ld_i_datum i_matnr_top = ld_i_matnr_top * i_werks_top = ld_i_werks_top i_cuobj = ld_i_cuobj * i_cus_mode = ld_i_cus_mode * i_prj_mode = ld_i_prj_mode EXCEPTIONS NO_COPY_OF_ROOT_MATERIAL = 1 PROBLEMS_WITH_BOM_READ = 2 STRUCTURE_HAS_CHANGED = 3 PROBLEMS_WITH_MATERIAL_CREATE = 4 PARENT_NOT_ORDER_BOM = 5 PROBLEMS_WITH_BOM_WRITE = 6 WRONG_INPUT = 7 . " CS_SO_COPY_MATERIAL
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 ELSEIF SY-SUBRC EQ 5. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 6. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 7. "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_stufe  TYPE STPOX-STUFE ,
ld_i_wegxx  TYPE STPOX-WEGXX ,
ld_i_matnr  TYPE RC29L-MATNR ,
ld_i_werks  TYPE RC29L-WERKS ,
ld_i_capid  TYPE RC29L-CAPID ,
ld_i_vbeln  TYPE VBAP-VBELN ,
ld_i_vbpos  TYPE RC29L-VBPOS ,
ld_i_pspnr  TYPE RC29L-PSPNR ,
ld_i_datum  TYPE SY-DATUM ,
ld_i_matnr_top  TYPE RC29L-MATNR ,
ld_i_werks_top  TYPE RC29L-WERKS ,
ld_i_cuobj  TYPE VBAP-CUOBJ ,
ld_i_cus_mode  TYPE CSDATA-XFELD ,
ld_i_prj_mode  TYPE CSDATA-XFELD .


ld_i_stufe = Check type of data required

ld_i_wegxx = Check type of data required

ld_i_matnr = some text here

ld_i_werks = some text here

ld_i_capid = some text here

SELECT single VBELN
FROM VBAP
INTO ld_i_vbeln.


ld_i_vbpos = Check type of data required

ld_i_pspnr = Check type of data required
ld_i_datum = '20210129'.

ld_i_matnr_top = some text here

ld_i_werks_top = some text here

SELECT single CUOBJ
FROM VBAP
INTO ld_i_cuobj.


ld_i_cus_mode = some text here

ld_i_prj_mode = some text here

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