Skip to Content
0
May 24, 2016 at 07:25 AM

ISSUE IN SINGLE PROGRAM FOR TABLE UPLOAD

30 Views

Hi Experts ,

My client asked to need one common program to Upload data to custom tables . so i have created a program like below .

DATA : lv_string TYPE string .

DATA: lit_dowld TYPE STANDARD TABLE OF gty_downld,

lwa_dowld TYPE gty_downld.



FIELD-SYMBOLS: <lfs_string> TYPE any.



*--- Create dynamic internal table

CREATE DATA gt_data TYPE TABLE OF (p_table).

ASSIGN gt_data->* TO <ft_data>.



*--- Create dynamic work area

CREATE DATA gs_data TYPE (p_table).

ASSIGN gs_data->* TO <fs_data>.



PERFORM fetch_feilds_of_table .



LOOP AT git_fields INTO wit_fields.



iw_fld-field = wit_fields-fieldname .

APPEND iw_fld TO it_fld .

CLEAR : iw_fld .



ENDLOOP .





*get data from table .

SELECT * FROM (p_table) INTO TABLE <ft_data> .



CONCATENATE p_file1 '\' p_table '.XLS' INTO gv_file1 .



CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

* BIN_FILESIZE =

filename = gv_file1

* filetype = 'ASC'

* APPEND = ' '

write_field_separator = 'X'

TABLES

data_tab = <ft_data>

fieldnames = it_fld

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 ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ELSE .

MESSAGE 'File has been downloaded successfully'(002) TYPE gc_s.

LEAVE LIST-PROCESSING.

ENDIF.

This program is working fine but the problem here is client will upload data Through text file with out the field of MANDT and no values of it , I checked with out this field but above program is not working .

Can YOu please advise how to approach this

Thanks

Kiran