2010 Sep 13 10:40 AM
Hi all,
Im facing a problem in uploading a file from presentation server to SAP.
The program was coded to upload the file using Function module "UPLOAD".
I know this FM is obsolete,,but still my client uses the same system.
When I check it in debugging..it shows some bytes have been trasfered..but when checkd the internal table..the internal table does nt contain any data..its getting some junk value like " ÿþI "
Pls help me to understand why its getting the error.
Thanks in advance.
Rgs,
Priya
Moderator message: please use more descriptive subject lines from now on.
Edited by: Thomas Zloch on Sep 13, 2010 1:24 PM
2010 Sep 13 10:42 AM
You cannot change the report using GUI_UPLOAD?
I suspect your problem is due by the FM itself.
I never heard about FM UPLOAD (the oldest i used was WS_UPLOAD).
2010 Sep 13 10:47 AM
Hi Simone,
Thanks for your reply!
Ofcourse I can change it to gui_upload.
But my requirement is just to investigate why the internal table is nt populated.
The system is of 4.6 version.
Any idea why the internal table hasnt getting populated?
Any idea pls share....
Thnxs
Priya
2010 Sep 13 10:49 AM
Hi Priya,
Please check the file if the data is correct, then check with the file extension which is used for the file and the type mentioned in the pop-up window provided by the Upload FM are same.
2010 Sep 13 10:53 AM
Hi,
The data_tab parameter is sufficient enough to pass the data to SAP. Check if the table type you pass to this parameter is of type c.
Sujay
2010 Sep 13 11:00 AM
Hi,
Here is how the itnternal table has been declared.
data: begin of t_itab occurs 0,
BUKRS like BKPF-BUKRS, " 4
BLDAT(10) TYPE C, " 10
budat(10) type c, " 10
HKONT LIKE BSEG-HKONT, " 10
SHKZG LIKE BSEG-SHKZG, " 1
WRBTR(14) type c, "bseg-WRBTR, " 14
KOSTL LIKE BSEG-KOSTL, " 10
SGTXT LIKE BSEG-SGTXT, " 50
end of t_itab.
CALL FUNCTION 'UPLOAD'
EXPORTING
* CODEPAGE = ' '
FILENAME = 'C:\WINDOWS\DESKTOP\UPLOADst.txt'
FILETYPE = 'ASC'
* ITEM = ' '
* FILEMASK_MASK = ' '
* FILEMASK_TEXT = ' '
* FILETYPE_NO_CHANGE = ' '
* FILEMASK_ALL = ' '
* FILETYPE_NO_SHOW = ' '
* LINE_EXIT = ' '
* USER_FORM = ' '
* USER_PROG = ' '
* SILENT = 'S'
* IMPORTING
* FILESIZE =
* CANCEL =
* ACT_FILENAME =
* ACT_FILETYPE =
TABLES
data_tab = t_itab
* EXCEPTIONS
* CONVERSION_ERROR = 1
* INVALID_TABLE_WIDTH = 2
* INVALID_TYPE = 3
* NO_BATCH = 4
* UNKNOWN_ERROR = 5
* GUI_REFUSE_FILETRANSFER = 6
* OTHERS = 7
.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
2010 Sep 13 11:15 AM
Hi Priya,
Change the value of FILETYPE from ASC to DAT, it will work.
Regards
Abhii
2010 Sep 13 11:16 AM
Hi,
In the data do you have tab delimited etc. For your current code, you should get it without gaps to make it work.
100001/01/201001/01/20102323232322H15000231000005522222India
If they will provide a delimited file,
then declare the internal table with
data: begin of t_itab occurs 0,
total(109),
end of t_itab.
Then split with in the loop into the other internal table.
Also, occurs 0 is also obsolete. You should declare a type, internal table and work area.
Sujay
2010 Sep 13 11:20 AM
Hi Priya,
In your case you have an internal table with the fields known just change the value of FILETYPE from ASC to DAT it will definitely work.
Regards
Abhii
2010 Sep 13 11:30 AM
Hi Abhii,
Nope it does nt work..even when i chng it to DAT.
@Sujay..yes the flat file does have any delimiter.
Have tested the FM Upload seperately in SE37..the same error im getting here also.
But Tables result..its showing 12 entries..when chkd it's showing the only one entry with junk value.
-Priya
Edited by: Priya agarwal on Sep 13, 2010 12:31 PM
2010 Sep 13 11:35 AM
Hi,
Pass it to the internal table and delimit it after getting in the internal table. Then it should work
Sujay
2010 Sep 13 11:50 AM
Hi,
Here is sample flat file.
IN0224.08.201024.08.20101430001 S00000000008.00IN020001 JV For August Salary
IN0224.08.201024.08.20101430001 S00000000008.00IN020003 JV For August Salary
IN0224.08.201024.08.20101430001 S00000000008.00IN020012 JV For August Salary
IN0224.08.201024.08.20101430001 S00000000008.00IN020088 JV For August Salary
There is no delimiter among the fields..earlier the same code used to work fine..
dont know where it is going wrong..
Pls suggest possilble solution..
Thnxs,
Priya
2010 Sep 13 11:55 AM
Hi,
Same code works for me. Enable the exceptions and check if it points the problem. Copy some of the records into a new file and check if it works?
Sujay
2010 Sep 13 1:14 PM
Hi Sujay,
The same code works fine in my system also( of ECC 6.0).
Dont know why it is not populating the internal table in 4.6, earlier which used to.
To enable the expections at this point is of no use..there is some value coming in the internal table ..(ÿþI)
--Priya
2010 Sep 13 11:38 AM
Hi Priya,
PFB the code snippet for uploading the data from presentation server text file into an internal table.
TYPES : BEGIN OF tp_bkpf,
bukrs TYPE bkpf-bukrs,
belnr TYPE bkpf-belnr,
END OF tp_bkpf.
DATA : t_bkpf TYPE STANDARD TABLE OF tp_bkpf,
l_file TYPE string.
PARAMETERS: p_file TYPE rlgrap-filename.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
*--Get the presentation server path of the file
CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
CHANGING
file_name = p_file.
IF sy-subrc <> 0.
ENDIF.
START-OF-SELECTION.
l_file = p_file.
*--Get the file data into an internal table
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = l_file
filetype = 'ASC'
has_field_separator = 'X'
TABLES
data_tab = t_bkpf.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
(Note : in yout text file separate the fields using tab.)
Eg. 8000 1600000001
8000 1600000002
Regards,
Pranjali
2010 Sep 13 11:39 AM
2010 Sep 13 12:01 PM
Hello,
Try to remove the comment from:
IMPORTING
Regards,
Per Rune
2010 Sep 13 1:23 PM
@Sujay..yes the flat file does have any delimiter.
may be this is the problem.
You can try this.
declare a internal table like
data:itab type table of string.
Use this fm to get the data from the fm UPLOAD.
After this call the fm TEXT_CONVERT_XLS_TO_SAP, mark has field seperator and get the data to your itab.
In GUI_UPLOAD the interface itself has a parameter to specify whether there is any field seperator in the file.
2010 Sep 13 2:23 PM
try using the parameter CODEPAGE:
4110-> UTF8
1100-> ISO8859_1
1140-> ISO8859_1
1401-> ISO8859_2
1500-> ISO8859_5
1610-> ISO8859_9
1700-> ISO8859_7
1800-> ISO8859_8
1900-> ISO8859_4
8200-> ISO2022JP
8700-> ISO8859_4
0120-> Cp500
1103-> Cp850
1160-> windows-1252
1404-> Cp1250
1504-> Cp1251
1614-> Cp1254
1704-> Cp1253
1804-> Cp1255
1904-> Cp1257
8604-> Cp874
8704-> Cp1256
8000-> SJIS
8100-> EUC_JP
8300-> Big5
8600-> TIS620
2010 Sep 14 8:29 AM
Hi,,
None of the inputs has worked out.
Just need a clarification from you that,,whether UPLOAD FM works in 4.6 envirorment or not?
Because it is working fine for same flat file in ECC 6.0..but failed in 4.6
any one pls kindly help.
Regards,
Priys