HI EXPECTS,
PLEASE HELP ME SOLVING THIS PROBLEM, IT IS NOT UPLOADING THE TO INTERNAL TABLE AND TO TRANSACTION 'MI01'.PLEASE HELP ME SOLVING THE PROBLEM.
types : begin of ty_upload ,
werks type ikpf-werks,
lgort type ikpf-lgort,
matnr type iseg-matnr,
end of ty_upload.
parameters: p_file type localfile obligatory.
data:t_upload type standard table of ty_upload initial size 0,
*internal table for bdcdata.
t_bdcdata type standard table of bdcdata initial size 0 ,
*internal table for bdcmsgcoll.
t_bdcmsgcoll type standard table of bdcmsgcoll initial size 0,
t_error type standard table of ty_upload initial size 0,
w_upload type ty_upload,
w_file type string,
bdcdata type bdcdata,
w_bdcmsg type bdcmsgcoll,
*global variable declaration.
g_message(70) type c.
at selection-screen on value-request for p_file.
call function 'F4_FILENAME'
exporting
program_name = syst-cprog
dynpro_number = syst-dynnr
importing
file_name = p_file.
start-of-selection.
w_file = p_file.
call function 'GUI_UPLOAD'
exporting
filename = w_file
filetype = 'ASC'
has_field_separator = 'X'
tables
data_tab = t_upload.
check sy-subrc = 0.
call function 'BDC_OPEN_GROUP'
exporting
client = sy-mandt
group = 'ERROR_MAT'
user = sy-uname
prog = sy-cprog.
check sy-subrc = 0.
loop at t_upload into w_upload.
refresh t_bdcdata.
perform bdc_dynpro using 'SAPMM07I' '0700'.
perform bdc_field using 'BDC_CURSOR'
'IKPF-LGORT'.
perform bdc_field using 'BDC_OKCODE' '/00'.
perform bdc_field using 'IKPF-WERKS'
'W_UPLOAD-WERKS'.
perform bdc_field using 'IKPF-LGORT'
'W_UPLOAD-LGORT'.
perform bdc_field using 'RM07I-XLVOCA'
'X'.
perform bdc_dynpro using 'SAPMM07I' '0721'.
perform bdc_field using 'BDC_CURSOR'
'ISEG-MATNR(02)'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'ISEG-MATNR(01)'
'W_UPLOAD-MATNR(01)'.
*perform bdc_field using 'ISEG-MATNR(02)'
perform bdc_dynpro using 'SAPMM07I' '0721'.
perform bdc_field using 'BDC_CURSOR'
'ISEG-MATNR(01)'.
perform bdc_field using 'BDC_OKCODE'
'=BU'.
call transaction 'MI01' using t_bdcdata mode 'N' update 'S'
messages into t_bdcmsgcoll.
if sy-subrc = 0.
call function 'BDC_INSERT'
exporting
tcode = 'MI01'
tables
dynprotab = t_bdcdata.
endif.
clear w_bdcmsg.
read table t_bdcmsgcoll into w_bdcmsg index 1.
call function 'FORMAT_MESSAGE'
exporting
id = w_bdcmsg-msgid
lang = sy-langu
no = w_bdcmsg-msgnr
v1 = w_bdcmsg-msgv1
v2 = w_bdcmsg-msgv2
v3 = w_bdcmsg-msgv3
v4 = w_bdcmsg-msgv4
importing
msg = g_message
exceptions
not_found = 1
others = 2.
if sy-subrc = 0.
write:/ w_upload-werks,'----', g_message.
refresh t_bdcmsgcoll.
endif.
endloop.
call function 'BDC_CLOSE_GROUP'.
----------------------------------------------------------------------
start new screen
----------------------------------------------------------------------
form bdc_dynpro using program dynpro.
clear bdcdata.
bdcdata-program = program.
bdcdata-dynpro = dynpro.
bdcdata-dynbegin = 'X'.
append bdcdata to t_bdcdata.
clear bdcdata.
endform. "
--------------------------------------------------------------------
*insert field *
*----
form bdc_field using fnam fval.
IF fval NODATA.
clear bdcdata.
bdcdata-fnam = fnam.
bdcdata-fval = fval.
append bdcdata to t_bdcdata.
clear bdcdata.
ENDIF.
endform. "
FLAT FILE
PLANT SLOC MATL
KCPT SLC1 689
KCPT SLC1 690