2008 Dec 11 11:00 AM
Hi All,
I am uploading a TAB sepearted file from PC using GUI_UPLOAD. The file is getting uploaded correctly.
In the internal table the data in the file appears as below
'56110020#40#39.00#10353#DE10Z370###Creidt card spend for month January #################'
For the tabs in the text file, the internal table shows '#'.
Now I am using SPLIT command to split the data into different field (all are char type) at the seperater TAB or # in this case.
SPLIT it_tab-record AT p_sep INTO fld1 fld2 fld3.
But the data is NOT getting split at # and the result I am getting is that: fld1 = 56110020#40#39.00 and now values in fld2 and fld3.
I an working in ECC 6.0. We have upgraded from 4.6C to ECC 6.0. In 4.6C the same program is working fine.
Please help.
regards,
Gaurav
Hi All,
I am uploading a TAB sepearted file from PC using GUI_UPLOAD. The file is getting uploaded correctly.
In the internal table the data in the file appears as below
'56110020#40#39.00#10353#DE10Z370###Creidt card spend for month January #################'
For the tabs in the text file, the internal table shows '#'.
Now I am using SPLIT command to split the data into different field (all are char type) at the seperater TAB or # in this case.
SPLIT it_tab-record AT p_sep INTO fld1 fld2 fld3.
But the data is NOT getting split at # and the result I am getting is that: fld1 = 56110020#40#39.00 and now values in fld2 and fld3.
I an working in ECC 6.0. We have upgraded from 4.6C to ECC 6.0. In 4.6C the same program is working fine.
Please help.
regards,
Gaurav
2008 Dec 11 11:05 AM
try using tab delimiter for splitting with attribute HORIZONTAL_TAB from class CL_ABAP_CHAR_UTILITIES.
BTW: Function module GUI_UPLOAD should no longer be used, use methods from class CL_GUI_FRONTEND_SERVICES.
Edited by: Micky Oestreich on Dec 11, 2008 12:06 PM
2008 Dec 11 11:32 AM
Hi Micky,
I am already using tab delimiter with attribute HORIZONTAL_TAB from class CL_ABAP_CHAR_UTILITIES.
In the debug mode, I tried giving space between the data and the # i.e.:
'56110020 #40 #39.00 #10353 #DE10Z370 # # #Creidt card spend for month January # # # # # # # # # # # # # # # # #'
With this the data is getting seperated in fld1, fld2 etc correctly.
e.g.: fld1 = 56110020
fld2 = 40
fld3 = 39.00
i am not able to understand why is it behaving so.
Please help.
regards,
Gaurav
2008 Dec 11 11:50 AM
can you do this way
PURC002|0000026071|_013890010310||00020|DE|AT|EINA|38 + 0,03 MTZ ab 15.05.04
PURC002|0000026071|_013890010310||00020|DE|AT|EINA|38/Stk. + MTZ EUR 0,08 = <U>EUR 0,46</>
IF p_local EQ gc_x.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = gv_file
filetype = gc_filetype
TABLES
data_tab = gt_text_file
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.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
*If the Application Server is selected on the selection screen
ELSEIF p_server EQ gc_x.
Read the data from Application Server
OPEN DATASET gv_file FOR INPUT IN TEXT MODE ENCODING DEFAULT
WITH SMART LINEFEED.
ENDIF.
*If the Presentation Server is selected on the selection screen
IF p_local EQ gc_x.
LOOP AT gt_text_file INTO wa_text_file.
CLEAR wa_text_table.
SPLIT wa_text_file-line AT gc_comma INTO wa_text_table-objectid
wa_text_table-lifnr
wa_text_table-matnr
wa_text_table-ebelp
wa_text_table-tdname
wa_text_table-spras
wa_text_table-textid
wa_text_table-object
wa_text_table-line.
APPEND wa_text_table TO gt_text_table.
ENDLOOP.
2008 Dec 11 11:59 AM
Hi
I think in Flat file, the tab space between one field and the other is more because of which you are getting additional characters. The tab space should be exact. Once you hit tab, it should go into the next field straight away, there should be no gaps. And hope you are giving tab seperator as X in the FM.
Vishwa.
2008 Dec 11 11:05 AM
Hi,
Why don't you use the parameter
has_field_separator = 'X'
in gui_upload directly so that SPLIT won;t be necessary at all.
Regards
Raju Chitale
2008 Dec 11 11:44 AM
Hi ,
Set the parameter has_field_separator to 'X' from GUI_UPLOAD importing parameters.
It willsolve ur problem.
Thanks
2008 Dec 11 12:21 PM
Hi,
By setting the parameter has_field_separator to 'X' will not solve my problem. Actually what I want is as below:
The data
'56110020#40#39.00#10353#DE10Z370###Creidt card spend for month January #################'
Needs to be separated into
fld1 = 56110020
fld2 = 40
fld3 = 39.00
fld4 = 10353
using SPLIT statement.
regards,
Gaurav
2008 Dec 11 12:33 PM
hi,
Your split statment wont work, because it seems that your target structure has only fields, but the source file has many fields. you wil have to declare the target structure with as many number of fields you have in the source structure.
Example
following is the source file with 1 line :
123#456#hello##567
here you have 5 fields in the source
So my target strucute should also contain 5 fields:
struc_target
f1
f2
f3
f4
f5
Now when you do a split at the tab into a work area struc_target
You will then get the values as follows :
f1 -- 123
f2 -- 456
f3 -- Hello
f4 --
f5 -- 567
Now you are free to use any of the fields copied to the target structure
regards,
Advait
Edited by: Advait Gode on Dec 11, 2008 1:33 PM
2008 Dec 12 6:07 AM
Hi,
This is precisely what you will get if you just use the parameter has_field_separator = 'X' in GUI_UPLOAD as pointed out in my previous post.
I hope you will try this,
Regards
Raju Chitale
2008 Dec 12 10:29 AM
Hi Gaurav,
The '#' symbol has some Heap Value significance with the internal tables. This references to the Heap address of the field. Sometimes this is used with Hashed internal tables for the data reference. Please check with your functional consultant then modify the same.
Try using '|' at has_field_separator instead of '#' and check the same.
2008 Dec 12 11:49 AM
Hi Gaurav,
Can you please tell me how you are entering the data in the flat file.
can you please send the flat file data once.
So that i can give u a correct solution.
Thanks,
2008 Dec 12 12:26 PM
Hi use the code below to achieve your requirement;
DATA : text(100), fld1(10), fld2(10), fld3(10), dummy(10).
text ='56110020#40#39.00#10353#DE10Z370###CREIDT CARD SPEND FOR MONTH JANUARY#################'.
REPLACE ALL OCCURRENCES OF '#' IN text WITH '*'.
SPLIT text AT '*' INTO fld1 fld2 fld3 dummy.
Output:
fld1 = 56110020
fld2 = 40
fld3 = 39.00Hope this will solve your problem.
Regards
Karthik D
2008 Dec 11 11:45 AM
Hi ,
First tell me u r internal table is in which foramt it is starucutre format or String.
Thanks,
2008 Dec 12 5:08 AM
Hi,
I think you are going correct
(Split it_final-name at u2018_u2019 Into w_firstname w_lastname.)
Have look in debug for the values of w_firstname w_lastname.
Thanks,
Krishna...
2008 Dec 12 12:32 PM
Hi,
This is the working solution:
DATA: it_file_fields TYPE STANDARD TABLE OF string WITH HEADER LINE,
it_file_data TYPE STANDARD TABLE OF string WITH HEADER LINE.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = l_filename
filetype = 'ASC'
TABLES
data_tab = it_file_data.
DATA: xsep TYPE xstring VALUE '09', "tab mark
sep TYPE string.
CALL FUNCTION 'HR_KR_XSTRING_TO_STRING'
EXPORTING
in_xstring = xsep
IMPORTING
out_string = sep.
SPLIT it_file_data AT sep INTO TABLE it_file_fields IN CHARACTER MODE.
Regards
Marcin
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |