Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with FM gui_upload

Former Member
0 Kudos

Hello

I use fonction GUI_UPLOAD with the following parameters:

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

filename = w_nomfic

filetype = 'ASC'

has_field_separator = 'X'

dat_mode = 'X'

TABLES

data_tab = temp_contrat

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

OTHERS = 17.

My table temp_contrat is defined as follow :

DATA : BEGIN OF temp_contrat OCCURS 0,

fico_lifnr2 TYPE lifnr,

fico_matnr TYPE matnr,

fic_ktmng TYPE ktmng,

fic_netpr TYPE netpr,

fic_plifz(3),

fic_fia TYPE z_maj_creat_fia,

fic_loekz TYPE z_loekz,

fic_ztyp_ha TYPE ztyp_ha,

fic_rsa TYPE z_maj_creat_rsa,

fic_rsa_non_sup TYPE z_rsa_non_sup,

fic_evers TYPE evers,

fic_kodatab TYPE kodatab,

fic_kodatbi TYPE kodatbi,

END OF temp_contrat.

I have a problem with two fields date : fic_kodatab and fic_kodatbi

In my file :

if this two fields are not filled : no problem.

if this two fields are empty : no problem.

If the first field (fic_kodatab) is filled and the second field is empty: no problem

But, if the first field is empty and the second field is fielled : problem, the FM returns code 8.

I don't understand the problem. Can you help me ?

5 REPLIES 5

Former Member
0 Kudos

Hello GUINAMANT,

Check your flatfile data and validate the data type definitions length.

Thanks,

Greetson

Former Member
0 Kudos

hi use like this....

if the field value is empty then pass the space using the class like this..

data: filler(4) TYPE c VALUE cl_abap_char_utilities=>HORIZONTAL_TAB.

0 Kudos

When you want I use this method ?

I create my file with Excel and then I save file in format .txt with tabs.

Then I use a transaction which call FM GUI_UPLOAD and this FM returns code 8.

0 Kudos

Can you post the line from the .txt file with tabs that is causing troubles?

Also, the line that is working with the first field would be nice

0 Kudos

hi if this is excel use this ..

REPORT ZTESTPROG003.

TYPES:

BEGIN OF ty_upload,

matnr like mara-matnr,

meins like mara-meins,

mtart like mara-mtart,

mbrsh like mara-mbrsh,

END OF ty_upload.

DATA it_upload TYPE STANDARD TABLE OF ty_upload WITH header line.

DATA wa_upload TYPE ty_upload.

DATA: itab TYPE STANDARD TABLE OF alsmex_tabline WITH header line.

  • DATA itab TYPE STANDARD TABLE OF ty_upload WITH header line.

CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'

EXPORTING

filename = 'C:\Documents and Settings\venkatapp\Desktop\venkat.xls'

i_begin_col = 1

i_begin_row = 1

i_end_col = 4

i_end_row = 65535

TABLES

intern = itab.

if not itab[] is initial.

loop at itab .

case itab-col.

when '0001'.

it_upload-matnr = itab-value.

when '0002'.

it_upload-meins = itab-value.

when '0003'.

it_upload-mtart = itab-value.

when '0004'.

it_upload-mbrsh = itab-value.

append it_upload.

clear it_upload.

clear itab.

endcase.

endloop.

endif.

loop at it_upload.

write:/ it_upload-matnr,it_upload-meins,it_upload-mtart,it_upload-mbrsh.

endloop.