SAP LIST_TO_ASCI Function Module for Convert a (Saved) List Object to ASCI
LIST_TO_ASCI is a standard list to asci SAP function module available within SAP R/3 or S/4 Hana systems, depending on your version and release level. It is used for Convert a (Saved) List Object to ASCI 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 list to asci FM, simply by entering the name LIST_TO_ASCI into the relevant SAP transaction such as SE37 or SE38.
Function Group: SLST
Program Name: SAPLSLST
Main Program: SAPLSLST
Appliation area: *
Release date: 28-Feb-2005
Mode(Normal, Remote etc): Normal Function Module
Update:

Function LIST_TO_ASCI 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 'LIST_TO_ASCI'"Convert a (Saved) List Object to ASCI.
EXPORTING
* LIST_INDEX = -1 "List level
* WITH_LINE_BREAK = ' ' "Use line breaks for overly long lines?
IMPORTING
LIST_STRING_ASCII = "Table Type for FB LIST_TO_ASCI
LIST_DYN_ASCII = "Table with Generic Width
TABLES
* LISTASCI = "Table for Receiving List (ASCI)
* LISTOBJECT = "Container for list object
EXCEPTIONS
EMPTY_LIST = 1 LIST_INDEX_INVALID = 2
IMPORTING Parameters details for LIST_TO_ASCI
LIST_INDEX - List level
Data type: SY-LSINDDefault: -1
Optional: Yes
Call by Reference: No ( called with pass by value option)
WITH_LINE_BREAK - Use line breaks for overly long lines?
Data type: CDefault: SPACE
Optional: Yes
Call by Reference: Yes
EXPORTING Parameters details for LIST_TO_ASCI
LIST_STRING_ASCII - Table Type for FB LIST_TO_ASCI
Data type: LIST_STRING_TABLEOptional: No
Call by Reference: Yes
LIST_DYN_ASCII - Table with Generic Width
Data type: DATAOptional: No
Call by Reference: Yes
TABLES Parameters details for LIST_TO_ASCI
LISTASCI - Table for Receiving List (ASCI)
Data type:Optional: Yes
Call by Reference: Yes
LISTOBJECT - Container for list object
Data type: ABAPLISTOptional: Yes
Call by Reference: No ( called with pass by value option)
EXCEPTIONS details
EMPTY_LIST - The list object transported is empty
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
LIST_INDEX_INVALID - Invalid list index (LIST_INDEX)
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
Copy and paste ABAP code example for LIST_TO_ASCI 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_listasci | TYPE STANDARD TABLE OF STRING, " | |||
| lv_empty_list | TYPE STRING, " | |||
| lv_list_index | TYPE SY-LSIND, " -1 | |||
| lv_list_string_ascii | TYPE LIST_STRING_TABLE, " | |||
| lt_listobject | TYPE STANDARD TABLE OF ABAPLIST, " | |||
| lv_list_dyn_ascii | TYPE DATA, " | |||
| lv_with_line_break | TYPE C, " SPACE | |||
| lv_list_index_invalid | TYPE C. " |
|   CALL FUNCTION 'LIST_TO_ASCI' "Convert a (Saved) List Object to ASCI |
| EXPORTING | ||
| LIST_INDEX | = lv_list_index | |
| WITH_LINE_BREAK | = lv_with_line_break | |
| IMPORTING | ||
| LIST_STRING_ASCII | = lv_list_string_ascii | |
| LIST_DYN_ASCII | = lv_list_dyn_ascii | |
| TABLES | ||
| LISTASCI | = lt_listasci | |
| LISTOBJECT | = lt_listobject | |
| EXCEPTIONS | ||
| EMPTY_LIST = 1 | ||
| LIST_INDEX_INVALID = 2 | ||
| . " LIST_TO_ASCI | ||
ABAP code using 7.40 inline data declarations to call FM LIST_TO_ASCI
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 LSIND FROM SY INTO @DATA(ld_list_index). | ||||
| DATA(ld_list_index) | = -1. | |||
| DATA(ld_with_line_break) | = ' '. | |||
Search for further information about these or an SAP related objects