SAP EHPRC_CP_CD01_EHS_CD_CREATE Function Module for CP: Create EHS change docs by modifications
EHPRC_CP_CD01_EHS_CD_CREATE is a standard ehprc cp cd01 ehs cd create SAP function module available within SAP R/3 or S/4 Hana systems, depending on your version and release level. It is used for CP: Create EHS change docs by modifications processing and below is the pattern details for this FM, showing its interface including any import and export parameters, exceptions etc. there is also a full "cut and paste" ABAP pattern code example, along with implementation ABAP coding, documentation and contribution comments specific to this or related objects.
See here to view full function module documentation and code listing for ehprc cp cd01 ehs cd create FM, simply by entering the name EHPRC_CP_CD01_EHS_CD_CREATE into the relevant SAP transaction such as SE37 or SE38.
Function Group: EHPRC_CP_CD01
Program Name: SAPLEHPRC_CP_CD01
Main Program: SAPLEHPRC_CP_CD01
Appliation area:
Release date: N/A
Mode(Normal, Remote etc): Normal Function Module
Update:

Function EHPRC_CP_CD01_EHS_CD_CREATE pattern details
In-order to call this FM within your sap programs, simply using the below ABAP pattern details to trigger the function call...or see the full ABAP code listing at the end of this article. You can simply cut and paste this code into your ABAP progrom as it is, including variable declarations.CALL FUNCTION 'EHPRC_CP_CD01_EHS_CD_CREATE'"CP: Create EHS change docs by modifications.
EXPORTING
* I_TABNAME = "Table name
* I_MASTERTAB = "Name of Master Table
* I_MASTERRECN = "Reference to Master Table
* I_SORT = "Sort Sequence
* I_SUBID = "Sequential Number of Data Record
* IT_OLD_VALUES = "Table containing old values: required fields: mandt, recn, actn
* IT_NEW_VALUES = "Table containing new values: fields: mandt, recn, actn
* IO_NODE = "CP: Logger-Node for the application log.
* I_FIELDNAME = "Field name
* I_CHNGIND = "Change type (U, I, E, D)
* I_USERNAME = "User name
* I_VAL_OLD = "Field Contents of Changed Field
* I_VAL_NEW = "Field Contents of Changed Field
* I_ESTCAT = "Value Assignment Type
* I_ATNAM = "Characteristic name
* I_REFERENCE = "Specification
IMPORTING
ET_CHANGE_DOCS = "CP: Table type of est_change_docs
EXCEPTIONS
NO_TABLENAME = 1 NO_SUBID = 2
IMPORTING Parameters details for EHPRC_CP_CD01_EHS_CD_CREATE
I_TABNAME - Table name
Data type: TABNAMEOptional: Yes
Call by Reference: Yes
I_MASTERTAB - Name of Master Table
Data type: ESENAMEMSTOptional: Yes
Call by Reference: Yes
I_MASTERRECN - Reference to Master Table
Data type: ESERECNMSTOptional: Yes
Call by Reference: Yes
I_SORT - Sort Sequence
Data type: ESEORDOptional: Yes
Call by Reference: Yes
I_SUBID - Sequential Number of Data Record
Data type: ESESUBIDOptional: Yes
Call by Reference: Yes
IT_OLD_VALUES - Table containing old values: required fields: mandt, recn, actn
Data type: STANDARD TABLEOptional: Yes
Call by Reference: Yes
IT_NEW_VALUES - Table containing new values: fields: mandt, recn, actn
Data type: STANDARD TABLEOptional: Yes
Call by Reference: Yes
IO_NODE - CP: Logger-Node for the application log.
Data type: CL_EHPRC_APPLLOG_NODEOptional: Yes
Call by Reference: Yes
I_FIELDNAME - Field name
Data type: FIELDNAMEOptional: Yes
Call by Reference: Yes
I_CHNGIND - Change type (U, I, E, D)
Data type: CDCHNGINDOptional: Yes
Call by Reference: Yes
I_USERNAME - User name
Data type: USERNAMEOptional: Yes
Call by Reference: Yes
I_VAL_OLD - Field Contents of Changed Field
Data type: ESECDVALUEOptional: Yes
Call by Reference: Yes
I_VAL_NEW - Field Contents of Changed Field
Data type: ESECDVALUEOptional: Yes
Call by Reference: Yes
I_ESTCAT - Value Assignment Type
Data type: ESEESTCATOptional: Yes
Call by Reference: Yes
I_ATNAM - Characteristic name
Data type: ATNAMOptional: Yes
Call by Reference: Yes
I_REFERENCE - Specification
Data type: ESESUBIDOptional: Yes
Call by Reference: Yes
EXPORTING Parameters details for EHPRC_CP_CD01_EHS_CD_CREATE
ET_CHANGE_DOCS - CP: Table type of est_change_docs
Data type: EHPRCT_EST_CHANGE_DOCSOptional: No
Call by Reference: Yes
EXCEPTIONS details
NO_TABLENAME - No table name given
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
NO_SUBID - No subid given
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
Copy and paste ABAP code example for EHPRC_CP_CD01_EHS_CD_CREATE Function Module
The ABAP code below is a full code listing to execute function module POPUP_TO_CONFIRM including all data declarations. The code uses the original data declarations rather than 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 newer method of declaring data variables on the fly. 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), which i why i have stuck to the origianl for this example.| DATA: | ||||
| lv_i_tabname | TYPE TABNAME, " | |||
| lv_no_tablename | TYPE TABNAME, " | |||
| lv_et_change_docs | TYPE EHPRCT_EST_CHANGE_DOCS, " | |||
| lv_i_mastertab | TYPE ESENAMEMST, " | |||
| lv_i_masterrecn | TYPE ESERECNMST, " | |||
| lv_i_sort | TYPE ESEORD, " | |||
| lv_i_subid | TYPE ESESUBID, " | |||
| lv_it_old_values | TYPE STANDARD TABLE, " | |||
| lv_it_new_values | TYPE STANDARD TABLE, " | |||
| lv_io_node | TYPE CL_EHPRC_APPLLOG_NODE, " | |||
| lv_no_subid | TYPE CL_EHPRC_APPLLOG_NODE, " | |||
| lv_i_fieldname | TYPE FIELDNAME, " | |||
| lv_i_chngind | TYPE CDCHNGIND, " | |||
| lv_i_username | TYPE USERNAME, " | |||
| lv_i_val_old | TYPE ESECDVALUE, " | |||
| lv_i_val_new | TYPE ESECDVALUE, " | |||
| lv_i_estcat | TYPE ESEESTCAT, " | |||
| lv_i_atnam | TYPE ATNAM, " | |||
| lv_i_reference | TYPE ESESUBID. " |
|   CALL FUNCTION 'EHPRC_CP_CD01_EHS_CD_CREATE' "CP: Create EHS change docs by modifications |
| EXPORTING | ||
| I_TABNAME | = lv_i_tabname | |
| I_MASTERTAB | = lv_i_mastertab | |
| I_MASTERRECN | = lv_i_masterrecn | |
| I_SORT | = lv_i_sort | |
| I_SUBID | = lv_i_subid | |
| IT_OLD_VALUES | = lv_it_old_values | |
| IT_NEW_VALUES | = lv_it_new_values | |
| IO_NODE | = lv_io_node | |
| I_FIELDNAME | = lv_i_fieldname | |
| I_CHNGIND | = lv_i_chngind | |
| I_USERNAME | = lv_i_username | |
| I_VAL_OLD | = lv_i_val_old | |
| I_VAL_NEW | = lv_i_val_new | |
| I_ESTCAT | = lv_i_estcat | |
| I_ATNAM | = lv_i_atnam | |
| I_REFERENCE | = lv_i_reference | |
| IMPORTING | ||
| ET_CHANGE_DOCS | = lv_et_change_docs | |
| EXCEPTIONS | ||
| NO_TABLENAME = 1 | ||
| NO_SUBID = 2 | ||
| . " EHPRC_CP_CD01_EHS_CD_CREATE | ||
ABAP code using 7.40 inline data declarations to call FM EHPRC_CP_CD01_EHS_CD_CREATE
The below ABAP code uses the newer in-line data declarations. This allows you to see the coding differences/benefits of the later inline syntax. Please note some of the newer syntax below, such as the @DATA is not available until 4.70 EHP 8.Search for further information about these or an SAP related objects