09-30-2008 2:14 PM
Hi Experts,
Can you please help me out I'm retrieving an ABAP Report List which i submitted to memory, I'm using the function module LIST_FROM_MEMORY to retrieve the list from memory and storing it in an internal table. The problem is i'm struggling to display the List using an ALV coz the internal table contains raw data. Your help wil be much appreciated.
09-30-2008 2:34 PM
CALL FUNCTION 'LIST_FROM_MEMORY'
TABLES
listobject = t_list
EXCEPTIONS
not_found = 1.
REFRESH t_ascii.
CALL FUNCTION 'LIST_TO_ASCI'
TABLES
listasci = t_ascii " list converted to ASCII
listobject = t_list
EXCEPTIONS
empty_list = 1
list_index_invalid = 2
OTHERS = 3.
Regards
Anbu B
09-30-2008 2:34 PM
CALL FUNCTION 'LIST_FROM_MEMORY'
TABLES
listobject = t_list
EXCEPTIONS
not_found = 1.
REFRESH t_ascii.
CALL FUNCTION 'LIST_TO_ASCI'
TABLES
listasci = t_ascii " list converted to ASCII
listobject = t_list
EXCEPTIONS
empty_list = 1
list_index_invalid = 2
OTHERS = 3.
Regards
Anbu B
09-30-2008 3:05 PM
My ASCII internal table is empty. Below I have included a code sample of what I want to do.
*----
Type-pools slis.
DATA: MTAB_REPORT_LIST LIKE ABAPLIST OCCURS 0 WITH HEADER LINE.
DATA: BEGIN OF MTAB_REPORT_ASCII OCCURS 0,
LINE(255) TYPE C,
END OF MTAB_REPORT_ASCII.
START-OF-SELECTION.
*-- Submit a report. This one is the chart of accounts
SUBMIT ZPRINTREPORT
EXPORTING LIST TO MEMORY " Save list in memory
AND RETURN. " Return control to this program
END-OF-SELECTION.
*-- Get the list from memory
CALL FUNCTION 'LIST_FROM_MEMORY'
TABLES
LISTOBJECT = MTAB_REPORT_LIST
EXCEPTIONS
NOT_FOUND = 1
OTHERS = 2.
if sy-subrc <> 0.
write / 'unable 2 retrieve list from memory'.
else.
"REFRESH MTAB_REPORT_ASCII.
CALL FUNCTION 'LIST_TO_ASCI'
TABLES
listasci = MTAB_REPORT_ASCII " list converted to ASCII
listobject = MTAB_REPORT_LIST
EXCEPTIONS
empty_list = 1
list_index_invalid = 2
OTHERS = 3.
if sy-subrc = 1.
write 'list ASCII list empty'.
else.
WRITE: MTAB_REPORT_ASCII, ' ff'.
" perform build_alv tables MTAB_REPORT_LIST.
endif.
endif.
"CALL FUNCTION 'WRITE_LIST'
" TABLES
" LISTOBJECT = MTAB_REPORT_LIST
" EXCEPTIONS
" EMPTY_LIST = 1
" OTHERS = 2.
FORM build_alv tables MTAB_REPORT_ASCII.
ALV required data objects.
"DATA: w_title TYPE lvc_title,
" w_comm TYPE slis_formname,
" w_status TYPE slis_formname,
" x_layout TYPE slis_layout_alv,
" t_event TYPE slis_t_event,
" t_fieldcat TYPE slis_t_fieldcat_alv,
" t_sort TYPE slis_t_sortinfo_alv.
data int_fcat type SLIS_T_FIELDCAT_ALV.
Layout
x_layout-zebra = 'X'.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME = sy-repid
I_INTERNAL_TABNAME = 'MTAB_REPORT_ASCII'
I_INCLNAME = sy-repid
CHANGING
CT_FIELDCAT = int_fcat
EXCEPTIONS
INCONSISTENT_INTERFACE = 1
PROGRAM_ERROR = 2
OTHERS = 3.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = sy-repid
IT_FIELDCAT = int_fcat
I_SAVE = 'A'
TABLES
T_OUTTAB = MTAB_REPORT_ASCII
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDFORM.
09-30-2008 3:08 PM
09-30-2008 3:10 PM
09-30-2008 3:25 PM
Do you have any values in Listobject .check it once.
CALL FUNCTION 'LIST_TO_ASCI'
TABLES
listasci = MTAB_REPORT_ASCII " list converted to ASCII
listobject = MTAB_REPORT_LIST
EXCEPTIONS
empty_list = 1
list_index_invalid = 2
OTHERS = 3.
and this is wrong.. Ascii table consists of the complete row information, you have to break the info into fields and then display. you have to define the internal table with the fields what ever the submit report showing in the output. from the ascii table break the data into table and the same table you have to mention in the fieldcatalog merge , the same table you have to use in the ALV function.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME = sy-repid
I_INTERNAL_TABNAME = 'MTAB_REPORT_ASCII' "wrong
I_INCLNAME = sy-repid
CHANGING
CT_FIELDCAT = int_fcat
EXCEPTIONS
INCONSISTENT_INTERFACE = 1
PROGRAM_ERROR = 2
OTHERS = 3.
09-30-2008 3:39 PM
The list object does have data, i used the function module 'WRITE_LIST' to test if it has data.
Thanks for pointing me in the right direction once i'v managed to convert the List object to ASCII i'll then try to split the ASCII Itab records and dynamically create an internal table to store the data.
10-01-2008 8:51 AM
Thanks 4 the help the ascii itab does hav values, It turns out I was goin about the wrong way to check if it has values. I'm stil new ABAP hope I did not irritate u much.
10-01-2008 9:10 AM
Check the ASCII table in Debugging , and see the values how they are present in the internal table. accordingly you may have to use offset or Split the data. Show some two rows of the ASCII data.
10-01-2008 9:41 AM
Thanks for the help I did check the ASCII table in Debugging, it does have values, now i'm going to move to the second stage of my task and split the data and store it in a dynamic internal table.
Thanks to all of you for quick responces and help.