Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

why we use this function module

Former Member
0 Kudos

Hi

why we use this function module 'LIST_TO_ASCI'.

regards,

sivakumar

1 ACCEPTED SOLUTION

Former Member
0 Kudos

hi,

using LIST_TO_ASCI you can get the list in TEXT format, but this will be with all the formatting you have done in your list, it wont be just field names and its values.

check this sample code.....

DATA BEGIN OF itab_list OCCURS 0.

INCLUDE STRUCTURE abaplist.

DATA END OF itab_list.

DATA: BEGIN OF vlist OCCURS 0,

filler1(01) TYPE c,

field1(06) TYPE c,

filler(08) TYPE c,

field2(10) TYPE c,

filler3(01) TYPE c,

field3(10) TYPE c,

filler4(01) TYPE c,

field4(3) TYPE c,

filler5(02) TYPE c,

field5(15) TYPE c,

filler6(02) TYPE c,

field6(30) TYPE c,

filler7(43) TYPE c,

field7(10) TYPE c,

END OF vlist.

SUBMIT zreport EXPORTING LIST TO MEMORY.

CALL FUNCTION 'LIST_FROM_MEMORY'

TABLES

listobject = itab_list

EXCEPTIONS

not_found = 4

OTHERS = 8.

CALL FUNCTION 'LIST_TO_ASCI'

EXPORTING

list_index = -1

TABLES

listasci = vlist

listobject = itab_list

EXCEPTIONS

empty_list = 1

list_index_invalid = 2

OTHERS = 3.

IF sy-subrc NE '0'.

WRITE:/ 'LIST_TO_ASCI error !! ', sy-subrc.

ENDIF.

~~Guduri

1 REPLY 1

Former Member
0 Kudos

hi,

using LIST_TO_ASCI you can get the list in TEXT format, but this will be with all the formatting you have done in your list, it wont be just field names and its values.

check this sample code.....

DATA BEGIN OF itab_list OCCURS 0.

INCLUDE STRUCTURE abaplist.

DATA END OF itab_list.

DATA: BEGIN OF vlist OCCURS 0,

filler1(01) TYPE c,

field1(06) TYPE c,

filler(08) TYPE c,

field2(10) TYPE c,

filler3(01) TYPE c,

field3(10) TYPE c,

filler4(01) TYPE c,

field4(3) TYPE c,

filler5(02) TYPE c,

field5(15) TYPE c,

filler6(02) TYPE c,

field6(30) TYPE c,

filler7(43) TYPE c,

field7(10) TYPE c,

END OF vlist.

SUBMIT zreport EXPORTING LIST TO MEMORY.

CALL FUNCTION 'LIST_FROM_MEMORY'

TABLES

listobject = itab_list

EXCEPTIONS

not_found = 4

OTHERS = 8.

CALL FUNCTION 'LIST_TO_ASCI'

EXPORTING

list_index = -1

TABLES

listasci = vlist

listobject = itab_list

EXCEPTIONS

empty_list = 1

list_index_invalid = 2

OTHERS = 3.

IF sy-subrc NE '0'.

WRITE:/ 'LIST_TO_ASCI error !! ', sy-subrc.

ENDIF.

~~Guduri