SAP BARC_ADD_GRID Function Module for Create a Time Fence (Grid)
BARC_ADD_GRID is a standard barc add grid SAP function module available within SAP R/3 or S/4 Hana systems, depending on your version and release level. It is used for Create a Time Fence (Grid) 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 barc add grid FM, simply by entering the name BARC_ADD_GRID into the relevant SAP transaction such as SE37 or SE38.
Function Group: BARC
Program Name: SAPLBARC
Main Program: SAPLBARC
Appliation area: S
Release date: 16-Apr-1997
Mode(Normal, Remote etc): Normal Function Module
Update:

Function BARC_ADD_GRID 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 'BARC_ADD_GRID'"Create a Time Fence (Grid).
EXPORTING
* CALENDAR_ID = "Calendar ID
* SECTION_ID = "Section ID
CHART_ID = "Chart ID
* COLOR_TYPE = '00' "Color
* GRID_TYPE = 'L' "Grid type
* UNIT = '3' "Time unit
* WINID = ' ' "Window ID
IMPORTING
ID = "Identification
EXCEPTIONS
INV_CALENDAR_ID = 1 INV_TYPE = 2 INV_UNIT = 3 INV_WINID = 4
IMPORTING Parameters details for BARC_ADD_GRID
CALENDAR_ID - Calendar ID
Data type: BCGRIDS-CALEND_IDOptional: Yes
Call by Reference: No ( called with pass by value option)
SECTION_ID - Section ID
Data type: BCGRIDS-SECTION_IDOptional: Yes
Call by Reference: No ( called with pass by value option)
CHART_ID - Chart ID
Data type: BCGRIDS-CHART_IDOptional: No
Call by Reference: No ( called with pass by value option)
COLOR_TYPE - Color
Data type: BCGRIDS-COLOR_TYPEDefault: '00'
Optional: Yes
Call by Reference: No ( called with pass by value option)
GRID_TYPE - Grid type
Data type: BCGRIDS-TYPEDefault: 'L'
Optional: Yes
Call by Reference: No ( called with pass by value option)
UNIT - Time unit
Data type: BCGRIDS-UNITDefault: '3'
Optional: Yes
Call by Reference: No ( called with pass by value option)
WINID - Window ID
Data type: NET_GRAPH-WINIDDefault: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
EXPORTING Parameters details for BARC_ADD_GRID
ID - Identification
Data type: BCGRIDS-IDOptional: No
Call by Reference: No ( called with pass by value option)
EXCEPTIONS details
INV_CALENDAR_ID - Missing calendar ID
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
INV_TYPE - Wrong grid type
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
INV_UNIT - Wrong time unit
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
INV_WINID - Incorrect window ID
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
Copy and paste ABAP code example for BARC_ADD_GRID 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_id | TYPE BCGRIDS-ID, " | |||
| lv_calendar_id | TYPE BCGRIDS-CALEND_ID, " | |||
| lv_inv_calendar_id | TYPE BCGRIDS, " | |||
| lv_inv_type | TYPE BCGRIDS, " | |||
| lv_section_id | TYPE BCGRIDS-SECTION_ID, " | |||
| lv_chart_id | TYPE BCGRIDS-CHART_ID, " | |||
| lv_inv_unit | TYPE BCGRIDS, " | |||
| lv_inv_winid | TYPE BCGRIDS, " | |||
| lv_color_type | TYPE BCGRIDS-COLOR_TYPE, " '00' | |||
| lv_grid_type | TYPE BCGRIDS-TYPE, " 'L' | |||
| lv_unit | TYPE BCGRIDS-UNIT, " '3' | |||
| lv_winid | TYPE NET_GRAPH-WINID. " SPACE |
|   CALL FUNCTION 'BARC_ADD_GRID' "Create a Time Fence (Grid) |
| EXPORTING | ||
| CALENDAR_ID | = lv_calendar_id | |
| SECTION_ID | = lv_section_id | |
| CHART_ID | = lv_chart_id | |
| COLOR_TYPE | = lv_color_type | |
| GRID_TYPE | = lv_grid_type | |
| UNIT | = lv_unit | |
| WINID | = lv_winid | |
| IMPORTING | ||
| ID | = lv_id | |
| EXCEPTIONS | ||
| INV_CALENDAR_ID = 1 | ||
| INV_TYPE = 2 | ||
| INV_UNIT = 3 | ||
| INV_WINID = 4 | ||
| . " BARC_ADD_GRID | ||
ABAP code using 7.40 inline data declarations to call FM BARC_ADD_GRID
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 ID FROM BCGRIDS INTO @DATA(ld_id). | ||||
| "SELECT single CALEND_ID FROM BCGRIDS INTO @DATA(ld_calendar_id). | ||||
| "SELECT single SECTION_ID FROM BCGRIDS INTO @DATA(ld_section_id). | ||||
| "SELECT single CHART_ID FROM BCGRIDS INTO @DATA(ld_chart_id). | ||||
| "SELECT single COLOR_TYPE FROM BCGRIDS INTO @DATA(ld_color_type). | ||||
| DATA(ld_color_type) | = '00'. | |||
| "SELECT single TYPE FROM BCGRIDS INTO @DATA(ld_grid_type). | ||||
| DATA(ld_grid_type) | = 'L'. | |||
| "SELECT single UNIT FROM BCGRIDS INTO @DATA(ld_unit). | ||||
| DATA(ld_unit) | = '3'. | |||
| "SELECT single WINID FROM NET_GRAPH INTO @DATA(ld_winid). | ||||
| DATA(ld_winid) | = ' '. | |||
Search for further information about these or an SAP related objects