on 03-16-2012 7:45 AM
hello all,
i am new to FPM ovp. now im using FPM form UIBB, an upload function need to be realize.
i created a element with type : file upload.
but after click the xlsx file i want to upload, i didn't get a normal file path ,but a long string .
please guide me how to upload a file step by step. what methods should i use?
thanks and regards
Kevin
hi all ,
i get the file path but it seems not correct
FILE_NAME C:\fakepath\data.xlsx
MIME_TYPE application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
my file name is data.xlsx. but the path is not correct.
any idea how should i get the correct path?
best Regards
Kevin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Kevin,
I have met the same problem. Could you give me some advice on this issue?
I have a form UIBB with multiple elements. A element with type : file upload , which is associated with "FILE_ID" in my structure. Filed "MIME_TYPE"(string) and "FILE_NAME" (string) are also in the struture.
Two kinds code in IF_FPM_GUIBB_FORM~GET_DEFINITION are as below(Only one exit when run time 😞
1.
CLEAR ls_fields.
ls_fields-name = 'FILE_ID'.
ls_fields-mandatory = abap_true.
ls_fields-mime_type_ref = 'MIME_TYPE'.
ls_fields-file_name_ref = 'FILE_NAME'.
INSERT ls_fields INTO TABLE et_field_description.
2.
* APPEND INITIAL LINE TO et_field_description ASSIGNING <ls_new_field_descr>.
*
* <ls_new_field_descr>-name = 'MIME_TYPE'.
* <ls_new_field_descr>-label_by_ddic = 'X'.
* <ls_new_field_descr>-visibility = '01'.
* <ls_new_field_descr>-default_display_type = 'IN'.
*
* UNASSIGN <ls_new_field_descr>.
* APPEND INITIAL LINE TO et_field_description ASSIGNING <ls_new_field_descr>.
*
* <ls_new_field_descr>-name = 'FILE_NAME'.
* "<ls_new_field_descr>-label_by_ddic = 'X'.
* <ls_new_field_descr>-visibility = '02'.
* <ls_new_field_descr>-default_display_type = 'FU'.
* <ls_new_field_descr>-mime_type_ref = 'MIME_TYPE'.
After I select a xlsx file, and click "upload" button , I can't get any data from flush method.
Thanks & Best Regards,
Yupeng
hi Nick,
sorry for the late reply, I checked my program
ls_field-name = 'BUKRS'. ls_field-label_text = text-001. append ls_field to et_field_description.
ls_field-name = 'MONAT'. ls_field-label_text = text-002. append ls_field to et_field_description.
ls_field-name = 'GJAHR'. append ls_field to et_field_description.
ls_field-name = 'FILE_NAME'. ls_field-label_text = text-004.
ls_field-read_only = abap_true. append ls_field to et_field_description.
ls_field-mandatory = abap_true.
clear ls_field-mandatory_ref.
ls_field-name = 'FPATH'. ls_field-label_text = text-003.
ls_field-default_display_type = 'FU'.
ls_field-mime_type_ref = 'MIME_TYPE'.
ls_field-file_name_ref = 'FILE_NAME'.
append ls_field to et_field_description.
so, the 2nd kind of code you mentioned is not necessary i suppose.
by the way, i can only upload an txt File but not the xlsx file, and also i cannot change my program anymore , but I do get file content in method get data ,but never try method flush.
hope helps.
Kevin
How did you resolve this?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Kevin,
Could you kindly tell me how to resolve this problem. I am new to FPM. Could you please guide me?
Thanks and Regards,
Rimi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi RIMI ,
method: get definition:
eo_field_catalog ?= cl_abap_structdescr=>describe_by_data( ms_loadheader ).
(ms_loadheader has a type
types:
begin of ty_s_load_header,
bukrs type bukrs,
butxt type butxt,
monat type monat,
gjahr type gjahr,
fpath type string,"etfile_path,
fname type string, " nupldat,
file_name type string,
mime_type type string,
end of ty_s_load_header .
)
ls_field-name = 'FILE_NAME'. ls_field-label_text = text-004.
ls_field-read_only = abap_true. append ls_field to et_field_description.
ls_field-mandatory = abap_true.
clear ls_field-mandatory_ref.
ls_field-name = 'FPATH'. ls_field-label_text = text-003.
ls_field-default_display_type = 'FU'.
ls_field-mime_type_ref = 'MIME_TYPE'.
ls_field-file_name_ref = 'FILE_NAME'.
append ls_field to et_field_description.
method: get data
field-symbols: <fs_data> type ty_s_load_header.
assign cs_data to <fs_data>.
data: lv_file_content type xstring.
lv_file_content = <fs_data>-fpath.
*& --- get file content in type string
call function 'HR_KR_XSTRING_TO_STRING'
exporting
from_codepage = '8404'
in_xstring = iv_file_content
* OUT_LEN = OUT_LEN
importing
out_string = lv_out_string.
*& --- convert content to table, each internal table line = each file line
split lv_out_string at cl_abap_char_utilities=>newline into table lt_data.
(lt_data type table of string,)
split lv_string at cl_abap_char_utilities=>horizontal_tab into table lt_fields.
hope this helps
Kevin
User | Count |
---|---|
91 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.