2007 Mar 13 11:40 AM
Hi All
In T-code ME22, i want to change netprice. i am uploading the data from a flat file.
not good with BDC, its given me errro msg
Call_transcation M22 Returncode = 1,001 Record 0
E formatting error in the field RMO6e-EBELP see next msg
E input should be in the form _________
***********
My code is
report ZME22_BDC
no standard page heading line-size 255.
include bdcrecx1.
parameters: dataset(132) lower case.
DO NOT CHANGE - the generated data section - DO NOT CHANGE ***
*
If it is nessesary to change the data section use the rules:
1.) Each definition of a field exists of two lines
2.) The first line shows exactly the comment
'* data element: ' followed with the data element
which describes the field.
If you don't have a data element use the
comment without a data element name
3.) The second line shows the fieldname of the
structure, the fieldname must consist of
a fieldname and optional the character '_' and
three numbers and the field length in brackets
4.) Each field must be type C.
*
Generated data section with specific formatting - DO NOT CHANGE ***
data: begin of record occurs 0,
data element: BSTNR
BSTNR_001(010),
data element: AUFEP
EBELP_002(005),
end of record.
End generated data section ***
start-of-selection.
*perform open_dataset using dataset.
*perform open_group.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = 'C:\test.txt'
FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = ''
HEADER_LENGTH = 0
READ_BY_LINE = 'X'
DAT_MODE = ' '
CODEPAGE = ' '
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
CHECK_BOM = ' '
NO_AUTH_CHECK = ' '
IMPORTING
FILELENGTH =
HEADER =
TABLES
DATA_TAB = record
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.
*do.
*read dataset dataset into record.
loop at record.
if sy-subrc <> 0. exit. endif.
perform bdc_dynpro using 'SAPMM06E' '0105'.
perform bdc_field using 'BDC_CURSOR'
'RM06E-BSTNR'.
perform bdc_field using 'BDC_OKCODE'
'=AB'.
perform bdc_field using 'RM06E-BSTNR'
record-BSTNR_001.
perform bdc_dynpro using 'SAPMM06E' '0120'.
perform bdc_field using 'BDC_CURSOR'
'RM06E-EBELP'.
perform bdc_field using 'BDC_OKCODE'
'=BACK'.
perform bdc_field using 'RM06E-EBELP'
record-EBELP_002.
perform bdc_transaction using 'ME22'.
*enddo.
endloop.
*perform close_group.
perform close_dataset using dataset.
2007 Mar 13 11:44 AM
Run the BDC in foreground and check the field record-EBELP_002 from your file.
The current format of the field is incompatible to to your settings with the corresponding field.
May be u have taken different data types for both or different format then EBELP in ME22.
Regards,
Amit
Reward all helpful replies.
2007 Mar 13 11:42 AM
Hello AJ,
Make this change in ur code:
data: lv_bstnr(010).
write: record-BSTNR_001 to lv_BSTNR. " Check here
perform bdc_field using 'RM06E-BSTNR'
LV_BSTNR." Check here
If useful reward.
Vasanth
2007 Mar 13 11:43 AM
This is because of the format error in the line item number. Check the value and format of EBELP in the internal table (all the line items) and fix it accordingly.
Naveen
2007 Mar 13 11:44 AM
Run the BDC in foreground and check the field record-EBELP_002 from your file.
The current format of the field is incompatible to to your settings with the corresponding field.
May be u have taken different data types for both or different format then EBELP in ME22.
Regards,
Amit
Reward all helpful replies.
2007 Mar 13 12:00 PM
Hi Amit
Can any body provide with the source code for same.
thanks in advance
rgds
AJ