‎2007 Dec 22 5:19 AM
Hi Experts,
I have made a bdc of Tcode j1id.when i m loading data in it,it is taking date in this format: 20.03.0112 when i m putting date as 12.01.2003.I have declared an itab.
Data:begin of itab occurs 0,
MATNR type J_1IMTCHID-MATNR,
WERKS type J_1IMTCHID-WERKS,
J_1ICHID TYPE J_1IMTCHID-J_1ICHID,
J_1ISUBIND type J_1IMTCHID-J_1ISUBIND,
J_1ICAPIND TYPE J_1IMTCHID-J_1ICAPIND,
J_1IGRXREF TYPE J_1IMTCHID-J_1IGRXREF,
J_1IDECFLAG type J_1IMTCHID-J_1IDECFLAG,
J_1IDECDATE type J_1IMTCHID-J_1IDECDATE,
end of itab.
please suggest me what to do.
‎2007 Dec 22 5:21 AM
hi,
declare your field like this
J_1IDECDATE(10), and thats it,ur problem will be solved
‎2007 Dec 22 5:21 AM
hi,
declare your field like this
J_1IDECDATE(10), and thats it,ur problem will be solved
‎2007 Dec 22 5:45 AM
‎2007 Dec 22 5:27 AM
I guess u have not done this BDC thru SHDB recording......
Through SHDB it takes all the parameters in Character Format(Type C) to avoid type mismatch.....Just try the recording thru SHDB once again or Declare the type for that field as TYPE c size 10...do the same for other fields also....delcare all the fields of type c and size equivalent to the default size of the actal type.
‎2007 Dec 22 5:31 AM
For Ex:
data: begin of st_record1 ,
budat_002(010),
bktxt_004(025),
matnr_005(018),
werks_006(004),
alort_007(004),
erfmg_007(017),
erfmg_008(017),
end of st_record1.
The size of each field is equivalent to the actual size....this wont lead to any errror.
‎2007 Dec 22 6:56 AM
hi Sharma,
For that, just after the upload of flat file into ur ITAB
copy this code this will help u.
means after 'CALL FUNCTION 'GUI_UPLOAD' "
(below code part has to copy in this region in the program)
and before the actual BDC start.
*******************************************
data: date1(8),
date2(8),
len type i,
x type i,
y(2),
month(2),
day(2).
loop at itab.
date1 = itab-J_1IDECDATE.
len = 6.
x = 2.
do 4 times.
move date1+len(x) to y.
concatenate date2 y into date2.
len = len - 2.
clear y.
enddo.
month = date2+4(2).
day = date2+6(2).
date2+4(2) = day.
date2+6(2) = month.
itab-J_1IDECDATE = date2.
modify itab transporting J_1IDECDATE.
endloop.
******************************************************
OR
otherwise u can simply use this code this will serve ur purpose...
*************************************************************
report ZNM_SAMAPLE_SDN
no standard page heading line-size 255.
parameters : R1 radiobutton group r,
R2 radiobutton group r.
DATA: bdcdata LIKE bdcdata OCCURS 0 WITH HEADER LINE.
DATA: messtab LIKE bdcmsgcoll OCCURS 0 WITH HEADER LINE.
data: begin of record OCCURS 0,
MATNR_01_003(018),
WERKS_01_004(004),
J_1ICHID_01_005(012),
J_1ISUBIND_01_006(001),
J_1ICAPIND_01_007(001),
J_1IGRXREF_01_008(001),
J_1IDECFLAG_01_009(001),
J_1IDECDATE_01_010(010),
end of record.
DATA: opt TYPE ctu_params.
start-of-selection.
REFRESH: RECORD,bdcdata,messtab.
CLEAR : RECORD,bdcdata,messtab,opt.
if r1 = 'X'.
OPT-DISMODE = 'A'.
OPT-UPDMODE = 'S'.
else.
OPT-DISMODE = 'N'.
OPT-UPDMODE = 'S'.
endif.
opt-dismode = 'A'.
opt-updmode = 'S'.
CALL FUNCTION 'UPLOAD'
EXPORTING
CODEPAGE = ' '
filename = ' '
filetype = 'DAT'
TABLES
data_tab = RECORD
EXCEPTIONS
CONVERSION_ERROR = 1
INVALID_TABLE_WIDTH = 2
INVALID_TYPE = 3
NO_BATCH = 4
UNKNOWN_ERROR = 5
GUI_REFUSE_FILETRANSFER = 6
OTHERS = 7
.
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 RECORD.
perform bdc_dynpro using 'SAPMJ1ID' '0200'.
perform bdc_field using 'BDC_CURSOR'
'RB1'.
perform bdc_field using 'BDC_OKCODE'
'=EX'.
perform bdc_field using 'RB11'
' '.
perform bdc_field using 'RB1'
'X'.
perform bdc_dynpro using 'SAPLJ1I5' '0020'.
perform bdc_field using 'BDC_CURSOR'
'J_1IMTCHID-MATNR(01)'.
perform bdc_field using 'BDC_OKCODE'
'=NEWL'.
perform bdc_dynpro using 'SAPLJ1I5' '0020'.
perform bdc_field using 'BDC_CURSOR'
'J_1IMTCHID-J_1IDECDATE(01)'.
perform bdc_field using 'BDC_OKCODE'
'=SAVE'.
perform bdc_field using 'J_1IMTCHID-MATNR(01)'
record-MATNR_01_003.
perform bdc_field using 'J_1IMTCHID-WERKS(01)'
record-WERKS_01_004.
perform bdc_field using 'J_1IMTCHID-J_1ICHID(01)'
record-J_1ICHID_01_005.
perform bdc_field using 'J_1IMTCHID-J_1ISUBIND(01)'
record-J_1ISUBIND_01_006.
perform bdc_field using 'J_1IMTCHID-J_1ICAPIND(01)'
record-J_1ICAPIND_01_007.
perform bdc_field using 'J_1IMTCHID-J_1IGRXREF(01)'
record-J_1IGRXREF_01_008.
perform bdc_field using 'J_1IMTCHID-J_1IDECFLAG(01)'
record-J_1IDECFLAG_01_009.
perform bdc_field using 'J_1IMTCHID-J_1IDECDATE(01)'
record-J_1IDECDATE_01_010.
perform bdc_dynpro using 'SAPLJ1I5' '0020'.
perform bdc_field using 'BDC_CURSOR'
'J_1IMTCHID-MATNR(02)'.
perform bdc_field using 'BDC_OKCODE'
'=SAVE'.
perform bdc_dynpro using 'SAPLJ1I5' '0020'.
perform bdc_field using 'BDC_CURSOR'
'J_1IMTCHID-MATNR(02)'.
perform bdc_field using 'BDC_OKCODE'
'=BACK'.
perform bdc_dynpro using 'SAPLJ1I5' '0020'.
perform bdc_field using 'BDC_CURSOR'
'J_1IMTCHID-MATNR(02)'.
perform bdc_field using 'BDC_OKCODE'
'=SAVE'.
perform bdc_dynpro using 'SAPLJ1I5' '0020'.
perform bdc_field using 'BDC_CURSOR'
'J_1IMTCHID-MATNR(02)'.
perform bdc_field using 'BDC_OKCODE'
'=BACK'.
perform bdc_dynpro using 'SAPMJ1ID' '0200'.
perform bdc_field using 'BDC_OKCODE'
'/EEXIT'.
perform bdc_field using 'BDC_CURSOR'
'EXCISE'.
REFRESH messtab.CLEAR messtab.
CALL TRANSACTION 'J1ID' USING bdcdata
OPTIONS FROM opt
MESSAGES INTO messtab.
REFRESH bdcdata.CLEAR bdcdata.
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 <> '' OR fval > 0.
CLEAR bdcdata.
bdcdata-fnam = fnam.
bdcdata-fval = fval.
APPEND bdcdata.
ENDIF.
ENDFORM. "BDC_FIELDF
*******************************************************
I hope this info. is useful to u..
if not ask me with out hesitation...
Awrd point plzz
Regards,
Naveen M