05-10-2006 2:11 AM
hi all,
i'm trying to do BDC using transaction ME11. In my text file I have values for only matnr, idnlf(vendor part no) and netpr. The rest of the fields like VendorId,ekorg etc remain the same for all records. this is the code i wrote. The error says "please check units of measure and conversion factor".
This is the textfile.
1095,0130359513,55.97
1096,0130359688,55.97
1098,0328030155,19.50
report ZME11PRG
no standard page heading line-size 255.
DATA : BEGIN OF tbl_in OCCURS 0,
matnr like mara-matnr,
idnlf like eina-idnlf,
netpr like eine-netpr,
vfrom like RV13A-DATAB,
vto like RV13A-DATBI,
END OF tbl_in.
DATA : BEGIN OF i_file OCCURS 0,
file(45),
END OF i_file.
data : file type string.
Batchinputdata of single transaction
DATA: bdcdata LIKE bdcdata OCCURS 0 WITH HEADER LINE.
DATA: messtab LIKE bdcmsgcoll OCCURS 0 WITH HEADER LINE.
PARAMETERS : p_file LIKE rlgrap-filename.
move p_file to file.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = file
FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = ' '
HEADER_LENGTH = 0
READ_BY_LINE = 'X'
DAT_MODE = ' '
CODEPAGE = ' '
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
CHECK_BOM = ' '
IMPORTING
FILELENGTH =
HEADER =
TABLES
data_tab = i_file
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.
LOOP AT i_file.
MOVE : i_file-file+0(4) TO tbl_in-matnr,
i_file-file+5(10) TO tbl_in-idnlf,
i_file-file+16(5) TO tbl_in-netpr.
i_file-file+22(8) TO tbl_in-vfrom,
i_file-file+31(8) TO tbl_in-vto.
APPEND tbl_in.
CLEAR tbl_in.
ENDLOOP.
LOOP AT tbl_in.
perform bdc_dynpro using 'SAPMM06I' '0100'.
perform bdc_field using 'BDC_CURSOR'
'EINA-LIFNR'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'EINA-LIFNR'
'TESTVEN1'.
perform bdc_field using 'EINA-MATNR'
tbl_in-matnr.
perform bdc_field using 'EINE-EKORG'
'1000'.
perform bdc_field using 'RM06I-NORMB'
'X'.
perform bdc_dynpro using 'SAPMM06I' '0101'.
perform bdc_field using 'BDC_CURSOR'
'EINA-IDNLF'.
perform bdc_field using 'BDC_OKCODE'
'=EINE'.
perform bdc_field using 'EINA-IDNLF'
tbl_in-idnlf.
perform bdc_field using 'EINA-URZLA'
'US'.
perform bdc_field using 'EINA-REGIO'
'NV'.
perform bdc_field using 'EINA-MEINS'
'EA'.
perform bdc_field using 'EINA-UMREZ'
'1'.
perform bdc_field using 'EINA-UMREN'
'1'.
perform bdc_dynpro using 'SAPMM06I' '0102'.
perform bdc_field using 'BDC_CURSOR'
'EINE-NETPR'.
perform bdc_field using 'BDC_OKCODE'
'=BU'.
perform bdc_field using 'EINE-APLFZ'
'60'.
perform bdc_field using 'EINE-EKGRP'
'017'.
perform bdc_field using 'EINE-NORBM'
'1'.
perform bdc_field using 'EINE-IPRKZ'
'D'.
perform bdc_field using 'EINE-NETPR'
tbl_in-netpr.
perform bdc_field using 'EINE-WAERS'
'USD'.
perform bdc_field using 'EINE-PEINH'
'1'.
perform bdc_field using 'EINE-BPRME'
'EA'.
perform bdc_field using 'EINE-BPUMZ'
'1'.
perform bdc_field using 'EINE-BPUMN'
'1'.
perform bdc_transaction using 'ME11'.
endloop.
----
Start new screen *
----
FORM bdc_dynpro USING program dynpro.
CLEAR bdcdata.
bdcdata-program = program.
bdcdata-dynpro = dynpro.
bdcdata-dynbegin = 'X'.
APPEND bdcdata.
ENDFORM. "BDC_DYNPRO
----
Insert field *
----
FORM bdc_field USING fnam fval.
IF fval <> space.
CLEAR bdcdata.
bdcdata-fnam = fnam.
bdcdata-fval = fval.
APPEND bdcdata.
ENDIF.
ENDFORM. "BDC_FIELD
&----
*& Form bdc_transaction
&----
text
----
-->P_0205 text
----
----
Start new transaction according to parameters *
----
FORM bdc_transaction USING tcode.
DATA: l_mstring(480).
DATA: l_subrc LIKE sy-subrc.
CALL TRANSACTION tcode USING bdcdata
MODE 'A'
UPDATE 'S'
MESSAGES INTO messtab.
l_subrc = sy-subrc.
REFRESH bdcdata.
ENDFORM. " bdc_transaction
Thanks in advance.
05-10-2006 3:56 AM
Hi,
U comment the line in the program where u r passing the UOM as 'EA'.
As , u are not passing to that firld through the file.
just comment all the fields which u are not passing through thew file.
Let the system take it what ever the default is available.
Revert and tell me what happened.
Cheers,
Simha.
05-10-2006 2:36 AM
have a look at mm03->additional data->units of measure... maybe your material does not have 'EA' set up??
05-10-2006 2:49 AM
i setup it up in MARA and it is defaulted from the mat master record in the screen.
05-10-2006 3:26 AM
Hi Lathika,
Where exactly did you get the error. If none of the records were updated in system, there is probably issue with the UOM that you are using. Did you try manually updating 1 record from your input file using tcode ME11. You should have faced similar error there. Hope this will give you some idea!!
Cheers,
Vikram.
Pls reward helpful replies.
05-10-2006 3:56 AM
Hi,
U comment the line in the program where u r passing the UOM as 'EA'.
As , u are not passing to that firld through the file.
just comment all the fields which u are not passing through thew file.
Let the system take it what ever the default is available.
Revert and tell me what happened.
Cheers,
Simha.
05-10-2006 4:34 AM
HI
GOOD
IN RECORDING WHAT ARE VALUE YOU R ENTERING ACCORDINGLY YOU HAVE TO TAKE THE VALUE IN THE TEXT FILE AND THERE SHOULD BE ONE TAB SPACE BETWEEN TWO VALUES IN THE TEXT FILE THERE SHOULD NOT BE ANY COMMA BETWEEN TWO VALUES.
CHECK THESE OUT AND TRY THE RECORDING AGAIN.
THANKS
MRUTYUN
05-10-2006 4:50 AM
while doing bdc mapping, u need to convert date, quantity fields to character type and then map.