SAP CNFW_READ_MAIN Function Module for Main Read Function for Forecast Workbench
CNFW_READ_MAIN is a standard cnfw read main SAP function module available within SAP R/3 or S/4 Hana systems, depending on your version and release level. It is used for Main Read Function for Forecast Workbench 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 cnfw read main FM, simply by entering the name CNFW_READ_MAIN into the relevant SAP transaction such as SE37 or SE38.
Function Group: CNFW
Program Name: SAPLCNFW
Main Program: SAPLCNFW
Appliation area:
Release date: N/A
Mode(Normal, Remote etc): Normal Function Module
Update:
Function CNFW_READ_MAIN 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 'CNFW_READ_MAIN'"Main Read Function for Forecast Workbench.
EXPORTING
I_AUTOMATIC_VERSION = "Version
I_CURRENT_VERSION = "Version
I_PLAN_NW_VERSION = "Version
I_PLAN_WBS_VERSION = "Version
I_PAST_VERSION = "Version
I_KOKRS = "Controlling Area
I_YEAR = "Fiscal Year
* I_PERIOD = "Period block
TABLES
* T_S_OBJNR = "Object Numbers for Plan->Plan, Actual->Plan
* T_FORECAST_DIS = "Display Forecast Work Bench
* T_SELECTIONS = "ABAP: General Structure for PARAMETERS and SELECT-OPTIONS
* T_ELMPS = "Supplemental data for hierarchy nodes (LDB PSJ: Proj. Mgmt)
* T_PRPS = "WBS (Work Breakdown Structure) Element Master Data
* T_AFVGD = "Order: Dialog table for Table AFVG (order operation)
* T_PROJ = "Project definition
* T_RETURN = "Return Parameter
IMPORTING Parameters details for CNFW_READ_MAIN
I_AUTOMATIC_VERSION - Version
Data type: TKA09-VERSNOptional: No
Call by Reference: Yes
I_CURRENT_VERSION - Version
Data type: TKA09-VERSNOptional: No
Call by Reference: Yes
I_PLAN_NW_VERSION - Version
Data type: TKA09-VERSNOptional: No
Call by Reference: Yes
I_PLAN_WBS_VERSION - Version
Data type: TKA09-VERSNOptional: No
Call by Reference: Yes
I_PAST_VERSION - Version
Data type: TKA09-VERSNOptional: No
Call by Reference: Yes
I_KOKRS - Controlling Area
Data type: TKA01-KOKRSOptional: No
Call by Reference: Yes
I_YEAR - Fiscal Year
Data type: COSS-GJAHROptional: No
Call by Reference: Yes
I_PERIOD - Period block
Data type: COSS-PERBLOptional: Yes
Call by Reference: Yes
TABLES Parameters details for CNFW_READ_MAIN
T_S_OBJNR - Object Numbers for Plan->Plan, Actual->Plan
Data type: KPU3_OBJNROptional: Yes
Call by Reference: Yes
T_FORECAST_DIS - Display Forecast Work Bench
Data type: CNFW_DISPLAY_STOptional: Yes
Call by Reference: Yes
T_SELECTIONS - ABAP: General Structure for PARAMETERS and SELECT-OPTIONS
Data type: RSPARAMSOptional: Yes
Call by Reference: Yes
T_ELMPS - Supplemental data for hierarchy nodes (LDB PSJ: Proj. Mgmt)
Data type: ELM_PSOptional: Yes
Call by Reference: Yes
T_PRPS - WBS (Work Breakdown Structure) Element Master Data
Data type: PRPSOptional: Yes
Call by Reference: Yes
T_AFVGD - Order: Dialog table for Table AFVG (order operation)
Data type: AFVGDOptional: Yes
Call by Reference: Yes
T_PROJ - Project definition
Data type: PROJOptional: Yes
Call by Reference: Yes
T_RETURN - Return Parameter
Data type: BAPIRET2Optional: Yes
Call by Reference: Yes
Copy and paste ABAP code example for CNFW_READ_MAIN 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: | ||||
lt_t_s_objnr | TYPE STANDARD TABLE OF KPU3_OBJNR, " | |||
lv_i_automatic_version | TYPE TKA09-VERSN, " | |||
lt_t_forecast_dis | TYPE STANDARD TABLE OF CNFW_DISPLAY_ST, " | |||
lv_i_current_version | TYPE TKA09-VERSN, " | |||
lt_t_selections | TYPE STANDARD TABLE OF RSPARAMS, " | |||
lv_i_plan_nw_version | TYPE TKA09-VERSN, " | |||
lt_t_elmps | TYPE STANDARD TABLE OF ELM_PS, " | |||
lv_i_plan_wbs_version | TYPE TKA09-VERSN, " | |||
lt_t_prps | TYPE STANDARD TABLE OF PRPS, " | |||
lv_i_past_version | TYPE TKA09-VERSN, " | |||
lv_i_kokrs | TYPE TKA01-KOKRS, " | |||
lt_t_afvgd | TYPE STANDARD TABLE OF AFVGD, " | |||
lv_i_year | TYPE COSS-GJAHR, " | |||
lt_t_proj | TYPE STANDARD TABLE OF PROJ, " | |||
lv_i_period | TYPE COSS-PERBL, " | |||
lt_t_return | TYPE STANDARD TABLE OF BAPIRET2. " |
  CALL FUNCTION 'CNFW_READ_MAIN' "Main Read Function for Forecast Workbench |
EXPORTING | ||
I_AUTOMATIC_VERSION | = lv_i_automatic_version | |
I_CURRENT_VERSION | = lv_i_current_version | |
I_PLAN_NW_VERSION | = lv_i_plan_nw_version | |
I_PLAN_WBS_VERSION | = lv_i_plan_wbs_version | |
I_PAST_VERSION | = lv_i_past_version | |
I_KOKRS | = lv_i_kokrs | |
I_YEAR | = lv_i_year | |
I_PERIOD | = lv_i_period | |
TABLES | ||
T_S_OBJNR | = lt_t_s_objnr | |
T_FORECAST_DIS | = lt_t_forecast_dis | |
T_SELECTIONS | = lt_t_selections | |
T_ELMPS | = lt_t_elmps | |
T_PRPS | = lt_t_prps | |
T_AFVGD | = lt_t_afvgd | |
T_PROJ | = lt_t_proj | |
T_RETURN | = lt_t_return | |
. " CNFW_READ_MAIN |
ABAP code using 7.40 inline data declarations to call FM CNFW_READ_MAIN
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 VERSN FROM TKA09 INTO @DATA(ld_i_automatic_version). | ||||
"SELECT single VERSN FROM TKA09 INTO @DATA(ld_i_current_version). | ||||
"SELECT single VERSN FROM TKA09 INTO @DATA(ld_i_plan_nw_version). | ||||
"SELECT single VERSN FROM TKA09 INTO @DATA(ld_i_plan_wbs_version). | ||||
"SELECT single VERSN FROM TKA09 INTO @DATA(ld_i_past_version). | ||||
"SELECT single KOKRS FROM TKA01 INTO @DATA(ld_i_kokrs). | ||||
"SELECT single GJAHR FROM COSS INTO @DATA(ld_i_year). | ||||
"SELECT single PERBL FROM COSS INTO @DATA(ld_i_period). | ||||
Search for further information about these or an SAP related objects