Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

ERROR IN BDC PROGRAM FOR MI01

Former Member
0 Kudos
112

HI EXPERTS,

i am getting the problem in upload the data from the flat file. it is not upload the data.please help me,kindly it is urgent.

REPORT ZMM_RDD0010_MATERIAL_INVENTORY no standard page heading

line-size 255 .

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. "

TEXT FILE

KCPT SLC2 697

3 REPLIES 3

Former Member
0 Kudos
83

Hi,

The mistake is :

perform bdc_field using 'IKPF-LGORT'

*'W_UPLOAD-LGORT' *.

Remove the single quote for 'W_UPLOAD-LGORT.It is taking it as hard coded value.

Former Member
0 Kudos
83

Hi,

Remove has_field_separator = 'X' and test it.

Otherwise use filetype = 'DAT'

Thanks,

Durai.V

Former Member
0 Kudos
83

Hi, in this FM pass p_file instead of w_file

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

filename = p_file

filetype = 'ASC'

has_field_separator = 'X'

TABLES

data_tab = t_upload.