Dear Experts,
I m desiging a program to upload a Purchase Order.
Code is as below.
data bdcdata like bdcdata occurs 0 with header line.
data: begin of record occurs 0 ,
BSART(004),
SUPERFIELD(051),
BEDAT(010),
EKORG(004),
EKGRP(003),
BUKRS(004),
LIST(040),
KNTTP(01),
EMATN(018),
TXZ01(040),
MENGE(017),
KBETR(016),
NAME1(030),
LGOBE(016),
MEINS(003),
WGBEZ(020),
SPINF(001),
REPOS(001),
MWSKZ(002),
WEBRE(001),
end of record.
start-of-selection.
perform upload.
perform open.
loop at record.
perform move.
call transaction 'ME21N' using bdcdata mode 'A'.
refresh bdcdata.
endloop.
perform close.
&----
*& Form MOVE
&----
text
----
--> p1 text
<-- p2 text
----
form move.
****perform open_dataset using dataset.
****perform open_group.
****
****do.
****
****read dataset dataset into record.
****if sy-subrc <> 0. exit. endif.
perform bdc_dynpro using 'SAPLMEGUI' '0014'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'BDC_CURSOR'
'MEPO_TOPLINE-SUPERFIELD'.
perform bdc_field using 'MEPO_TOPLINE-BSART'
record-bsart.
perform bdc_field using 'MEPO_TOPLINE-SUPERFIELD'
record-superfield.
perform bdc_field using 'MEPO_TOPLINE-BEDAT'
record-bedat.
perform bdc_field using 'DYN_6000-LIST'
' 1'.
perform bdc_dynpro using 'SAPLMEGUI' '0014'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
**perform bdc_field using 'MEPO_TOPLINE-BSART'
record-bsart.
**perform bdc_field using 'MEPO_TOPLINE-SUPERFIELD'
record-superfield.
**perform bdc_field using 'MEPO_TOPLINE-BEDAT'
record-bedat.
perform bdc_field using 'BDC_CURSOR'
'MEPO1222-BUKRS'.
perform bdc_field using 'MEPO1222-EKORG'
record-ekorg.
perform bdc_field using 'MEPO1222-EKGRP'
record-ekgrp.
perform bdc_field using 'MEPO1222-BUKRS'
record-bukrs.
perform bdc_field using 'DYN_6000-LIST'
' 1'.
perform bdc_dynpro using 'SAPLMEGUI' '0014'.
perform bdc_field using 'BDC_OKCODE'
'=MEV4001BUTTON'.
perform bdc_field using 'BDC_CURSOR'
'MEPO_TOPLINE-SUPERFIELD'.
perform bdc_field using 'MEPO_TOPLINE-BSART'
record-bsart.
perform bdc_field using 'MEPO_TOPLINE-SUPERFIELD'
record-superfield.
perform bdc_field using 'MEPO_TOPLINE-BEDAT'
record-bedat.
perform bdc_field using 'MEPO1222-EKORG'
record-ekorg.
perform bdc_field using 'MEPO1222-EKGRP'
record-ekgrp.
perform bdc_field using 'MEPO1222-BUKRS'
record-bukrs.
perform bdc_field using 'DYN_6000-LIST'
' 1'.
perform bdc_dynpro using 'SAPLMEGUI' '0014'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'BDC_CURSOR'
'MEPO1211-MENGE(01)'.
perform bdc_field using 'MEPO1211-KNTTP(01)'
record-knttp.
perform bdc_field using 'MEPO1211-TXZ01(01)'
record-txz01.
perform bdc_field using 'MEPO1211-MENGE(01)'
record-menge.
perform bdc_field using 'MEPO1211-MEINS(01)'
record-meins.
perform bdc_field using 'MEPO1211-WGBEZ(01)'
record-wgbez.
perform bdc_field using 'MEPO1211-KBETR(01)'
record-KBETR.
perform bdc_field using 'MEPO1211-NAME1(01)'
record-name1.
perform bdc_field using 'MEPO1211-LGOBE(01)'
record-lgobe.
perform bdc_field using 'DYN_6000-LIST'
' 1'.
perform bdc_dynpro using 'SAPLMEGUI' '0014'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'BDC_CURSOR'
'KOMV-KBETR(01)'.
perform bdc_field using 'BDC_CURSOR'
'KOMV-KBETR(01)'.
perform bdc_field using 'KOMV-KBETR(01)'
record-kbetr.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'DYN_6000-LIST'
' 1'.
perform bdc_field using 'BDC_CURSOR'
'MEPO1317-MWSKZ'.
perform bdc_field using 'MEPO1317-REPOS'
'X'.
perform bdc_field using 'MEPO1317-MWSKZ'
'I0'.
perform bdc_field using 'MEPO1317-MWSKZ'
record-kbetr.
perform bdc_field using 'MEPO1317-MWSKZ'
record-kbetr.
perform bdc_field using 'MEPO1317-MWSKZ'
'I0'.
endform. "move
----
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
&----
*& Form UPLOAD
&----
text
----
--> p1 text
<-- p2 text
----
form upload.
call function 'UPLOAD'
exporting
CODEPAGE = ''
filename = ''
filetype = 'DAT'
item = 'C:\test.dat'
FILEMASK_MASK = ' '
FILEMASK_TEXT = ' '
FILETYPE_NO_CHANGE = ' '
FILEMASK_ALL = ' '
FILETYPE_NO_SHOW = ' '
LINE_EXIT = ' '
USER_FORM = ' '
USER_PROG = ' '
SILENT = 'S'
IMPORTING
FILESIZE =
CANCEL =
ACT_FILENAME =
ACT_FILETYPE =
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.
endform. "upload
----
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 CLOSE
&----
text
----
--> p1 text
<-- p2 text
----
form close.
call function 'BDC_CLOSE_GROUP'
EXCEPTIONS
not_open = 1
queue_error = 2
others = 3.
if sy-subrc <> 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.
endform. " CLOSE
&----
*& Form OPEN
&----
text
----
--> p1 text
<-- p2 text
----
form open.
call function 'BDC_OPEN_GROUP'
exporting
client = sy-mandt
DEST = FILLER8
group = 'ZDESIGCAT_R'
HOLDDATE = FILLER8
KEEP = FILLER1
user = sy-uname
RECORD = FILLER1
IMPORTING
QID =
exceptions
client_invalid = 1
destination_invalid = 2
group_invalid = 3
group_is_locked = 4
holddate_invalid = 5
internal_error = 6
queue_error = 7
running = 8
system_lock_error = 9
user_invalid = 10
others = 11
.
if sy-subrc <> 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.
endform. " OPEN
Now the problem is when i run this program everything is fine except tax code.
problem is somewhere in following code.
perform bdc_field using 'MEPO1317-MWSKZ'
'I0'.
perform bdc_field using 'MEPO1317-MWSKZ'
record-kbetr.
perform bdc_field using 'MEPO1317-MWSKZ'
record-kbetr.
perform bdc_field using 'MEPO1317-MWSKZ'
'I0'.
Can any one help n this.