SAP CMAC_REAL_DOC_ACCT_INIT Function Module for Account initialization for real document
CMAC_REAL_DOC_ACCT_INIT is a standard cmac real doc acct init SAP function module available within SAP R/3 or S/4 Hana systems, depending on your version and release level. It is used for Account initialization for real document 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 cmac real doc acct init FM, simply by entering the name CMAC_REAL_DOC_ACCT_INIT into the relevant SAP transaction such as SE37 or SE38.
Function Group: CMACFEE7
Program Name: SAPLCMACFEE7
Main Program: SAPLCMACFEE7
Appliation area:
Release date: N/A
Mode(Normal, Remote etc): Normal Function Module
Update:

Function CMAC_REAL_DOC_ACCT_INIT 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 'CMAC_REAL_DOC_ACCT_INIT'"Account initialization for real document.
EXPORTING
IS_STINFO = "Student Information
IS_FEE_CTRL = "Fee Calculation Control
* IV_SRC_KEY = 'P1' "Document source key
IMPORTING
ET_FICADOC = "
ET_CALC_FEES = "Fee with due dates
CHANGING
CV_INDEX = "temp: Index number
TABLES
IT_FEE_TYPE = "Fee Type
ET_HEADER = "Header Data In Open Item Accounting Document
ET_BP_ITEMS = "Business partner items in contract account document
ET_GL_ITEMS = "G/L Account Items in Open Item Account Document
ET_CL_ITEMS = "Extended FI-CA Document Items - Clearing Items
CT_LOG_TAB = "Return parameter for error message.
EXCEPTIONS
CURR_CONVERT_ERROR = 1 DATA_INIT_ERROR = 2 DATA_CHECK_ERROR = 3 DUEDATE_DERIVE_ERROR = 4
IMPORTING Parameters details for CMAC_REAL_DOC_ACCT_INIT
IS_STINFO - Student Information
Data type: CMAC_STOptional: No
Call by Reference: Yes
IS_FEE_CTRL - Fee Calculation Control
Data type: CMAC_FEE_CONTROLOptional: No
Call by Reference: Yes
IV_SRC_KEY - Document source key
Data type: FKKKO-HERKFDefault: 'P1'
Optional: No
Call by Reference: Yes
EXPORTING Parameters details for CMAC_REAL_DOC_ACCT_INIT
ET_FICADOC -
Data type: CMAC_FEEFICA_TOptional: No
Call by Reference: Yes
ET_CALC_FEES - Fee with due dates
Data type: CMAC_T_FEE_DUEDATESOptional: No
Call by Reference: Yes
CHANGING Parameters details for CMAC_REAL_DOC_ACCT_INIT
CV_INDEX - temp: Index number
Data type: CMAC_INDEX_NUMBEROptional: No
Call by Reference: Yes
TABLES Parameters details for CMAC_REAL_DOC_ACCT_INIT
IT_FEE_TYPE - Fee Type
Data type: CMAC_T_FEE_TYPEOptional: No
Call by Reference: No ( called with pass by value option)
ET_HEADER - Header Data In Open Item Accounting Document
Data type: CMAC_FKKKOOptional: No
Call by Reference: No ( called with pass by value option)
ET_BP_ITEMS - Business partner items in contract account document
Data type: CMAC_FKKOPOptional: No
Call by Reference: No ( called with pass by value option)
ET_GL_ITEMS - G/L Account Items in Open Item Account Document
Data type: CMAC_FKKOPKOptional: No
Call by Reference: No ( called with pass by value option)
ET_CL_ITEMS - Extended FI-CA Document Items - Clearing Items
Data type: CMAC_FKKCLOptional: No
Call by Reference: Yes
CT_LOG_TAB - Return parameter for error message.
Data type: PIQ_ERROR_STRUCTUREOptional: No
Call by Reference: No ( called with pass by value option)
EXCEPTIONS details
CURR_CONVERT_ERROR - Error in converting currency
Data type:Optional: No
Call by Reference: Yes
DATA_INIT_ERROR - Error in data initialization
Data type:Optional: No
Call by Reference: Yes
DATA_CHECK_ERROR - Error in checking data
Data type:Optional: No
Call by Reference: Yes
DUEDATE_DERIVE_ERROR - Error in deriving due dates
Data type:Optional: No
Call by Reference: Yes
Copy and paste ABAP code example for CMAC_REAL_DOC_ACCT_INIT 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_cv_index | TYPE CMAC_INDEX_NUMBER, " | |||
| lv_is_stinfo | TYPE CMAC_ST, " | |||
| lv_et_ficadoc | TYPE CMAC_FEEFICA_T, " | |||
| lt_it_fee_type | TYPE STANDARD TABLE OF CMAC_T_FEE_TYPE, " | |||
| lv_curr_convert_error | TYPE CMAC_T_FEE_TYPE, " | |||
| lt_et_header | TYPE STANDARD TABLE OF CMAC_FKKKO, " | |||
| lv_is_fee_ctrl | TYPE CMAC_FEE_CONTROL, " | |||
| lv_et_calc_fees | TYPE CMAC_T_FEE_DUEDATES, " | |||
| lv_data_init_error | TYPE CMAC_T_FEE_DUEDATES, " | |||
| lv_iv_src_key | TYPE FKKKO-HERKF, " 'P1' | |||
| lt_et_bp_items | TYPE STANDARD TABLE OF CMAC_FKKOP, " | |||
| lv_data_check_error | TYPE CMAC_FKKOP, " | |||
| lt_et_gl_items | TYPE STANDARD TABLE OF CMAC_FKKOPK, " | |||
| lv_duedate_derive_error | TYPE CMAC_FKKOPK, " | |||
| lt_et_cl_items | TYPE STANDARD TABLE OF CMAC_FKKCL, " | |||
| lt_ct_log_tab | TYPE STANDARD TABLE OF PIQ_ERROR_STRUCTURE. " |
|   CALL FUNCTION 'CMAC_REAL_DOC_ACCT_INIT' "Account initialization for real document |
| EXPORTING | ||
| IS_STINFO | = lv_is_stinfo | |
| IS_FEE_CTRL | = lv_is_fee_ctrl | |
| IV_SRC_KEY | = lv_iv_src_key | |
| IMPORTING | ||
| ET_FICADOC | = lv_et_ficadoc | |
| ET_CALC_FEES | = lv_et_calc_fees | |
| CHANGING | ||
| CV_INDEX | = lv_cv_index | |
| TABLES | ||
| IT_FEE_TYPE | = lt_it_fee_type | |
| ET_HEADER | = lt_et_header | |
| ET_BP_ITEMS | = lt_et_bp_items | |
| ET_GL_ITEMS | = lt_et_gl_items | |
| ET_CL_ITEMS | = lt_et_cl_items | |
| CT_LOG_TAB | = lt_ct_log_tab | |
| EXCEPTIONS | ||
| CURR_CONVERT_ERROR = 1 | ||
| DATA_INIT_ERROR = 2 | ||
| DATA_CHECK_ERROR = 3 | ||
| DUEDATE_DERIVE_ERROR = 4 | ||
| . " CMAC_REAL_DOC_ACCT_INIT | ||
ABAP code using 7.40 inline data declarations to call FM CMAC_REAL_DOC_ACCT_INIT
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.| "SELECT single HERKF FROM FKKKO INTO @DATA(ld_iv_src_key). | ||||
| DATA(ld_iv_src_key) | = 'P1'. | |||
Search for further information about these or an SAP related objects