‎2006 Nov 14 5:31 AM
Hi experts,
when iam uploading vendor details,,,
it is giving above error.
chk the code once.....
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = 'C:/VENDOR1.TXT'
FILETYPE = 'DAT'
TABLES
DATA_TAB = IT_UPLOAD.
CALL FUNCTION 'BDC_OPEN_GROUP'
EXPORTING
CLIENT = SY-MANDT
GROUP = 'SRR'
USER = SY-UNAME.
‎2006 Nov 14 5:34 AM
call function 'GUI_UPLOAD'
exporting
filename = 'C:VENDOR1.TXT'
filetype = 'ASC'
has_field_separator = 'X'
* HEADER_LENGTH = 0
* READ_BY_LINE = 'X'
* DAT_MODE = ' '
* CODEPAGE = ' '
* IGNORE_CERR = ABAP_TRUE
* REPLACEMENT = '#'
* CHECK_BOM = ' '
* IMPORTING
* FILELENGTH =
* HEADER =
tables
data_tab = IT_UPLOAD
* 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.kishan negi
null
null
‎2006 Nov 14 5:55 AM
thanq u for u r answer. but after doing this it is giving error 'file not found'.
because here in this i has seperated fields with tab ---then we have to 'DAT' only insted of 'ASC'.
Here iam giving the fileds also....
56734 0001 0001 0001 mr. das r in 120000 A1 0001 0001 INR
‎2006 Nov 14 6:43 AM
Hi here iam sending the whole code once to you. just chk it once and same error(WRONG VALUE OF THE parameter file type) is coming after the changes.
if i use asc it is giving that no file exists.
*********************************************
Table Declaration
*********************************************
tables :rf02k, "Maintain vendor master record screen and work fields
lfa1, "Vendor Master(general)
lfbk, "Vendor Master (Bank Details)
lfb1, "Vendor Master (Company Code)
lfm1, "Vendor master record purchasing organization data
lfb5. "Vendor master (dunning data)
*********************************************
Data Declaration
*********************************************
data : begin of it_UPLOAD occurs 0,
LIFNR like rf02k-lifnr, "vendor no
BUKRS like rf02k-bukrs, "company code
EKorg like rf02k-ekorg, "purchasing org
KTOKK like rf02k-ktokk, "account group
anred like lfa1-anred, "initial
name1 like lfa1-name1, "name of vendor
sortl like lfa1-sortl, "search term
land1 like lfa1-land1, "country
akont like lfb1-akont, "reconcillation a/c.
fdgrv like lfb1-fdgrv, "planning group
zterm like lfb1-zterm, "terms of payment key
mahna like LFB5-MAHNA, "dunning procedure
waers like lfm1-waers, "Purchase order currency
END OF IT_UPLOAD.
DATA : IT_BDCDATA LIKE BDCDATA OCCURS 0 WITH HEADER LINE.
include bdcrecx1.
start-of-selection.
********************************************************
UPLOADING THE DATA TO IT_UPLOAD
********************************************************
call function 'GUI_UPLOAD'
exporting
filename = 'C:\DASRR\VENDOR1.TXT'
filetype = 'DAT'
has_field_separator = 'X'
HEADER_LENGTH = 0
READ_BY_LINE = 'X'
DAT_MODE = ' '
CODEPAGE = ' '
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
CHECK_BOM = ' '
IMPORTING
FILELENGTH =
HEADER =
tables
data_tab = IT_UPLOAD
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.
*CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = 'C:/VENDOR1.TXT'
FILETYPE = 'DAT'
TABLES
DATA_TAB = IT_UPLOAD.
CALL FUNCTION 'BDC_OPEN_GROUP'
EXPORTING
CLIENT = SY-MANDT
GROUP = 'SRR'
USER = SY-UNAME.
POPULATE INTERNAL TABL
LOOP AT IT_UPLOAD.
CLEAR IT_BDCDATA.
REFRESH IT_BDCDATA.
PERFORM POPULATE_DATA.
CALL FUNCTION 'BDC_INSERT'
EXPORTING
TCODE = 'XK01'
TABLES
DYNPROTAB = IT_BDCDATA.
ENDLOOP.
&----
*& Form POPULATE_DATA
&----
text
----
--> p1 text
<-- p2 text
----
FORM POPULATE_DATA .
PERFORM GETDATA USING 'X' 'SAPMF02K' '0100'.
perform getdata using ' ' RF02K-LIFNR 'IT_UPLOAD-LIFNR'.
perform getdata using ' ' RF02K-bukrs 'IT_UPLOAD-bukrs'.
perform getdata using ' ' RF02K-EKORG 'IT_UPLOAD-EKORG'.
perform getdata using ' ' RF02K-KTOKK 'IT_UPLOAD-KTOKK'.
PERFORM GETDATA USING 'X' 'SAPMF02K' '0110'.
perform getdata using ' ' LFA1-ANRED 'IT_UPLOAD-ANRED'.
perform getdata using ' ' LFA1-NAME1 'IT_UPLOAD-NAME1'.
perform getdata using ' ' LFA1-SORTL 'IT_UPLOAD-SORTL'.
perform getdata using ' ' LFA1-LAND1 'IT_UPLOAD-LAND1'.
PERFORM GETDATA USING 'X' 'SAPMF02K' '0210'.
perform getdata using ' ' LFB1-AKONT 'IT_UPLOAD-AKONT'.
perform getdata using ' ' LFB1-FDGRV 'IT_UPLOAD-FDGRV'.
PERFORM GETDATA USING 'X' 'SAPMF02K' '0215'.
perform getdata using ' ' LFB1-ZTERM 'IT_UPLOAD-ZTERM'.
PERFORM GETDATA USING 'X' 'SAPMF02K' '0220'.
perform getdata using ' ' LFB5-MAHNA 'IT_UPLOAD-MAHNA'.
PERFORM GETDATA USING 'X' 'SAPMF02K' '0310'.
perform getdata using ' ' LFM1-WAERS 'IT_UPLOAD-WAERS'.
ENDFORM. " POPULATE_DATA
&----
*& Form GETDATA
&----
text
----
-->P_0213 text
-->P_0214 text
-->P_0215 text
----
FORM GETDATA USING VALUE(P_0213)
VALUE(P_0214)
VALUE(P_0215).
IF P_0213 = 'X'.
IT_BDCDATA-PROGRAM = P_0213.
IT_BDCDATA-DYNPRO = P_0214.
IT_BDCDATA-DYNBEGIN = P_0215.
ELSE.
IT_BDCDATA-FNAM = P_0214.
IT_BDCDATA-FVAL = P_0215.
ENDIF.
****************any error in coding just chk it*****************
‎2006 Nov 14 7:02 AM
As I said.. the file type can be either ASCII or BINARY.
So u have to use ASC or BIN.
In this case u will have to use 'ASC' and NOT 'DAT'.
Another thing... the file names are case sensitive... make sure that the file u are trying to open is in proper directory with proper name.
3rd Most Imp. Handle all the exceptions. Uncomment that exceptions part.
Put a break point at the call function 'GUI_UPLOAD' statement.
Press F6 and then check the value of sy-subrc.
It really helps in tracking the exact reason why the file is not uploading.
Please do this and see what the the sy-subrc value u get.
Please respond with the sy-subrc value.
‎2006 Nov 14 5:54 AM
More Important is to know the reason why error is coming.
I assume that the file is a tab delimited file. When u are calling the Function Module, you have not specified that it has a field separator and hence SAP assumes it is a fixed length file.
If you go into the debugging mode u will see at the end of all the fields u will find a #. this # is nothing but a '<i>tab</i>' in Unix system.
And this is the reason u are getting the error - 'Wrong Value of Parameter'.
Your action : There is a parameter to that FM .. has_field_separator. Set that to 'X' and it will work.
PS : Tell me if this was helpful or not.
‎2006 Nov 14 5:58 AM
Just to add to my Post...
generally the flat files are type ASCII so use the file type as 'ASC' .
neways if it works with 'DAT' go ahead.
And most importantly... Make it a habit to handle the Exceptions. Trust me It really helps you to catch the exact error in case the file is not read properly.
‎2006 Nov 14 6:08 AM
Hi, iam not in a position to see the fields in debug mode,b coz iam stopping at the begining of the process only. uploading the file is only the problem to me.
if upload is ok ,then i can go for debug and check the values.
‎2006 Nov 14 6:20 AM
check....
<b>filename = 'C:\VENDOR1.TXT'</b>
filetype = 'ASC'
has_field_separator = 'X'
it is
'C:\VENDOR1.TXT'
not
'C:/VENDOR1.TXT'
‎2006 Nov 14 6:24 AM
I guess the Issue is only with the file name... It is case sensitive and I would suggest you to cross check the name.
If you still dont get it the plz copy the code and I will look at it...