‎2007 Apr 13 10:46 AM
Hello, my question is how to sort data? I have a text file and read it into an internal table with 'GUI_UPLOAD'. I want to sort it by asset number. Is there any function to do it? Thanks in advance!
‎2007 Apr 13 10:47 AM
sort itab by asset. "itab is the internal table name and the field name for asset number is asset
‎2007 Apr 13 10:47 AM
sort itab by asset. "itab is the internal table name and the field name for asset number is asset
‎2007 Apr 13 10:48 AM
hi
use:
sort <internal table name> by <field name>.
ex: sort itab by asset_no.
regards,
madhu
‎2007 Apr 13 10:48 AM
Hi,
Use the SORT <INT TABLE NAME> BY <ASSET FIELD NAME> Command.
Hope this resolves your query.
Reward all the helpful answers.
Regards
‎2007 Apr 13 10:48 AM
Hi,
After the using GUI_UPload you will get the data into internal table.
Sort that Int table by Asset number field.
SORT ITAB BY ANLNR.
then Loop that Itab and do upload into SAP.
reward if useful
regards,
Anji.
‎2007 Apr 13 10:49 AM
Hi...
use the statement,
SORT ITAB BY ASSET_NUMBER.
Hope it helps you...
Let me know if u have any more doubt...
Reward points if useful......
Suresh.......
‎2007 Apr 13 10:53 AM
Hi,
try the following code n let me know.
*" Data declarations...................................................
"----
Work variables *
"----
data:
w_title(2) type c,
w_name(5) type c,
w_cntcod(2) type c,
w_lang(2) type c.
"----
Type declaration of the structure to hold file data *
"----
data:
begin of fs_table,
title(2) type c,
name(5) type c,
cntcod(2) type c,
lang(2) type c,
end of fs_table.
"----
Internal table to hold file data *
"----
data:
t_table like standard table
of fs_table.
call function 'GUI_UPLOAD'
exporting
filename = 'C:\ASSIGN\YH645_050201.TXT'
FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = 'X'
HEADER_LENGTH = 0
READ_BY_LINE = 'X'
DAT_MODE = ' '
CODEPAGE = ' '
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
CHECK_BOM = ' '
VIRUS_SCAN_PROFILE =
IMPORTING
FILELENGTH =
HEADER =
tables
data_tab = t_table
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.
sort table t_table by title.
reward if helpful.
regards,
kiran kumar k