‎2010 Apr 05 11:38 AM
Hello Expert,
My requirement is like i have a selection screen where user can put any database table name and once he execute then all the records whatever stored in the table can download in a .TXT file.
I am trying this by using field symbol but i stuck in between , i can fetch the data and put into a WA but how can i pass those data to a internal table . For your reference here is my code.
types:ty_record type string.
data: my_table type REF TO data.
data: rt_date type REF TO data.
data: rt_date1 type REF TO data.
data: w_record type string.
data: t_file type TABLE OF ty_record.
FIELD-SYMBOLS: <WA> type ANY,
<WA2> type ANY TABLE,
<WA1> type any,
<WA3> type any
.
selection-screen begin of block b1.
PARAMETERS:
s_table(10).
SELECTION-SCREEN END OF BLOCK b1.
START-OF-SELECTION.
CREATE DATA my_table type (s_table) .
ASSIGN my_table->* to <WA>.
*
CREATE DATA rt_date type (s_table).
ASSIGN rt_date->* to <WA1>.
SELECT * from (s_table) into <WA>.
move <WA> to <WA1>.
ENDSELECT.
Thanks,
Satya
‎2010 Apr 05 11:44 AM
Hello,
I think this is the way you should proceed:
DATA: s_table TYPE tabname VALUE 'T001'.
DATA: lt_tmp TYPE REF TO data.
FIELD-SYMBOLS: <lt_tmp> TYPE STANDARD TABLE.
CREATE DATA lt_tmp TYPE STANDARD TABLE OF (s_table).
ASSIGN lt_tmp->* TO <lt_tmp> .
SELECT * FROM (s_table) INTO TABLE <lt_tmp>.
IF sy-subrc = 0.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = 'C:\Documents and Settings\ssaha\Desktop\dyntab.txt'
TABLES
data_tab = <lt_tmp>
EXCEPTIONS
file_write_error = 1
no_batch = 2
gui_refuse_filetransfer = 3
invalid_type = 4
no_authority = 5
unknown_error = 6
header_not_allowed = 7
separator_not_allowed = 8
filesize_not_allowed = 9
header_too_long = 10
dp_error_create = 11
dp_error_send = 12
dp_error_write = 13
unknown_dp_error = 14
access_denied = 15
dp_out_of_memory = 16
disk_full = 17
dp_timeout = 18
file_not_found = 19
dataprovider_exception = 20
control_flush_error = 21
OTHERS = 22.
IF sy-subrc NE 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDIF.
Now you have data in the dyn table <lt_tmp>.
BR,
Suhas
‎2010 Apr 05 11:44 AM
Hello,
I think this is the way you should proceed:
DATA: s_table TYPE tabname VALUE 'T001'.
DATA: lt_tmp TYPE REF TO data.
FIELD-SYMBOLS: <lt_tmp> TYPE STANDARD TABLE.
CREATE DATA lt_tmp TYPE STANDARD TABLE OF (s_table).
ASSIGN lt_tmp->* TO <lt_tmp> .
SELECT * FROM (s_table) INTO TABLE <lt_tmp>.
IF sy-subrc = 0.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = 'C:\Documents and Settings\ssaha\Desktop\dyntab.txt'
TABLES
data_tab = <lt_tmp>
EXCEPTIONS
file_write_error = 1
no_batch = 2
gui_refuse_filetransfer = 3
invalid_type = 4
no_authority = 5
unknown_error = 6
header_not_allowed = 7
separator_not_allowed = 8
filesize_not_allowed = 9
header_too_long = 10
dp_error_create = 11
dp_error_send = 12
dp_error_write = 13
unknown_dp_error = 14
access_denied = 15
dp_out_of_memory = 16
disk_full = 17
dp_timeout = 18
file_not_found = 19
dataprovider_exception = 20
control_flush_error = 21
OTHERS = 22.
IF sy-subrc NE 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDIF.
Now you have data in the dyn table <lt_tmp>.
BR,
Suhas
‎2010 Apr 05 12:10 PM