04-10-2012 7:24 AM
Hi SapAll.
i have got a situation where in my program iam using the SAP Standard Function Module 'GUI_UPLOAD' , but when iam running my program to get the filedata iam only getting '5833' records int he INternal table where the actual file got '5837' records in it .i have tried by splitting the File into 2 halfs and tested again and in this case the FM''GUI_UPLOAD' had returned the correct no of records in the internal table.
so my question is why the SAP FM'GUI_UPLOAD' had given me 4 records less count out of the actual file when i tested with single file where as it returned me the correct count when i tested two times by splitting the actual file into 2 halfs.
the source sode is as follows :
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = l_fname
* FILETYPE = 'ASC'
* HAS_FIELD_SEPARATOR = ' '
* HEADER_LENGTH = 0
* READ_BY_LINE = 'X'
* DAT_MODE = ' '
* CODEPAGE = ' '
* IGNORE_CERR = ABAP_TRUE
* REPLACEMENT = '#'
* CHECK_BOM = ' '
* VIRUS_SCAN_PROFILE =
* NO_AUTH_CHECK = ' '
* IMPORTING
* FILELENGTH =
* HEADER =
TABLES
data_tab = intab.
* 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.
will be waiting for your response.
regards.
Varma
04-10-2012 7:44 AM
Hi,
can you try the OO version of this ,
CL_GUI_FRONTEND_SERVICES=>GUI_UPLOAD
04-10-2012 8:10 AM
Hi Ankith.
i have tried but still i can the same output in the Internal table while debugging.
regards.
Varma.
04-10-2012 7:55 AM
Any chance of uploading the file here. I suspect some special character ( an EOF? ) Is present at line 5833 which might be causeing the problem.
Other thing you can try. Make a copy of original file. Delete Line 5833 and 5834 and then try uploading.
04-10-2012 8:06 AM
04-10-2012 8:30 AM
Check out your attached file. It has only 5834 Line and last line balnk. I am still sure that is some special character herewith. at line 5833/34
04-10-2012 8:38 AM
There is no problem with the FM. The File has some grbage data in the file and it needs to be corrected. Open the file with some hex editor like editpad and try to see what content is there at line 5833 ( which are generally invisible ).
04-10-2012 8:20 AM
Varma,
Can you pl paste the line, how you declared internal tbl intab ?
Thanks
Sridhar
04-10-2012 8:33 AM
Hi Sridhar.
i have declared the Internal table in the source code as below
TYPES: BEGIN OF gty_intab,
txt(400),
END OF gty_intab.
DATA: intab TYPE STANDARD TABLE OF gty_intab.
regards.
Varma.
04-10-2012 8:45 AM
Hi Venkat,
I've Seen you file and the problem is with the file only.
What you can do open the file in excel and save and save it again you problem will be solved.
I've tested with ur file first I was facing the same problem as your and after correcting the file it worked.
Regards,
Rakesh.