2009 Aug 04 1:10 PM
HI ,
I am using GUI upload function and i get the data into table and i want to move this data to field type string how can i do that ?
Regards
Joy
DATA: gt_itab TYPE STANDARD TABLE OF char2048.
START-OF-SELECTION.
CALL METHOD cl_gui_frontend_services=>gui_upload
EXPORTING
filename = gs_file
CHANGING
data_tab = gt_itab
EXCEPTIONS
file_open_error = 1
file_read_error = 2
no_batch = 3
gui_refuse_filetransfer = 4
invalid_type = 5
no_authority = 6
unknown_error = 7
bad_data_format = 8
header_not_allowed = 9
separator_not_allowed = 10
header_too_long = 11
unknown_dp_error = 12
access_denied = 13
dp_out_of_memory = 14
disk_full = 15
dp_timeout = 16
not_supported_by_gui = 17
error_no_gui = 18
OTHERS = 19.
2009 Aug 04 1:50 PM
Sorry ! I missed some lines ..
Data: begin of t_char_file occurs 0,
string(2000),
end of t_char_file.
field-symbols: <t_char_file> type x ,
<t_file> type x.
*------ following code after gui_upload
loop at gt_itab.
assign gt_itab to <t_char_file> casting.
assign gt_itab to <t_file> casting.
<t_file> = <t_char_file>.
append t_char_file.
endloop.
Sorry ! I missed some lines ..
Data: begin of t_char_file occurs 0,
string(2000),
end of t_char_file.
field-symbols: <t_char_file> type x ,
<t_file> type x.
*------ following code after gui_upload
loop at gt_itab.
assign gt_itab to <t_char_file> casting.
assign gt_itab to <t_file> casting.
<t_file> = <t_char_file>.
append t_char_file.
endloop.
2009 Aug 04 1:13 PM
Hi,
Refer following code
types : BEGIN OF ty_s_download,
data TYPE string, "Tax Data
END OF ty_s_download.
----
G L O B A L D A T A D E C L A R A T I O N S
----
*Global Internal tables
DATA : gt_download TYPE STANDARD TABLE OF ty_s_download. "Download data
LOOP AT gt_tax_data INTO ls_tax_data.
Pass All the tax data to screen output table
ls_output-bukrs = ls_tax_data-bukrs.
ls_output-state = ls_tax_data-state.
ls_output-store = ls_tax_data-store.
ls_output-tax_type = ls_tax_data-tax_type.
ls_output-tax_rate = ls_tax_data-tax_rate.
ls_output-discount_amount = ls_tax_data-discount_amount.
lv_discount = ls_tax_data-discount_amount.
lv_tax_rate = ls_output-tax_rate.
Calculate Gross tax due
ls_output-gross_due = ls_tax_data-report_amount.
lv_gross_due = ls_output-gross_due.
IF NOT ls_tax_data-tax_rate IS INITIAL.
Calculate Taxable Purchase
ls_output-purchase = ls_output-gross_due / ls_tax_data-tax_rate.
ELSE.
ls_output-purchase = 0. "Default it to zero if the tax_rate is zero.
ENDIF.
lv_purchase = ls_output-purchase.
Calculate Net Tax Due
ls_output-net_due = ls_output-gross_due - ls_tax_data-discount_amount.
lv_net_due = ls_output-net_due.
Concatenate all field values
CONCATENATE ls_output-bukrs
ls_output-state
ls_output-store
ls_output-tax_type
lv_purchase
lv_tax_rate
lv_gross_due
lv_discount
lv_net_due
INTO ls_download-data
SEPARATED BY lc_tab.
Append all the downloaded tax data
APPEND ls_download TO gt_download.
Clear work areas
CLEAR : ls_output,
ls_tax_data,
ls_download,
lv_purchase,
lv_discount,
lv_tax_rate,
lv_net_due,
lv_gross_due.
ENDLOOP.
Regards,
Prashant
2009 Aug 04 1:28 PM
Hi ,
try following code -
Data: begin of t_char_file occurs 0,
string(2000),
end of t_char_file.
field-symbols: <t_char_file> type x.
*------ following code after gui_upload
loop at gt_itab.
assign gt_itab to <t_char_file> casting.
append t_char_file.
endloop.
2009 Aug 04 1:50 PM
Sorry ! I missed some lines ..
Data: begin of t_char_file occurs 0,
string(2000),
end of t_char_file.
field-symbols: <t_char_file> type x ,
<t_file> type x.
*------ following code after gui_upload
loop at gt_itab.
assign gt_itab to <t_char_file> casting.
assign gt_itab to <t_file> casting.
<t_file> = <t_char_file>.
append t_char_file.
endloop.
2009 Aug 04 2:10 PM
Hi Narayan,
Thanks ,
but i want the field from gt_itab to be in field str like string
and not in field type t_char_file which is table of string.
Regards
Joy
2009 Aug 04 2:16 PM
>
> but i want the field from gt_itab to be in field str like string
> and not in field type t_char_file which is table of string.
Hello Joy,
This is not possible using GUI_UPLOAD. In the file if you have multiple lines, you get multiple lines in your table.
You can try to upload the data as 'BIN' but in that case your data has to be of hex-type string & not normal chracter string.
Hope this is clear.
BR,
Suhas
2009 Aug 04 2:16 PM
Hi,
you can simply decalre your gt_itab as following.
also you need a varable of type string to loop.
data : gt_itab type table of string,
gw_itab type string.
loop at gt_itab into ge_itab.
do your processing here
endloop.
regards,
Rahul
2009 Aug 04 2:08 PM
Hi,
you can simply decalre your gt_itab as following.
also you need a varable of type string to loop.
data : gt_itab type table of string,
gw_itab type string.
loop at gt_itab into ge_itab.
do your processing here
endloop.
regards,
Rahul
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |