‎2008 Apr 09 8:46 PM
hii friends,
i have written this bdc program to upload the address data from flat file to the sap system but whenever i process the session i get the result like W_MAT-NAME,W_MAT-STREET etc instead of the data in the flat file.
i have pasted my program here..plzz site the error.
report ZADDRESS1
no standard page heading line-size 255.
TABLES : ztable.
include bdcrecx1.
DATA : BEGIN OF ITAB,
NAME like ztable-name,
street LIKE ZTABLE-STREET,
MOBILE LIKE ZTABLE-MOBILE,
FIXED LIKE ZTABLE-FIXEDLINE,
CITY LIKE ZTABLE-CITY,
STATE LIKE ZTABLE-STATE,
COUNTRY LIKE ZTABLE-COUNTRY,
MAIL LIKE ztable-email,
END OF ITAB.
data : i_mat type table of ITAB.
data : w_mat type ITAB.
start-of-selection.
call function 'UPLOAD'
EXPORTING
CODEPAGE = ' '
FILENAME = ' '
FILETYPE = 'ASC'
HEADLEN = ' '
LINE_EXIT = ' '
TRUNCLEN = ' '
USER_FORM = ' '
USER_PROG = ' '
DAT_D_FORMAT = ' '
IMPORTING
FILELENGTH =
tables
data_tab = I_MAT
EXCEPTIONS
CONVERSION_ERROR = 1
FILE_OPEN_ERROR = 2
FILE_READ_ERROR = 3
INVALID_TYPE = 4
NO_BATCH = 5
UNKNOWN_ERROR = 6
INVALID_TABLE_WIDTH = 7
GUI_REFUSE_FILETRANSFER = 8
CUSTOMER_ERROR = 9
NO_AUTHORITY = 10
OTHERS = 11
.
if sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
perform open_group.
LOOP AT I_MAT INTO w_mat.
perform bdc_dynpro using 'ZADDRESS' '0100'.
perform bdc_field using 'BDC_OKCODE'
'=S'.
perform bdc_field using 'BDC_CURSOR'
'ZTABLE-EMAIL'.
perform bdc_field using 'ZTABLE-NAME'
'W_MAT-NAME'.
perform bdc_field using 'ZTABLE-STREET'
'W_MAT-STREET'.
perform bdc_field using 'ZTABLE-MOBILE'
'W_MAT-MOBILE'.
perform bdc_field using 'ZTABLE-FIXEDLINE'
'W_MAT_FIXED'.
perform bdc_field using 'ZTABLE-CITY'
'W_MAT-CITY'.
perform bdc_field using 'ZTABLE-STATE'
'W_MAT-STATE'.
perform bdc_field using 'ZTABLE-COUNTRY'
'W_MAT-COUNTRY'.
perform bdc_field using 'ZTABLE-EMAIL'
'W_MAT-MAIL'.
perform bdc_dynpro using 'ZADDRESS' '0100'.
perform bdc_field using 'BDC_OKCODE'
'=E'.
perform bdc_field using 'BDC_CURSOR'
'ADDRESS'.
perform bdc_field using 'ZTABLE-NAME'
'W_MAT-NAME'.
perform bdc_field using 'ZTABLE-STREET'
'W_MAT-STREET'.
perform bdc_field using 'ZTABLE-MOBILE'
'W_MAT-MOBILE'.
perform bdc_field using 'ZTABLE-FIXEDLINE'
'W_MAT-FIXED'.
perform bdc_field using 'ZTABLE-CITY'
'W_MAT-CITY'.
perform bdc_field using 'ZTABLE-STATE'
'W_MAT-STATE'.
perform bdc_field using 'ZTABLE-COUNTRY'
'W_MAT-COUNTRY'.
perform bdc_field using 'ZTABLE-EMAIL'
'W_MAT-MAIL'.
perform bdc_transaction using 'ZADD'.
ENDLOOP.
perform close_group.
thanks in adv
abhinab
‎2008 Apr 09 8:55 PM
The problem is this
perform bdc_field using 'ZTABLE-NAME'
'W_MAT-NAME'.
You are always passing literals, not variables.
This is the way you want to do it.
perform bdc_field using ZTABLE-NAME
W_MAT-NAME.
By the way, I don't see any filename in that function, what are you reading?
‎2008 Apr 09 8:55 PM
The problem is this
perform bdc_field using 'ZTABLE-NAME'
'W_MAT-NAME'.
You are always passing literals, not variables.
This is the way you want to do it.
perform bdc_field using ZTABLE-NAME
W_MAT-NAME.
By the way, I don't see any filename in that function, what are you reading?
‎2008 Apr 09 8:56 PM
Don't use any quotes for your w_mat fields:
W_MAT-NAME in stead of 'W_MAT-NAME'.
‎2008 Apr 09 8:57 PM
You are passing all the parameters as Constants to the PERFORM.
perform bdc_field using 'BDC_CURSOR'
'ZTABLE-EMAIL'.
perform bdc_field using 'ZTABLE-NAME'
'W_MAT-NAME'.
Dont pass them as constants.
Regards,
Amit
‎2008 Apr 09 8:57 PM
By this:
perform bdc_field using 'ZTABLE-NAME'
'W_MAT-NAME'.
W_MAT-NAME is in quotes so it is seen like the text: w_mat-name.
Regards,
Bert
‎2008 Apr 09 8:58 PM
Hi Abhinab Mishra ,
In your program you had placed the variable inside the quotes like this :
perform bdc_field using 'ZTABLE-NAME'
'W_MAT-NAME'.
this needs to be corrected like this :
perform bdc_field using 'ZTABLE-NAME'
W_MAT-NAME.
Hope this solves your problem.
Thanks,
Greetson
‎2008 Apr 09 9:08 PM