SAP HR_BG_DOWNLOAD Function Module for Download file
HR_BG_DOWNLOAD is a standard hr bg download SAP function module available within SAP R/3 or S/4 Hana systems, depending on your version and release level. It is used for Download file 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 hr bg download FM, simply by entering the name HR_BG_DOWNLOAD into the relevant SAP transaction such as SE37 or SE38.
Function Group: 3BG2
Program Name: SAPL3BG2
Main Program: SAPL3BG2
Appliation area:
Release date: N/A
Mode(Normal, Remote etc): Normal Function Module
Update:

Function HR_BG_DOWNLOAD 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 'HR_BG_DOWNLOAD'"Download file.
EXPORTING
* BIN_FILESIZE = ' ' "File length for binary files
* WRITE_LF = 'X' "Insert CR/LF at End of Line in Case of Char Download
* WRITE_LF_AFTER_LAST_LINE = ABAP_TRUE "Writes LF also after last line
* TRUNC_TRAILING_BLANKS_EOL = 'X' "Remove trailing blanks in last column
* FILENAME = ' ' "Name of the file (default value)
* FILETYPE = ' ' "File type (ASCII, binary, ...)(default value)
* FILETYPE_NO_SHOW = ' ' "'x' prevents display of the file format
* NO_AUTH_CHECK = ' ' "
* FILE_DIALOG = 'X' "Show filesave dialog (only for 470)
* WRITE_FIELD_SEPARATOR = ' ' "
* TRUNC_TRAILING_BLANKS = ' ' "
* CODEPAGE = ' ' "Character Representation for Output
TABLES
DATA_TAB = "Transfer table
* FIELDNAMES = "Field names for files of the type 'DBF'
EXCEPTIONS
CANCLE = 1 ERROR = 2
IMPORTING Parameters details for HR_BG_DOWNLOAD
BIN_FILESIZE - File length for binary files
Data type:Default: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
WRITE_LF - Insert CR/LF at End of Line in Case of Char Download
Data type: CHAR01Default: 'X'
Optional: Yes
Call by Reference: No ( called with pass by value option)
WRITE_LF_AFTER_LAST_LINE - Writes LF also after last line
Data type: ABAP_BOOLDefault: ABAP_TRUE
Optional: Yes
Call by Reference: No ( called with pass by value option)
TRUNC_TRAILING_BLANKS_EOL - Remove trailing blanks in last column
Data type: CHAR01Default: 'X'
Optional: Yes
Call by Reference: No ( called with pass by value option)
FILENAME - Name of the file (default value)
Data type: RLGRAP-FILENAMEDefault: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
FILETYPE - File type (ASCII, binary, ...)(default value)
Data type: RLGRAP-FILETYPEDefault: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
FILETYPE_NO_SHOW - 'x' prevents display of the file format
Data type:Default: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
NO_AUTH_CHECK -
Data type: CDefault: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
FILE_DIALOG - Show filesave dialog (only for 470)
Data type: CDefault: 'X'
Optional: Yes
Call by Reference: No ( called with pass by value option)
WRITE_FIELD_SEPARATOR -
Data type: CDefault: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
TRUNC_TRAILING_BLANKS -
Data type: CDefault: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
CODEPAGE - Character Representation for Output
Data type: ABAP_ENCODINGDefault: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
TABLES Parameters details for HR_BG_DOWNLOAD
DATA_TAB - Transfer table
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
FIELDNAMES - Field names for files of the type 'DBF'
Data type:Optional: Yes
Call by Reference: No ( called with pass by value option)
EXCEPTIONS details
CANCLE - Cancle
Data type:Optional: No
Call by Reference: Yes
ERROR - Error
Data type:Optional: No
Call by Reference: Yes
Copy and paste ABAP code example for HR_BG_DOWNLOAD 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_cancle | TYPE STRING, " | |||
| lt_data_tab | TYPE STANDARD TABLE OF STRING, " | |||
| lv_bin_filesize | TYPE STRING, " SPACE | |||
| lv_write_lf | TYPE CHAR01, " 'X' | |||
| lv_write_lf_after_last_line | TYPE ABAP_BOOL, " ABAP_TRUE | |||
| lv_trunc_trailing_blanks_eol | TYPE CHAR01, " 'X' | |||
| lv_error | TYPE CHAR01, " | |||
| lv_filename | TYPE RLGRAP-FILENAME, " SPACE | |||
| lt_fieldnames | TYPE STANDARD TABLE OF RLGRAP, " | |||
| lv_filetype | TYPE RLGRAP-FILETYPE, " SPACE | |||
| lv_filetype_no_show | TYPE RLGRAP, " SPACE | |||
| lv_no_auth_check | TYPE C, " SPACE | |||
| lv_file_dialog | TYPE C, " 'X' | |||
| lv_write_field_separator | TYPE C, " SPACE | |||
| lv_trunc_trailing_blanks | TYPE C, " SPACE | |||
| lv_codepage | TYPE ABAP_ENCODING. " SPACE |
|   CALL FUNCTION 'HR_BG_DOWNLOAD' "Download file |
| EXPORTING | ||
| BIN_FILESIZE | = lv_bin_filesize | |
| WRITE_LF | = lv_write_lf | |
| WRITE_LF_AFTER_LAST_LINE | = lv_write_lf_after_last_line | |
| TRUNC_TRAILING_BLANKS_EOL | = lv_trunc_trailing_blanks_eol | |
| FILENAME | = lv_filename | |
| FILETYPE | = lv_filetype | |
| FILETYPE_NO_SHOW | = lv_filetype_no_show | |
| NO_AUTH_CHECK | = lv_no_auth_check | |
| FILE_DIALOG | = lv_file_dialog | |
| WRITE_FIELD_SEPARATOR | = lv_write_field_separator | |
| TRUNC_TRAILING_BLANKS | = lv_trunc_trailing_blanks | |
| CODEPAGE | = lv_codepage | |
| TABLES | ||
| DATA_TAB | = lt_data_tab | |
| FIELDNAMES | = lt_fieldnames | |
| EXCEPTIONS | ||
| CANCLE = 1 | ||
| ERROR = 2 | ||
| . " HR_BG_DOWNLOAD | ||
ABAP code using 7.40 inline data declarations to call FM HR_BG_DOWNLOAD
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.| DATA(ld_bin_filesize) | = ' '. | |||
| DATA(ld_write_lf) | = 'X'. | |||
| DATA(ld_write_lf_after_last_line) | = ABAP_TRUE. | |||
| DATA(ld_trunc_trailing_blanks_eol) | = 'X'. | |||
| "SELECT single FILENAME FROM RLGRAP INTO @DATA(ld_filename). | ||||
| DATA(ld_filename) | = ' '. | |||
| "SELECT single FILETYPE FROM RLGRAP INTO @DATA(ld_filetype). | ||||
| DATA(ld_filetype) | = ' '. | |||
| DATA(ld_filetype_no_show) | = ' '. | |||
| DATA(ld_no_auth_check) | = ' '. | |||
| DATA(ld_file_dialog) | = 'X'. | |||
| DATA(ld_write_field_separator) | = ' '. | |||
| DATA(ld_trunc_trailing_blanks) | = ' '. | |||
| DATA(ld_codepage) | = ' '. | |||
Search for further information about these or an SAP related objects