TYPES:BEGIN OF ty_test1,
fieldname TYPE char10,
desc TYPE char12,
END OF ty_test1.
*declare a second internal table with the actual fileds
TYPES:BEGIN OF ty_test2,
initial TYPE char10,
lastname TYPE char12,
firstname TYPE char12,
END OF ty_test2.
DATA:ls_fldnam TYPE ty_test1.
DATA:i_test1 TYPE STANDARD TABLE OF ty_test1,
wa_test1 TYPE ty_test1,
i_test2 TYPE STANDARD TABLE OF ty_test2,
wa_test2 TYPE ty_test2.
DATA: lf_field(40) TYPE c.
FIELD-SYMBOLS:
*give the field name from second table into first table fields and give the desc too
wa_test1-fieldname = 'INITIAL'.
wa_test1-desc = 'INITIAL'.
APPEND wa_test1 TO i_test1.
wa_test1-fieldname = 'FIRSTNAME'.
wa_test1-desc = 'FIRSTNAME'.
APPEND wa_test1 TO i_test1.
*in the final internal table i_test2 we want to get the description of the only two fileds
*these should appear in the final output when downloaded.
*the desc's will appear only for those fileds that are defined above.
LOOP AT i_test1 INTO ls_fldnam.
CONCATENATE 'wa_test2-' ls_fldnam-fieldname
INTO lf_field.
ASSIGN (lf_field) TO
IF sy-subrc = 0.
ENDIF.
ENDLOOP.
APPEND wa_test2 TO i_test2.
wa_test2-initial = 'SASI'.
wa_test2-firstname = 'YALAMANCHILI'.
wa_test2-lastname = 'xxx'.
APPEND wa_test2 TO i_test2.
CLEAR wa_test2.
wa_test2-initial = 'KANNAN'.
wa_test2-firstname = 'SENTHIL'.
APPEND wa_test2 TO i_test2.
* download queue-data
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = 'C:\Documents and Settings\Administrator\Desktop\sasi.txt'
filetype = 'ASC'
write_field_separator = 'X'
TABLES
data_tab = i_test2
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 <> 0.
* MESSAGE e008 WITH sy-subrc.
ENDIF.
No comments:
Post a Comment