01-24-2007 12:40 PM
Hi,
I want to convert list output into text file or internal table.Please send a simple sample program.It should be done in program dynamically
Thanks
Vikranth Khimavath
01-24-2007 12:42 PM
Please check the FM's WRITE_LIST and LIST_TO_ASCII
You need to get the list into an internal table and then pass the output of the list to the following FMs to get it into an internal table format.
Hope this helps.
01-24-2007 12:43 PM
Hello,
U can do like this.
You need to submit the program like this:
DATA: LISTOBJECT LIKE ABAPLIST OCCURS 0 WITH HEADER LINE.
TYPES:
TYPE_TEXTLINE(512).
DATA:
W_TEXTLINE TYPE TYPE_TEXTLINE.
DATA:
LT_LIST TYPE TABLE OF ABAPLIST,
LT_TXT TYPE TABLE OF TYPE_TEXTLINE.
SUBMIT Z48R_PROJEKTSTATUS WITH SO_PROJ IN SO_PROJ
WITH SO_PSP IN SO_PSP
WITH SO_WWSTO IN SO_WWSTO
WITH SO_WWGFG IN SO_WWGFG
WITH SO_ISTAT IN SO_ISTAT
WITH SO_ESTAT IN SO_ESTAT
EXPORTING LIST TO MEMORY
AND RETURN.
Import the list from memory and store it in table listobject
CALL FUNCTION 'LIST_FROM_MEMORY'
TABLES
LISTOBJECT = LISTOBJECT
EXCEPTIONS
NOT_FOUND = 1
OTHERS = 2.
IF SY-SUBRC <> 0.
WRITE 'Error in list_from_memory.'.
ENDIF.
CALL FUNCTION 'LIST_TO_ASCI'
TABLES
LISTASCI = LT_TXT
LISTOBJECT = LISTOBJECT
EXCEPTIONS
EMPTY_LIST = 1
LIST_INDEX_INVALID = 2
OTHERS = 3.
CHECK SY-SUBRC = 0.
DATA: LV_LINES LIKE SY-TABIX.
DESCRIBE TABLE LT_TXT LINES LV_LINES.
LOOP AT LT_TXT INTO W_TEXTLINE.
CHECK SY-TABIX > 3.
CHECK W_TEXTLINE(5) <> 'Keine'.
CHECK W_TEXTLINE(5) <> '-----'.
DO 120 TIMES. REPLACE ' |' WITH '|' INTO W_TEXTLINE. ENDDO.
"WRITE / w_textline(255).
PERFORM HANDLE_LINE_ZSTATUS USING W_TEXTLINE.
ENDLOOP.
Free memory
CALL FUNCTION 'LIST_FREE_MEMORY'.
ENDFORM. " GET_ZSTATUS
&----
*& Form handle_line_ZSTATUS
&----
text
----
<--> P_TEXTLINE text
----
FORM HANDLE_LINE_ZSTATUS USING P_LINE.
DATA: BEGIN OF T_CLINE OCCURS 0,
TEXT(40),
END OF T_CLINE.
erstes Zeichen immer | und irrelevant
SHIFT P_LINE.
SPLIT P_LINE AT '|' INTO TABLE T_CLINE.
READ TABLE T_CLINE INDEX 2.
G_T_STATUS-PSPID = T_CLINE-TEXT.
READ TABLE T_CLINE INDEX 3.
G_T_STATUS-POSID = T_CLINE-TEXT.
APPEND G_T_STATUS.
ENDFORM. " handle_line_ZSTATUS
Try like this in a new report.
Vasanth