BDC to call transaction
Hi,
How to write a code to call transaction from BDC?
hi,
*& Report ZMATERIAL
*& *& Description : Master Data Upload for material type FERT
report zmaterial_fert.
selection-screen :begin of block bl1 with frame title text-001.
parameters : p_fname type rlgrap-filename,
p_lgort type rlgrap-filename,
p_update(1) default 'N',
p_bdcgrp(12) default 'MM_MASTER'.
selection-screen end of block bl1.
data: v_chr_opengrp type c,
r_matnr like mara-matnr,
r_werks like marc-werks,
v_str_fname type string.
data : begin of bdc_itab occurs 0.
include structure bdcdata.
data : end of bdc_itab.
data: begin of messtab occurs 0.
include structure bdcmsgcoll.
data: end of messtab.
data: begin of count,
inrec(9) type n, " input I_MATERIAL count
create(9) type n, " create count
error(9) type n, " error count
bdc(9) type n, " count of BDC creates
end of count.
data : begin of i_material occurs 0,
matnr(018) type c, "Material number
mbrsh(001) type c, "Industry sector
mtart(004) type c, "Material type
werks(004) type c, "Plant
lgort(004),
lgnum(004),
vkorg(004),
vtweg(002),
mtpos_mara(004),
spart(002),
dwerk(004),
taxkm(001),
versg(001),
MTPOS(004),
maktx(040) type c, "Material description
meins(003) type c, "Base unit of measure
matkl(009) type c, "Material group
bismt(018), "old material code
brgew(017) type c, "Gross weight
gewei(003) type c, "Weight unit
ntgew(017) type c, "Net weight
magrv(004) type c, "Matl grp pack matls
tragr(004), "
ladgr(004),
prctr(007),
EKGRP(004),
EKWSL(004),
chap(012),
mattype(001),
nogrs(001),
outmat(018),
valid(010),
curr(005),
netdeal(018),
asess(018),
disgr(004),
dismm(002) type c,
dispo(003),
LGORT(004),
disls(002),
maabc(001),
lgpro(004),
webaz(003),
lgfsb(004),
plifz(003),
STRGR(002),
fhori(003),
sfepr(004),
fevor(003),
sfcpf(006),
beskz(001),
perkz(001),
VRMOD(001),
VINT1(003),
VINT2(003),
ALTSL(001),
SBDKZ(001),
FERVOR(002),
SFCPF(006),
stprs(015),
AWSLS(006),
mtvfp(002),
STGRP(002),
*PRCTR(007),
bklas(004),
vprsv(001),
peinh(006),
*EKALR(015),
verpr(015),
hrkft(002),
*HKMAT,
kosgr(010),
*LOSGR(018),
end of i_material.
at selection-screen on value-request for p_fname.
call function 'KD_GET_FILENAME_ON_F4'
exporting
program_name = 'Z_MM_MATERIAL_UPLOAD'
dynpro_number = '1000'
field_name = 'P_FNAME'
changing
file_name = p_fname.
at selection-screen on value-request for p_lgort.
call function 'KD_GET_FILENAME_ON_F4'
exporting
program_name = 'ZMATERIAL'
dynpro_number = '1000'
field_name = 'P_FNAME'
changing
file_name = p_lgort.
start-of-selection.
if p_fname is initial.
message i016(rp) with 'Please enter a file name'.
leave list-processing.
else.
move p_fname to v_str_fname.
endif.
call function 'GUI_UPLOAD'
exporting
filetype = 'ASC'
filename = v_str_fname
has_field_separator = 'X'
tables
data_tab = i_material
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_material.
r_matnr = i_material-matnr.
r_werks = i_material-werks.
add 1 to count-inrec.
perform bdc_dynpro using 'SAPLMGMM' '0060'.
perform bdc_field using 'BDC_CURSOR'
'RMMG1-MATNR'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'RMMG1-MATNR'
i_material-matnr.
perform bdc_field using 'RMMG1-MTART'
i_material-mtart.
perform bdc_field using 'RMMG1-MBRSH'
i_material-mbrsh.
perform bdc_dynpro using 'SAPLMGMM' '0070'.
perform bdc_field using 'BDC_CURSOR'
'MSICHTAUSW-DYTXT(17)'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'MSICHTAUSW-KZSEL(01)'
'X'.
perform bdc_field using 'MSICHTAUSW-KZSEL(02)'
'X'.
perform bdc_field using 'MSICHTAUSW-KZSEL(03)'
'X'.
*PERFORM BDC_FIELD USING 'MSICHTAUSW-KZSEL(07)'
*'X'.
perform bdc_field using 'MSICHTAUSW-KZSEL(08)'
'X'.
perform bdc_field using 'MSICHTAUSW-KZSEL(05)'
'X'.
perform bdc_field using 'MSICHTAUSW-KZSEL(06)'
'X'.
perform bdc_field using 'MSICHTAUSW-KZSEL(04)'
'X'.
perform bdc_field using 'MSICHTAUSW-KZSEL(09)'
'X'.
perform bdc_field using 'MSICHTAUSW-KZSEL(10)'
'X'.
perform bdc_field using 'MSICHTAUSW-KZSEL(11)'
'X'.
*PERFORM BDC_FIELD USING 'MSICHTAUSW-KZSEL(12)'
*'X'.
perform bdc_field using 'MSICHTAUSW-KZSEL(13)'
'X'.
perform bdc_field using 'MSICHTAUSW-KZSEL(14)'
'X'.
perform bdc_field using 'MSICHTAUSW-KZSEL(15)'
'X'.
perform bdc_field using 'MSICHTAUSW-KZSEL(16)'
'X'.
perform bdc_field using 'MSICHTAUSW-KZSEL(17)'
'X'.
perform bdc_field using 'BDC_OKCODE' '=P+'.
perform bdc_dynpro using 'SAPLMGMM' '0070'.
perform bdc_field using 'BDC_CURSOR'
'MSICHTAUSW-DYTXT(07)'.
perform bdc_field using 'MSICHTAUSW-KZSEL(01)'
'X'.
perform bdc_field using 'MSICHTAUSW-KZSEL(02)'
'X'.
perform bdc_field using 'MSICHTAUSW-KZSEL(03)'
'X'.
perform bdc_field using 'MSICHTAUSW-KZSEL(04)'
'X'.
perform bdc_field using 'MSICHTAUSW-KZSEL(05)'
'X'.
perform bdc_dynpro using 'SAPLMGMM' '0080'.
perform bdc_field using 'BDC_CURSOR'
'RMMG1-LGNUM'.
perform bdc_field using 'BDC_OKCODE'
'=ENTR'.
perform bdc_field using 'RMMG1-WERKS'
i_material-werks.
perform bdc_field using 'RMMG1-LGORT'
i_material-lgort.
perform bdc_field using 'RMMG1-LGNUM'
i_material-lgnum.
perform bdc_field using 'RMMG1-VKORG'
i_material-vkorg.
perform bdc_field using 'RMMG1-VTWEG'
i_material-vtweg.
perform bdc_dynpro using 'SAPLMGMM' '4004'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'MAKT-MAKTX'
i_material-maktx.
perform bdc_field using 'MARA-MEINS'
i_material-meins.
perform bdc_field using 'MARA-MATKL'
i_material-matkl.
perform bdc_field using 'MARA-BISMT'
i_material-bismt.
perform bdc_field using 'MARA-BRGEW'
i_material-brgew.
perform bdc_field using 'MARA-GEWEI'
i_material-gewei.
perform bdc_field using 'MARA-NTGEW'
i_material-ntgew.
perform bdc_field using 'MARA-MAGRV'
i_material-magrv.
perform bdc_dynpro using 'SAPLMGMM' '4004'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'BDC_CURSOR'
'MAKT-MAKTX'.
perform bdc_field using 'MAKT-MAKTX'
i_material-maktx.
perform bdc_dynpro using 'SAPLMGMM' '4000'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'MAKT-MAKTX'
i_material-maktx.
perform bdc_field using 'MARA-MEINS'
i_material-meins.
perform bdc_field using 'MARA-MATKL'
i_material-matkl.
perform bdc_field using 'MARA-SPART'
i_material-spart.
perform bdc_field using 'MVKE-DWERK'
i_material-dwerk.
perform bdc_field using 'BDC_CURSOR'
'MG03STEUER-TAXKM(01)'.
perform bdc_field using 'MG03STEUER-TAXKM(01)'
i_material-taxkm.
perform bdc_dynpro using 'SAPLMGMM' '4200'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'MAKT-MAKTX'
i_material-maktx.
perform bdc_dynpro using 'SAPLMGMM' '4000'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'MAKT-MAKTX'
i_material-maktx.
perform bdc_dynpro using 'SAPLMGMM' '4000'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'BDC_CURSOR'
'MAKT-MAKTX'.
perform bdc_field using 'MAKT-MAKTX'
i_material-maktx.
perform bdc_field using 'MARA-MTPOS_MARA'
i_material-mtpos_mara.
perform bdc_field using 'MVKE-versg'
i_material-versg.
perform bdc_dynpro using 'SAPLMGMM' '4000'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'BDC_CURSOR'
'MAKT-MAKTX'.
perform bdc_field using 'MAKT-MAKTX'
i_material-maktx.
perform bdc_field using 'MARA-BRGEW'
i_material-brgew.
perform bdc_field using 'MARA-GEWEI'
i_material-gewei.
perform bdc_field using 'MARA-NTGEW'
i_material-ntgew.
perform bdc_field using 'BDC_CURSOR'
'MARA-MAGRV'.
perform bdc_field using 'MARA-MAGRV'
i_material-magrv.
perform bdc_field using 'MARA-TRAGR'
i_material-tragr.
perform bdc_field using 'MARC-LADGR'
i_material-ladgr.
perform bdc_field using 'MARC-PRCTR'
i_material-prctr.
perform bdc_field using 'MARC-MTVFP'
i_material-mtvfp.
perform bdc_dynpro using 'SAPLMGMM' '4004'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'BDC_CURSOR'
'MAKT-MAKTX'.
perform bdc_field using 'MAKT-MAKTX'
i_material-maktx.
perform bdc_field using 'BDC_CURSOR'
'J_1IASSVAL-J_1IVALASS'.
perform bdc_field using 'J_1IMTCHID-J_1ICHID'
i_material-chap.
perform bdc_field using 'J_1IMTCHID-J_1ISUBIND'
'X'..
perform bdc_field using 'J_1IMTCHID-J_1ICAPIND'
i_material-mattype.
perform bdc_field using 'J_1IMTCHID-J_1IGRXREF'
i_material-nogrs.
perform bdc_field using 'J_1IMODDET-J_1IMOOM'
i_material-outmat.
perform bdc_field using 'J_1IASSVAL-J_1IFRDATE'
i_material-valid.
perform bdc_field using 'J_1IASSVAL-J_1IWAERS'
i_material-curr.
perform bdc_field using 'J_1IASSVAL-J_1IVALNDP'
i_material-netdeal.
perform bdc_field using 'J_1IASSVAL-J_1IVALASS'
i_material-asess.
*perform bdc_dynpro using 'SAPLMGMM' '4000'.
*perform bdc_field using 'BDC_OKCODE'
'/00'.
*perform bdc_field using 'BDC_CURSOR'
'MAKT-MAKTX'.
*perform bdc_field using 'MAKT-MAKTX'
I_MATERIAL-MAKTX.
*perform bdc_field using 'MVKE-MTPOS'
I_MATERIAL-MTPOS.
perform bdc_dynpro using 'SAPLMGMM' '4000'.
perform bdc_field using 'BDC_OKCODE'
'ENTR'.
perform bdc_field using 'MAKT-MAKTX'
i_material-maktx.
perform bdc_field using 'MARA-MEINS'
i_material-meins.
perform bdc_field using 'BDC_CURSOR'
'MARC-DISMM'.
perform bdc_field using 'MARC-DISMM'
i_material-dismm.
perform bdc_field using 'MARC-DISPO'
i_material-dispo.
perform bdc_field using 'MARC-DISLS'
i_material-disls.
perform bdc_field using 'MARC-MAABC'
i_material-maabc.
perform bdc_field using 'MARC-DISGR'
i_material-disgr.
perform bdc_dynpro using 'SAPLMGMM' '4000'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'MAKT-MAKTX'
i_material-maktx.
perform bdc_field using 'MARC-FHORI'
i_material-fhori.
perform bdc_field using 'MARC-LGPRO'
i_material-lgpro.
perform bdc_field using 'MARC-LGFSB'
i_material-lgfsb.
perform bdc_field using 'MARC-PLIFZ'
i_material-plifz.
*perform bdc_field using 'MARC-STRGR'
I_MATERIAL-STRGR.
perform bdc_field using 'MARC-BESKZ'
i_material-beskz.
perform bdc_dynpro using 'SAPLMGMM' '4000'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'BDC_CURSOR'
'MAKT-MAKTX'.
perform bdc_field using 'MAKT-MAKTX'
i_material-maktx.
*perform bdc_field using 'MARC-STRGR'
I_MATERIAL-STRGR.
perform bdc_dynpro using 'SAPLMGMM' '4000'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'BDC_CURSOR'
'MAKT-MAKTX'.
perform bdc_field using 'MAKT-MAKTX'
i_material-maktx.
perform bdc_field using 'MARC-SAUFT'
'X'.
perform bdc_field using 'MARC-SFEPR'
i_material-sfepr.
perform bdc_dynpro using 'SAPLMGMM' '4000'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'BDC_CURSOR'
'MAKT-MAKTX'.
perform bdc_field using 'MAKT-MAKTX'
i_material-maktx.
perform bdc_field using 'MArc-FEVOR'
i_material-fevor.
perform bdc_field using 'MARC-SFCPF'
i_material-sfcpf.
perform bdc_dynpro using 'SAPLMGMM' '4000'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'BDC_CURSOR'
'MAKT-MAKTX'.
perform bdc_field using 'MAKT-MAKTX'
i_material-maktx.
perform bdc_dynpro using 'SAPLMGMM' '4000'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'BDC_CURSOR'
'MAKT-MAKTX'.
perform bdc_field using 'MAKT-MAKTX'
i_material-maktx.
perform bdc_dynpro using 'SAPLMGMM' '4000'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'BDC_CURSOR'
'MAKT-MAKTX'.
perform bdc_field using 'MAKT-MAKTX'
i_material-maktx.
perform bdc_dynpro using 'SAPLMGMM' '4000'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'BDC_CURSOR'
'MAKT-MAKTX'.
perform bdc_field using 'MAKT-MAKTX'
i_material-maktx.
perform bdc_dynpro using 'SAPLMGMM' '4000'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'BDC_CURSOR'
'MAKT-MAKTX'.
perform bdc_field using 'MAKT-MAKTX'
i_material-maktx.
perform bdc_dynpro using 'SAPLMGMM' '4000'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'BDC_CURSOR'
'MAKT-MAKTX'.
perform bdc_field using 'MAKT-MAKTX'
i_material-maktx.
perform bdc_field using 'BDC_CURSOR'
'MBEW-BKLAS'.
perform bdc_field using 'MBEW-BKLAS'
i_material-bklas.
perform bdc_field using 'MBEW-VPRSV'
i_material-vprsv.
perform bdc_field using 'MBEW-PEINH'
i_material-peinh.
perform bdc_field using 'MBEW-STPRS'
i_material-stprs.
perform bdc_dynpro using 'SAPLMGMM' '4000'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'BDC_CURSOR'
'MAKT-MAKTX'.
perform bdc_field using 'MAKT-MAKTX'
i_material-maktx.
perform bdc_dynpro using 'SAPLMGMM' '4000'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'BDC_CURSOR'
'MAKT-MAKTX'.
perform bdc_field using 'MAKT-MAKTX'
i_material-maktx.
perform bdc_field using 'Mbew-kosgr'
i_material-kosgr.
perform bdc_field using 'Mbew-HKMAT'
'X'.
perform bdc_field using 'Mbew-HRKFT'
i_material-hrkft.
perform bdc_dynpro using 'SAPLMGMM' '4000'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'BDC_CURSOR'
'MAKT-MAKTX'.
perform bdc_field using 'MAKT-MAKTX'
i_material-maktx.
*perform bdc_field using 'Mbew-KOSGR'
I_MATERIAL-KOSGR.
perform bdc_dynpro using 'SAPLSPO1' '0300'.
perform bdc_field using 'BDC_OKCODE'
'=YES'.
perform post_transaction.
refresh bdc_itab.
clear bdc_itab.
endloop.
end-of-selection.
perform finalization.
Start new screen *
form bdc_dynpro using program dynpro.
clear bdc_itab.
bdc_itab-program = program.
bdc_itab-dynpro = dynpro.
bdc_itab-dynbegin = 'X'.
append bdc_itab.
endform. "bdc_dynpro
Insert field *
form bdc_field using fnam fval.
if fval <> ''.
clear bdc_itab.
bdc_itab-fnam = fnam.
bdc_itab-fval = fval.
append bdc_itab.
endif.
endform. "bdc_field
*& Form POST_TRANSACTION
form post_transaction.
refresh messtab.
clear messtab.
call transaction 'MM01' using bdc_itab
mode p_update
update 'S'
messages into messtab.
submit zrpt_plantext with flatfile = p_lgort
with p_matnr = r_matnr
with p_werks = r_werks and return.
read table messtab with key msgtyp = 'E'.
if sy-subrc eq 0.
perform process_error_messages.
add 1 to count-bdc.
if v_chr_opengrp is initial.
perform bdc_open_group.
endif.
call function 'BDC_INSERT'
exporting
tcode = 'MM01'
tables
dynprotab = bdc_itab
exceptions
internal_error = 1
not_open = 2
queue_error = 3
tcode_invalid = 4
others = 5.
if sy-subrc <> 0.
case sy-subrc.
when 1.
write: / 'Internal error'.
when 2.
write: / 'Not open error'.
when 3.
write: / 'queue error'.
when 4.
write: / 'tcode invalid error'.
when others.
write: / 'other error'.
endcase.
endif.
else.
add +1 to count-create.
format intensified off.
format color col_normal.
format color col_normal off.
endif.
clear bdc_itab.
refresh bdc_itab.
endform. " POST_TRANSACTION
*& Form PROCESS_ERROR_MESSAGES
form process_error_messages.
data: begin of loc_aux_message.
include structure message.
data: end of loc_aux_message.
data : msgno type sy-msgno.
loop at messtab.
move messtab-msgnr to msgno.
call function 'WRITE_MESSAGE'
exporting
msgid = messtab-msgid
msgno = msgno
msgty = messtab-msgtyp
msgv1 = messtab-msgv1
msgv2 = messtab-msgv2
msgv3 = messtab-msgv3
msgv4 = messtab-msgv4
importing
messg = loc_aux_message
exceptions
others = 1.
if sy-subrc eq 0.
format color col_negative on.
write: /10 i_material-matnr.
write: /10 loc_aux_message.
format color col_negative off.
else.
format color col_negative on.
write: /10 i_material-matnr.
write: / 'Error creating message'.
format color col_negative off.
exit.
endif.
endloop.
endform. " PROCESS_ERROR_MESSAGES
*& Form BDC_OPEN_GROUP
form bdc_open_group.
call function 'BDC_OPEN_GROUP'
exporting
client = sy-mandt
group = p_bdcgrp
holddate = sy-datum
keep = 'X'
user = sy-uname
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 eq 0.
v_chr_opengrp = 'X'.
endif.
endform. " BDC_OPEN_GROUP
*& Form FINALIZATION
form finalization.
if v_chr_opengrp = 'X'.
call function 'BDC_CLOSE_GROUP'
exceptions
not_open = 1
queue_error = 2
others = 3.
endif.
get time.
skip 2.
write: / 'Time', sy-uzeit.
skip.
format color col_total on.
write: / 'Total Records: ', 40 count-inrec.
write: / 'PERNR not of Emp Group 6 ', 40 count-error.
write: / 'Records Created: ', 40 count-create.
write: / 'BDC Create in group: ', 40 count-bdc.
if v_chr_opengrp = 'X'.
skip 1.
format intensified on.
format color col_negative on.
write: / 'PLEASE USE TRANSACTION "SM35" ',
'TO PROCESS THE GENERATED BDC SESSION ... ',
p_bdcgrp.
endif.
endform. " FINALIZATION
Similar Messages
-
Is BDC's CALL TRANSACTION 'VA01' is not equals to ONLINE(manual) creation?
Hi Experts,
Ours is IS-Oil.
If the user do not enters/inputs OIC_MOT (Mode Of Transport) at ITEM level on the External Details popup, SAP will get it from Customar Master-KNA1 and populates on it, because its a mandatory field (OIC_MOT), but, do not throws an Error message and interupts the sales order creation process.
We have a inbound IDOC posting function module for sales order (VA01), which posts the sales oreders by using BDC (CALL TRANSACTION 'VA01') in the system. In this function module, we are not populating the OIC_MOT field contained segment by hoping SAP will populate/default it while it hits CALL TRANSACTION 'VA01' of my BDC of my FM of IB IDOC. But, SAP is not defaulting/populating and throwing error message (saying 'OIC_MOT field is a mandatory input field' data is missing) and IDOC is failing, pls. let me know Wht its so? is the BDC's CALL TRANSACTION 'VA01' is not equals to ONLINE (manual ) creation of sales order?
Thank youHi
Several transactions can ba a different behavior between online and bdc process, but if you simulate the trx by SM35 you should find out these gaps
I don't know OIL vertical, but the main transactions have a bapi can be used insted of BDC program (BAPI_SALESORDER_CREATEFROMDAT2, but perhaps there's a particular BAPI for OIL).
Max -
Can anybody pls tell me limitations of BDC Session & Call transaction?
hi, Guys, this is srinivas.
How can we deside which method is to(BDC session/ Call transaction)
use to upload data to SAP database?
Can we run Call Transaction in Background?
Which is preferable for bulk data? and Why?
how can we restart Session if any error occurs?
Thanku?Hi,
Hope it helps this......
SAP BDC INTERVIEW QUESTIONS & ANSWERS
1. What is full form of BDC Session?
Batch Data Communication Session.
2. What are the steps in a BDC session?
The first step in a BDC session is to identify the screens of the transaction that the program will process. Next step is to write a program to build the BDC table that will be used to submit the data to SAP. The final step is to submit the BDC table to the system in the batch mode or as a single transaction by the CALL TRANSACTION command.
3. How do you find the information on the current screen?
The information on the current screen can be found by SYSTEM à STATUS command from any menu.
4. How do you save data in BDC tables?
The data in BDC tables is saved by using the field name BDC_OKCODE and field value of /11.
5. What is the last entry in all BDC tables?
In all BDC tables the last entry is to save the data by using the field name BDC_OKCODE and a field value of /11.
6. What is a multiple line field?
A multiple line field is a special kind of field which allows the user to enter multiple lines of data into it.
7. How do you populate data into a multiple line field?
To populate data into a multiple line field, an index is added to the field name to indicate which line is to be populated by the BDC session (Line index).
8. Write the BDC table structure.
BDC table structure
FIELD TYPE DESCRIPTION
Program CHAR (8) Program name of transaction.
DynPro CHAR (4) Screen number of transaction.
DynBegin CHAR (1) Indicator for new screen.
Fnam CHAR (35) Name of database field from screen.
Fval CHAR (80) Value to submit to field.
9. Does the CALL TRANSACTION method allow multiple transactions to be processed by SAP?
No. The CALL TRANSACTION method allows only a single transaction to be processed by SAP.
10. Does the BDC-INSERT function allow multiple transactions to be processed by SAP?
Yes.
11. What is the syntax for CALL TRANSACTION?
CALL TRANSACTION trans .
Three possible entries are there for MODE.
A - Show all screens.
E - Show only screens with errors.
N - Show no screens.
Regards,
V.Balaji
Reward if usefull -
BDC with call transaction VD02 works fin in A mode but not in N mode
Hi All,
I have BDC program developed in 4.6c using call transaction VD02 works fine with mode A but not with mode N.
Now we upgraded to ECC 6.0.Do I need to change anything?No, you don't have to change anything for ECC. BTW, I wonder why VD02 is not working in the background for you?
-
BDC via call transaction method
I have a requirement wherin I am supposed to execute transaction FI01 in background.
While I do this, there is a pop-up window displayed for selection of jurisdiction code.I am unable to capture this in background.
Can we capture pop-up window values ?
In foreground, the scenario works fine,since there will be user intervention in this case.
Thanks in advance,The answer has already been given by Frederic. You have to find out the BDC field names via F1 and technichal help. There you also can find the dynpro numbers and report names. With these parameters you have to fill the bdcdata table in the call transaction command. See
<a href="http://help.sap.com/saphelp_nw2004s/helpdata/de/fa/09714d543b11d1898e0000e8322d00/frameset.htm">http://help.sap.com/saphelp_nw2004s/helpdata/de/fa/09714d543b11d1898e0000e8322d00/frameset.htm</a>
Regards,
Thomas -
Hi ,
This is vijay...
can anyone help me plz
Hi,
Iam uploading data using call transaction.Tcode is ff67.In this TCode we have the begining balance(ssald) and ending balance(esald).The new record we are uploading will take the begining balance as the previous record ending balance, if we give the begining balance wrong then the record does not saved it will show error(the begining balance does not match with the prior ending balance).
while uploading the data using MODE A iam able to get the desired output but by using the MODE N iam not able to get the desired output i,e if there is any error in the begining balance also the record is being saved iam not getting the error message.
Iam attaching the code below..please help me
report Z_BRS_BDC no standard page heading line-size 255.
INTERNAL TABLES DECLARATIONS
DATA : BEGIN OF bdcdata OCCURS 0.
INCLUDE STRUCTURE bdcdata.
DATA : END OF bdcdata.
DATA: LV_OUT TYPE STRING.
DATA : iopt LIKE ctu_params.
DATA : wa_rec_err TYPE i.
DATA : wa_rec_wri TYPE i.
DATA : wa_tot_rec TYPE i.
DATA : amt(16) type c.
DATA : BEGIN OF gu_upload OCCURS 0,
hbkid LIKE febmka-hbkid,
hktid LIKE febmka-hktid,
aznum LIKE febmka-aznum,
azdat LIKE febmka-azdat,
ssald LIKE amt,
esald LIKE amt,
budtm LIKE febmka-budtm,
mnam1 LIKE febmka-mnam1,
jname LIKE febmka-jname,
vgman LIKE febmka-vgman,
valut LIKE febep-valut,
kwbtr(13) TYPE c,
chect_kf LIKE febmkk-chect_kf,
END OF gu_upload.
DATA:GU_DOWNLOAD LIKE GU_UPLOAD OCCURS 0 WITH HEADER LINE.
kishi*********************************
DATA: BEGIN OF itab OCCURS 0,
vgman LIKE febmka-vgman,
valut LIKE febep-valut,
kwbtr(13) TYPE c,
chect_kf LIKE febmkk-chect_kf,
END OF itab.
kishi)(_()00-8-09
DATA: BEGIN OF messtab OCCURS 0.
INCLUDE STRUCTURE bdcmsgcoll.
DATA: END OF messtab.
DATA: BEGIN OF messtab1 OCCURS 0.
INCLUDE STRUCTURE messtab.
DATA: END OF messtab1.
DATA : BEGIN OF int_count OCCURS 0.
INCLUDE STRUCTURE alsmex_tabline.
DATA : END OF int_count.
DATA: c_tcode LIKE sy-tcode VALUE 'FF67',
c_upd LIKE ctu_params-updmode VALUE 'S',
c_def_size LIKE ctu_params-defsize VALUE 'X'.
*VALUES FOR STARTING COLUMNS AND ROWS IN THE EXCEL SHEET
DATA : c_begcol TYPE i VALUE '1',
c_begrow TYPE i VALUE '1',
*DATA IS ENDED AT THE 13TH COLUMN IN THE EXCELSHEET
c_endcol TYPE i VALUE '13',
*LAST ROW IN THE EXCEL SHEET
c_endrow TYPE i VALUE '65536',
c_path(3) TYPE c VALUE 'C:\'.
*Field Symbols
FIELD-SYMBOLS: <fs>.
SELECTION SCREEN PARAMETERS
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
PARAMETERS : p_file LIKE rlgrap-filename DEFAULT
'C:\ ',
*This is the path for downloading file
P_FNAME2 LIKE RLGRAP-FILENAME ,
c_mode LIKE ctu_params-dismode DEFAULT 'N'.
SELECTION-SCREEN END OF BLOCK b1.
AT SELECTION-SCREEN.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
*F4 HELP FOR FILE SELECTION
PERFORM validate_input_file.
START-OF-SELECTION.
CLEAR gu_upload.
REFRESH gu_upload.
UPLOAD THE DATA FROM FLAT FILE TO INTERNAL TABLE
PERFORM file_upload.
iopt-dismode = c_mode.
iopt-updmode = c_upd.
iopt-defsize = c_def_size.
POPULATE THE DATA THROUGHSCREENS
PERFORM bdc_upload.
END-OF-SELECTION.
*DISPLY THE ERROR RECORDS
PERFORM DISPLAY-DATA.
FORM file_upload *
FORM file_upload.
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
filename = p_file
i_begin_col = c_begcol
i_begin_row = c_begrow
i_end_col = c_endcol
i_end_row = c_endrow
TABLES
intern = int_count
EXCEPTIONS
inconsistent_parameters = 1
upload_ole = 2
OTHERS = 3.
LOOP AT int_count.
ASSIGN COMPONENT int_count-col OF STRUCTURE gu_upload TO <fs>.
IF sy-subrc NE 0.
EXIT.
ENDIF.
<fs> = int_count-value.
AT END OF row.
APPEND gu_upload.
CLEAR gu_upload.
ENDAT.
ENDLOOP.
*kishhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
LOOP AT gu_upload.
itab-vgman = gu_upload-vgman.
itab-valut = gu_upload-valut.
itab-kwbtr = gu_upload-kwbtr.
itab-chect_kf = gu_upload-chect_kf.
APPEND itab.
ENDLOOP.
*kishiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
ENDFORM. "file_upload
*& Form BDC_UPLOAD
FORM bdc_upload.
LOOP AT gu_upload.
CLEAR bdcdata.
REFRESH bdcdata.
*& POPULATE THE DATA FOR FIRST SCREEN
perform bdc_dynpro using 'SAPMF40K' '0101'.
perform bdc_field using 'BDC_CURSOR'
'FEBMKA-JNAME'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'FEBMKA-BUKRS'
'IN14'.
perform bdc_field using 'FEBMKA-HBKID'
gu_upload-hbkid.
perform bdc_field using 'FEBMKA-HKTID'
gu_upload-hktid.
perform bdc_field using 'FEBMKA-AZNUM'
gu_upload-aznum.
perform bdc_field using 'FEBMKA-AZDAT'
gu_upload-azdat.
perform bdc_field using 'FEBMKA-SSALD'
gu_upload-ssald.
perform bdc_field using 'FEBMKA-ESALD'
gu_upload-esald.
perform bdc_field using 'FEBMKA-BUDTM'
gu_upload-budtm.
perform bdc_field using 'FEBMKA-MNAM1'
gu_upload-mnam1.
perform bdc_field using 'FEBMKA-JNAME'
gu_upload-jname.
*& POPULATE THE DATA FOR SECOND SCREEN
DATA : fnam(20) TYPE c,
idx TYPE c.
MOVE 1 TO idx.
LOOP AT itab.
PERFORM bdc_dynpro USING 'SAPMF40K' '8000'.
PERFORM bdc_field USING 'BDC_CURSOR'
'FEBMKK-CHECT_KF(03)'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
CONCATENATE 'FEBMKA-VGMAN(' idx ')' INTO fnam.
PERFORM bdc_field USING fnam
itab-vgman.
CONCATENATE 'FEBEP-VALUT(' idx ')' INTO fnam.
PERFORM bdc_field USING fnam itab-valut.
CONCATENATE 'FEBMKA-KWBTR(' idx ')' INTO fnam.
PERFORM bdc_field USING fnam itab-kwbtr.
CONCATENATE 'FEBMKK-CHECT_KF(' idx ')' INTO fnam.
PERFORM bdc_field USING fnam itab-chect_kf.
idx = idx + 1.
ENDLOOP.
*perform bdc_dynpro using 'SAPMF40K' '8000'.
*perform bdc_field using 'BDC_CURSOR'
'FEBMKK-CHECT_KF(01)'.
*perform bdc_field using 'BDC_OKCODE'
'/00'.
*perform bdc_field using 'FEBMKA-VGMAN(01)'
'z001'.
*perform bdc_field using 'FEBEP-VALUT(01)'
'2007/04/26'.
*perform bdc_field using 'FEBMKA-KWBTR(01)'
' 5000-'.
*perform bdc_field using 'FEBMKK-CHECT_KF(01)'
'1122'.
perform bdc_dynpro using 'SAPMF40K' '8000'.
perform bdc_field using 'BDC_CURSOR'
'FEBMKK-CHECT_KF(01)'.
perform bdc_field using 'BDC_OKCODE'
'=SICH'.
*& POPULATE THE DATA FOR FOURTH SCREEN
perform bdc_dynpro using 'SAPMF40K' '0101'.
perform bdc_field using 'BDC_CURSOR'
'FEBMKA-BUKRS'.
perform bdc_field using 'BDC_OKCODE'
'=BUCH'.
perform bdc_field using 'FEBMKA-BUKRS'
'IN14'.
perform bdc_field using 'FEBMKA-HBKID'
gu_upload-hbkid.
perform bdc_field using 'FEBMKA-HKTID'
gu_upload-hktid.
perform bdc_field using 'FEBMKA-AZNUM'
gu_upload-aznum.
perform bdc_field using 'FEBMKA-AZDAT'
gu_upload-azdat.
perform bdc_field using 'FEBMKA-SSALD'
gu_upload-ssald.
perform bdc_field using 'FEBMKA-ESALD'
gu_upload-esald.
perform bdc_field using 'FEBMKA-BUDTM'
gu_upload-budtm.
perform bdc_field using 'FEBMKA-MNAM1'
gu_upload-mnam1.
perform bdc_field using 'FEBMKA-JNAME'
gu_upload-jname.
*perform bdc_dynpro using 'SAPMF40K' '0101'.
*perform bdc_field using 'BDC_OKCODE'
'/EENDE'.
*perform bdc_field using 'BDC_CURSOR'
'FEBMKA-BUKRS'.
perform bdc_dynpro using 'SAPMF40K' '0101'.
perform bdc_field using 'BDC_OKCODE'
'/EABBR'.
perform bdc_field using 'BDC_CURSOR'
'FEBMKA-BUKRS'.
*& USING THE CALL TRANSACTION
PERFORM call_transaction.
CLEAR BDCDATA. "<--- Add here
REFRESH BDCDATA. "<--- Add here
ENDLOOP.
ENDFORM. " BDC_UPLOAD
*& Form VALIDATE_INPUT_FILE
FORM validate_input_file.
CALL FUNCTION 'WS_FILENAME_GET'
EXPORTING
def_path = ' c:\ '
mask = ',.txt,.*.'
mode = 'O'
title = 'Upload '
IMPORTING
filename = p_file
EXCEPTIONS
inv_winsys = 1
no_batch = 2
selection_cancel = 3
selection_error = 4
OTHERS = 5.
IF sy-subrc <> 0.
IF sy-subrc <> 0 AND sy-subrc <> 3.
MESSAGE e100(zm) WITH text-007.
ENDIF.
ENDFORM. " VALIDATE_INPUT_FILE
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.
CLEAR bdcdata.
bdcdata-fnam = fnam.
bdcdata-fval = fval.
APPEND bdcdata.
ENDFORM. "bdc_field
*& Form CALL_TRANSACTION
FORM call_transaction.
DATA: l_index LIKE sy-tabix.
CALL TRANSACTION c_tcode USING bdcdata
MODE c_mode
MESSAGES INTO messtab.
*POPULATE THE ERROR RECORDS INTO INTERNAL TABLE
IF SY-SUBRC NE 0.
GU_DOWNLOAD-HBKID = GU_UPLOAD-HBKID.
GU_DOWNLOAD-HBKID = GU_UPLOAD-HBKID.
GU_DOWNLOAD-HKTID = GU_UPLOAD-HKTID.
GU_DOWNLOAD-AZNUM = GU_UPLOAD-AZNUM.
GU_DOWNLOAD-AZDAT = GU_UPLOAD-AZDAT.
GU_DOWNLOAD-ESALD = GU_UPLOAD-ESALD.
GU_DOWNLOAD-SSALD = GU_UPLOAD-SSALD.
GU_DOWNLOAD-BUDTM = GU_UPLOAD-BUDTM.
GU_DOWNLOAD-MNAM1 = GU_UPLOAD-MNAM1.
GU_DOWNLOAD-JNAME = GU_UPLOAD-JNAME.
GU_DOWNLOAD-VGMAN = GU_UPLOAD-VGMAN.
GU_DOWNLOAD-VALUT = GU_UPLOAD-VALUT.
GU_DOWNLOAD-KWBTR = GU_UPLOAD-KWBTR.
GU_DOWNLOAD-CHECT_KF = GU_UPLOAD-CHECT_KF.
APPEND GU_DOWNLOAD.
*DISPLAY THE PROGRESS OF PROCESS
CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
EXPORTING
PERCENTAGE = 0
TEXT = 'Downloading is in process'.
*DOWNLOADING THE ERROR RECORD
LV_OUT = P_FNAME2.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
FILENAME = LV_OUT
WRITE_FIELD_SEPARATOR = 'X'
TABLES
DATA_TAB = GU_DOWNLOAD.
ENDIF.
IF NOT messtab[] IS INITIAL.
PERFORM format_message.
ENDIF.
ENDFORM. " CALL_TRANSACTION
*& Form DISPLAY-DATA
FORM display-data.
SKIP.
WRITE: 'SY-SUBRC' , sy-subrc.
ENDFORM. " DISPLAY-DATA
FORM FORMAT_MESSAGE *
FORM format_message.
DATA: l_msg(100),
l_index LIKE sy-tabix.
LOOP AT messtab.
READ TABLE gu_upload INDEX l_index.
CALL FUNCTION 'FORMAT_MESSAGE'
EXPORTING
id = messtab-msgid
lang = sy-langu
no = messtab-msgnr
v1 = messtab-msgv1
v2 = messtab-msgv2
v3 = messtab-msgv3
v4 = messtab-msgv4
IMPORTING
msg = l_msg
EXCEPTIONS
not_found = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
WRITE:/ l_msg.
ENDLOOP.
WRITE:/ l_msg.
ENDFORM.
Message was edited by:
vijayd duvvadaHi,
First , keep the mode "E" and check the debugger , you can exactly see where the error is and let me know, what error and where it is stoping.
By your coding, i suppose to think that, its proble in the amount (currency). When ever you are try to pass the value, and value is not there in upload file or data is mismatch, the call transaction will fail in mode 'A' and succesful in mode 'N'.
In that situation use this before the currecny field.
IF NOT FEBMKA-SSALD IS INTIAL.
perform bdc_field using 'FEBMKA-ESALD'
gu_upload-esald.
ENDIF.
tHANKS
Manju -
Hi,
I need to call transaction QM01, on the first screen always select Z4, on the next always pass a deliverynumber and finally show the third screen to the user.
Had it only been the forst screen I should skip a Call Transaction and skip, with parameters should be enough, but as far as I know, I can't skip two screens like that in Call Transaction.
So I tried to do a Batch Input. But when playing my recording, these small windows keeps appearing with ok codes, that I need to confirm. How to get the Batch input to run in background and only show third screen to the user?
Simple question from an ABAP wanna be
Kind regards
MikkelMikkel,
The ideal solution would be to develop a mass maintanence transaction for this purpose. What I mean is to develop a table control. In effect you should be able to combine the functionality of the multiple screens in to a single screen and do the recording.
The not so ideal solution would be to always force an error on the third screen for the user. In this way the third screen will always be forced to the user and he has to make amends for it.
Hope this helps,
Sojan -
Regarding BDC and Call transaction Method
hi gurus,
can anyone tell the difference how many records Call transaction and Session
Method can upload in case of single transaction and what is the time taken by each.its urgent pls.
thanks and regards.Rajesh,
u can do as many as ,
coming to speed means it depends on server,
if ur using session then u can calculate time ,
with in one time h many records system will upload the records by seeing in sm35
(first see h many records systems uploads, see the number and put the time , after one min again see the records h many it is ,) u can calculate by this.
remember this speed will changes depends on server,
so if u have n number of records better to do upload in weekends.
2) if u r using call transaction method means , normally we use error file where ever record occurs that record is in error file, i think we cant analyze h many records it will be with in a time r .
we can also check by going respective tables , just put the time and do refreshing the table after one minute , n this way u can analyze .
Thanks -
Call bdc or call transaction in bapi
Hi,
i create MAM sales order using bapi BAPI_ADMGMTSO_CREATEFROMDATA .
But i want create genral business partner using t-code bug1 for that i use bdc.
how i should call that bdc in above bapi.
Please anybody suggest solution for this?Hi,
I don't find BAPI_ADMGMTSO_CREATEFROMDATA, but what you can do is create a customize ZBAPI_ADMGMTSO_CREATEFROMDATA and made a call function to BAPI_ADMGMTSO_CREATEFROMDATA and after commit you put your bdc code. -
Hi all,
In my recording I gave TC MM01 and inserted. Then in SE38.
DATA : begin of itab occurs 0,
matnr(15),mbrsh(15),mtart(15),maktx(15),meins(15),
end of itab.
called function
There was no errror.
How can I see the contents whether that is inserted or not.
There are three internal tables
RMMG1,MAKT,MARA. I cant see the contents of RMMG1.
Then What is this error.
Call_transaction MM01 return code = 1.001 Record.
S No batch input data for screen SAPLMGMW 0100.
what is this error.I would really suggest that you use the BAPI.
You will save yourself a big headache. Here is an example.
In this example, were creating a HALB material using internal number assignment. Of course if your material type uses external number assignment, you can assign it directly.
report zrich_0001.
data: headdata type bapimathead.
data: clientdata type bapi_mara.
data: clientdatax type bapi_marax.
data: descdata type table of bapi_makt with header line.
data: return type table of bapiret2 with header line.
data: returnm type table of bapi_matreturn2 with header line.
data: imat type table of bapimatinr with header line.
call function 'BAPI_MATERIAL_GETINTNUMBER'
exporting
material_type = 'HALB'
* INDUSTRY_SECTOR = 'M'
tables
material_number = imat.
read table imat index 1.
if sy-subrc = 0.
headdata-material = imat-material.
endif.
headdata-ind_sector = 'M'.
headdata-matl_type = 'HALB'.
headdata-basic_view = 'X'.
clientdata-base_uom = 'EA'.
clientdatax-base_uom = 'X'.
clientdata-old_mat_no = 'Old Material'.
clientdatax-old_mat_no = 'X'.
clientdata-division = '00'.
clientdatax-division = 'X'.
descdata-langu = sy-langu.
descdata-matl_desc = 'This is the description'.
append descdata.
call function 'BAPI_MATERIAL_SAVEDATA'
exporting
headdata = headdata
clientdata = clientdata
clientdatax = clientdatax
PLANTDATA =
PLANTDATAX =
* FORECASTPARAMETERS =
* FORECASTPARAMETERSX =
* PLANNINGDATA =
* PLANNINGDATAX =
* STORAGELOCATIONDATA =
* STORAGELOCATIONDATAX =
* VALUATIONDATA =
* VALUATIONDATAX =
* WAREHOUSENUMBERDATA =
* WAREHOUSENUMBERDATAX =
* SALESDATA =
* SALESDATAX =
* STORAGETYPEDATA =
* STORAGETYPEDATAX =
importing
return = return
tables
materialdescription = descdata
* UNITSOFMEASURE =
* UNITSOFMEASUREX =
* INTERNATIONALARTNOS =
* MATERIALLONGTEXT =
* TAXCLASSIFICATIONS =
returnmessages = returnm
* PRTDATA =
* PRTDATAX =
* EXTENSIONIN =
* EXTENSIONINX =
check sy-subrc = 0.
Regards,
Rich Heilman -
Atomic BDC by Call Transaction.
Hello,
I would like to know if it is possible to do 3 batch input, but do a rolback if I have any errors durind transfer data.
check this code....as a sample...
PERFORM CALL_FIRST_TCODE TABLE TI_ERROR_MESSAGES.
IF TI_ERROR_MESSAGES IS INITIAL.
ROLLBACK ----> DONT KNOW IF IT IS POSSIBLE
ELSE.
PERFORM CALL_SECOND_TCODE TABLE TI_ERROR_MESSAGES.
IF TI_ERROR_MESSAGES IS INITIAL.
ROLLBACK ----> DONT KNOW IF IT IS POSSIBLE
ELSE.
PERFORM CALL_SECOND_TCODE TABLE TI_ERROR_MESSAGES.
IF TI_ERROR_MESSAGES IS INITIAL.
ROLLBACK ----> DONT KNOW IF IT IS POSSIBLE
ENDIF.
ENDIF.
ENDIF.
Any ideas??
10nks in advance..
Gabriel P.-Hello Rob,
Thanks for your remmarks, what do you mean by
see if you can do the previous transaction in reverse
I dont clearly get what you mean
thanks again
Gabriel -
Skip first screen when calling transaction via BDC
I need to use BDC to call transaction FD32 and suppress the first screen. Do I need to set BDC_OKCODE? However, when I set BDC_OKCODE to '/00', this error occured, "System error: Error in routine DYNPRO_ERSTES_BILD".
Here is my code:
CLEAR ls_bdcdata.
ls_bdcdata-program = 'SAPMF02C'.
ls_bdcdata-dynpro = '0100'.
ls_bdcdata-dynbegin = 'X'.
APPEND ls_bdcdata TO lt_bdcdata.
CLEAR ls_bdcdata.
ls_bdcdata-fnam = 'RF02L-KUNNR'.
ls_bdcdata-fval = gs_data-kunnr.
APPEND ls_bdcdata TO lt_bdcdata.
CLEAR ls_bdcdata.
ls_bdcdata-fnam = 'RF02L-KKBER'.
ls_bdcdata-fval = p_kkber.
APPEND ls_bdcdata TO lt_bdcdata.
CLEAR ls_bdcdata.
ls_bdcdata-fnam = 'RF02L-D0105'.
ls_bdcdata-fval = 'X'.
APPEND ls_bdcdata TO lt_bdcdata.
CLEAR ls_bdcdata.
ls_bdcdata-fnam = 'BDC_OKCODE'.
ls_bdcdata-fval = '/00'.
APPEND ls_bdcdata TO lt_bdcdata.
opt-dismode = 'E'.
opt-defsize = 'X'.
CALL TRANSACTION 'FD32' USING lt_bdcdata OPTIONS FROM opt.
Any suggestions?Hi,
Try this..This is working fine for me..
CLEAR ls_bdcdata.
ls_bdcdata-program = 'SAPMF02C'.
ls_bdcdata-dynpro = '0100'.
ls_bdcdata-dynbegin = 'X'.
APPEND ls_bdcdata TO lt_bdcdata.
CLEAR ls_bdcdata.
ls_bdcdata-fnam = 'BDC_CURSOR'.
ls_bdcdata-fval = 'RF02L-D0110'.
APPEND ls_bdcdata TO lt_bdcdata.
CLEAR ls_bdcdata.
ls_bdcdata-fnam = 'BDC_OKCODE'.
ls_bdcdata-fval = '/00'.
APPEND ls_bdcdata TO lt_bdcdata.
CLEAR ls_bdcdata.
ls_bdcdata-fnam = 'RF02L-KUNNR'.
ls_bdcdata-fval = gs_data-kunnr.
APPEND ls_bdcdata TO lt_bdcdata.
CLEAR ls_bdcdata.
ls_bdcdata-fnam = 'RF02L-KKBER'.
ls_bdcdata-fval = p_kkber.
APPEND ls_bdcdata TO lt_bdcdata.
CLEAR ls_bdcdata.
ls_bdcdata-fnam = 'RF02L-D0105'.
ls_bdcdata-fval = 'X'.
APPEND ls_bdcdata TO lt_bdcdata.
CLEAR ls_bdcdata.
ls_bdcdata-fnam = 'RF02L-D0110'.
ls_bdcdata-fval = 'X'.
APPEND ls_bdcdata TO lt_bdcdata.
CLEAR ls_bdcdata.
ls_bdcdata-fnam = 'RF02L-D0120'.
ls_bdcdata-fval = 'X'.
APPEND ls_bdcdata TO lt_bdcdata.
CALL TRANSACTION 'FD32' USING lt_bdcdata MODE 'E'.
Thanks,
Naren -
Reprint the processed order with BDC call transaction
Hi Mentors,
I have a problem with printing the order which is coming in a cockpit program.
for that i am using the bdc and call transaction 'ZVA31' which is exactly the standard program 'SD70AV1A'.
but after first processing i am not able to reprint the processed order.
Below is my bdc code and i am using processing mode 1 at the time of recording.
FORM ZSD70AV1A_PRINT_BA01 USING p_vbeln TYPE vbeln.
DATA: wa_ba01 TYPE nast-kschl VALUE 'BA01'.
perform bdc_dynpro using 'SD70AV1A' '1000'.
perform bdc_field using 'BDC_CURSOR'
'RG_KSCHL-LOW'.
perform bdc_field using 'BDC_OKCODE'
'=ONLI'.
perform bdc_field using 'RG_KSCHL-LOW'
wa_ba01."wa_ba01."'ba01'.
perform bdc_field using 'PM_NSORT'
'01'.
perform bdc_field using 'PM_VERMO'
'1'.
perform bdc_field using 'RG_VBELN-LOW'
p_vbeln."'513785'.
perform bdc_dynpro using 'SAPMSSY0' '0120'.
perform bdc_field using 'BDC_CURSOR'
'04/03'.
perform bdc_field using 'BDC_OKCODE'
'=&ALL'.
perform bdc_dynpro using 'SAPMSSY0' '0120'.
perform bdc_field using 'BDC_CURSOR'
'04/03'.
perform bdc_field using 'BDC_OKCODE'
'=PROC'.
CALL TRANSACTION 'ZVA31' USING BDCDATA
MODE 'A'
MESSAGES INTO MESSTAB.
CLEAR BDCDATA[].
ENDFORM. " ZSD70AV1A_PRINT_BA01
Br,
SuryaSolved myself.
DATA: wa_ba00 TYPE nast-kschl VALUE 'BA00'.
DATA: p_vermo TYPE kschl.
DATA: cur_vstat TYPE nast-vstat.
SELECT SINGLE vstat INTO cur_vstat FROM nast
WHERE objky = p_vbeln
AND kschl = 'BA00'.
IF sy-subrc = 0 AND cur_vstat = 0.
p_vermo = '1'."wa_vstat.
ELSE.
p_vermo = '2'.
ENDIF.
p_vermo is processing status.
Br,
Surya -
How to suppress a warning message in BDC call transaction
Hi,
I was calling a BDC using CALL Transaction in mode N. But due to some warning messages the background job was not success. Please tell me how to overcome the warning messages in BDC.
Regards,
SatishHi tyr this way:
PERFORM bdc_dynpro USING 'SAPMM07M' '0210'. " into the screen
PERFORM bdc_field USING 'BDC_CURSOR' "cursor on the filed to update
'DM07M-HSDAT_INPUT'.
PERFORM bdc_field USING 'DM07M-HSDAT_INPUT' "assign values
v_date. "might get an warning so three enters...
PERFORM bdc_field USING 'BDC_OKCODE' " first enter
'/00'.
PERFORM bdc_field USING 'BDC_OKCODE' "second enter
'/00'.
PERFORM bdc_field USING 'BDC_OKCODE' "third enter
'/00'. -
Re: Bdc call transaction
Hi all can any one give good code and entire process for BDC call transaction method.explain the entire process clearly.
Thanks®ards
SashiHi,
Check the following code:
*& Report Z_BDCP_VENDCALLTRNS
*& TITLE : Vendor Creation BDC Program (Call Transaction Method) *
*& AUTHOR : XXXXXXXXXX *
*& DATE OF CREATION : xx-xx-xxxx *
*& PROGRAM TYPE : Executable Program *
MODIFICATION LOG *
*& AUTHOR : *
*& DATE OF CHANGE : *
*& FUNCTIONAL SPECS : *
*& CORRECTIONS REQUEST : *
*& DESCRIPTION OF CHANGE : *
REPORT z14644sd_bdcp_vendcalltrns.
TYPES: BEGIN OF t_vend,
lifnr LIKE rf02k-lifnr, "Vendor Account Number
ktokk LIKE rf02k-ktokk, "Vendor account group
anred LIKE lfa1-anred, "Title
name1 LIKE lfa1-name1, "Vendor Name
sortl LIKE lfa1-sortl, "Sort field
land1 LIKE lfa1-land1, "Country Key
spras LIKE lfa1-spras, "Language Key
banks TYPE lfbk-banks, "Bank country key
bankl TYPE lfbk-bankl, "bank key
bankn TYPE lfbk-bankn, "account number
END OF t_vend.
TYPES: BEGIN OF t_sucrec,
vnum TYPE lfa1-lifnr, "Vendor Account Number
vnam TYPE lfa1-name1, "Vendor Name
END OF t_sucrec.
TYPES: BEGIN OF t_errrec,
err_rec TYPE string, "Error Record
lineno TYPE i, "Line Number
message TYPE string, "Error Message
END OF t_errrec.
DATA: v_file TYPE string, "Variable for storing flat file
it_vend TYPE STANDARD TABLE OF t_vend, "Internal table of Vendor
wa_vend LIKE LINE OF it_vend, "Workarea of Internal table it_vend
it_sucrec TYPE STANDARD TABLE OF t_sucrec, "Internal table of Success records
wa_sucrec LIKE LINE OF it_sucrec, "Workarea of Internal table it_sucrec
it_errrec TYPE STANDARD TABLE OF t_errrec,
wa_errrec LIKE LINE OF it_errrec,
it_bdctab LIKE bdcdata OCCURS 0 WITH HEADER LINE, "Internal table structure of BDCDATA
it_messagetab LIKE bdcmsgcoll OCCURS 0 WITH HEADER LINE, "Tracing Error Messages
v_date LIKE sy-datum, "Controlling of session date
v_index LIKE sy-index, "Index Number
v_totrec TYPE i, "Total Records
v_errrec TYPE i, "Error Records
v_sucrec TYPE i, "Success Records
v_sesschk TYPE c. "Session maintenance
*& SELECTION-SCREEN
SELECTION-SCREEN: BEGIN OF BLOCK blk1 WITH FRAME TITLE text-001 NO INTERVALS.
PARAMETERS: p_file TYPE rlgrap-filename. "rlgrap-filename is a predefined structure
SELECTION-SCREEN: END OF BLOCK blk1.
SELECTION-SCREEN: BEGIN OF BLOCK blk2 WITH FRAME TITLE text-002 NO INTERVALS.
PARAMETERS: p_mode LIKE ctu_params-dismode DEFAULT 'N',
p_update LIKE ctu_params-updmode DEFAULT 'A'.
SELECTION-SCREEN END OF BLOCK blk2.
*& INITIALIZATION
INITIALIZATION.
v_date = sy-datum - 1.
*& AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
CALL FUNCTION 'F4_FILENAME'
EXPORTING
program_name = syst-cprog
dynpro_number = syst-dynnr
FIELD_NAME = ' '
IMPORTING
file_name = p_file.
*& START-OF-SELECTION
START-OF-SELECTION.
v_file = p_file.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = v_file
filetype = 'ASC'
has_field_separator = 'X'
TABLES
data_tab = it_vend
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.
*& END-OF-SELECTION
END-OF-SELECTION.
v_index = sy-index.
LOOP AT it_vend INTO wa_vend.
PERFORM bdc_dynpro USING 'SAPMF02K' '0100'.
PERFORM bdc_field USING 'RF02K-LIFNR' wa_vend-lifnr.
PERFORM bdc_field USING 'RF02K-KTOKK' wa_vend-ktokk.
PERFORM bdc_field USING 'BDC_OKCODE' '/00'.
PERFORM bdc_dynpro USING 'sapmf02k' '0110'.
PERFORM bdc_field USING 'lfa1-anred' wa_vend-anred.
PERFORM bdc_field USING 'lfa1-name1' wa_vend-name1.
PERFORM bdc_field USING 'lfa1-sortl' wa_vend-sortl.
PERFORM bdc_field USING 'lfa1-land1' wa_vend-land1.
PERFORM bdc_field USING 'lfa1-spras' wa_vend-spras.
PERFORM bdc_dynpro USING 'SAPMF02K' '0120'.
PERFORM bdc_field USING 'BDC_OKCODE' '/00'.
PERFORM bdc_dynpro USING 'SAPMF02K' '0130'.
PERFORM bdc_field USING 'BDC_OKCODE' '=ENTR'.
PERFORM bdc_field USING 'LFBK-BANKS(01)' wa_vend-banks.
PERFORM bdc_field USING 'LFBK-BANKL(01)' wa_vend-bankl.
PERFORM bdc_field USING 'LFBK-BANKN(01)' wa_vend-bankn.
PERFORM bdc_dynpro USING 'SAPMF02K' '0130'.
PERFORM bdc_field USING 'BDC_OKCODE' '=ENTR'.
PERFORM bdc_dynpro USING 'SAPLSPO1' '0300'.
PERFORM bdc_field USING 'bdc_okcode' 'UPDA'.
CALL TRANSACTION 'XK01' USING it_bdctab
MODE p_mode
UPDATE p_update
MESSAGES INTO it_messagetab.
IF sy-subrc = 0.
*& reading success records to corresponding internal table
READ TABLE it_messagetab WITH KEY msgtyp = 'S'.
IF sy-subrc = 0.
wa_sucrec-vnum = it_messagetab-msgv1.
wa_sucrec-vnam = wa_vend-name1.
APPEND wa_sucrec TO it_sucrec.
CLEAR wa_sucrec.
ENDIF.
ELSE.
*& reading error records to corresponding internal table
READ TABLE it_messagetab WITH KEY msgtyp = 'E'.
IF sy-subrc = 0.
CALL FUNCTION 'FORMAT_MESSAGE'
EXPORTING
id = sy-msgid
no = it_messagetab-msgnr
v1 = it_messagetab-msgv1
v2 = it_messagetab-msgv2
v3 = it_messagetab-msgv3
v4 = it_messagetab-msgv4
IMPORTING
msg = wa_errrec-message.
wa_errrec-lineno = v_index.
APPEND wa_errrec TO it_errrec.
CLEAR wa_errrec.
ENDIF.
ENDIF.
CLEAR : it_bdctab, it_messagetab.
REFRESH: it_bdctab, it_messagetab.
ENDLOOP.
DESCRIBE TABLE it_vend LINES v_totrec.
DESCRIBE TABLE it_errrec LINES v_errrec.
DESCRIBE TABLE it_sucrec LINES v_sucrec.
PERFORM disp_data.
SKIP 2.
IF v_sucrec > 0.
PERFORM disp_success_data.
ENDIF.
SKIP 2.
IF v_errrec > 0.
PERFORM disp_error_data.
ENDIF.
*& Form bdc_dynpro
text
-->P_0104 text
-->P_0105 text
FORM bdc_dynpro USING program
dynpro.
CLEAR it_bdctab.
it_bdctab-program = program.
it_bdctab-dynpro = dynpro.
it_bdctab-dynbegin = 'X'.
APPEND it_bdctab.
ENDFORM. " bdc_dynpro
*& Form bdc_field
text
-->P_0109 text
-->P_IT_VEND_LIFNR text
FORM bdc_field USING fnam
fval.
CLEAR it_bdctab.
it_bdctab-fnam = fnam.
it_bdctab-fval = fval.
APPEND it_bdctab.
ENDFORM. " bdc_field
*& Form disp_data
text
--> p1 text
<-- p2 text
FORM disp_data .
ULINE (45).
WRITE : / sy-vline,
18 'SUMMARY'(004) COLOR 1,
45 sy-vline.
ULINE /(45).
WRITE : / sy-vline,
'Total Records Processed'(007),
28 '=',
30 v_totrec,
45 sy-vline,
/ sy-vline,
'Error Records'(005),
28 '=',
30 v_errrec,
45 sy-vline,
/ sy-vline,
'Successful Records'(006),
28 '=',
30 v_sucrec,
45 sy-vline.
ULINE /(45).
ENDFORM. " disp_data
*& Form disp_success_data
text
--> p1 text
<-- p2 text
FORM disp_success_data .
ULINE (45).
WRITE : / sy-vline,
14 'Successful Records'(012) COLOR 1,
45 sy-vline.
ULINE /(45).
WRITE : / sy-vline ,
'Vendor Number'(010) COLOR 2,
17 sy-vline,
25 'Vendor Name'(011) COLOR 2,
45 sy-vline.
ULINE /(45).
LOOP AT it_sucrec INTO wa_sucrec.
WRITE: / sy-vline ,
wa_sucrec-vnum,
17 sy-vline,
19 wa_sucrec-vnam,
45 sy-vline.
ENDLOOP.
ULINE /(45).
ENDFORM. " disp_success_data
*& Form disp_error_data
text
--> p1 text
<-- p2 text
FORM disp_error_data .
ULINE (85).
WRITE : / sy-vline,
35 'Error Records'(013) COLOR 1,
85 sy-vline.
ULINE /(85).
WRITE : / sy-vline,
'Record Number'(008) COLOR 2,
sy-vline,
37 'Reason for error'(009) COLOR 2,
85 sy-vline.
ULINE /(85).
LOOP AT it_errrec INTO wa_errrec.
WRITE : / sy-vline,
wa_errrec-lineno,
17 sy-vline,
wa_errrec-message,
85 sy-vline.
ENDLOOP.
ULINE /(85).
ENDFORM. " disp_error_data
Regards,
Bhaskar
Maybe you are looking for
-
New iTunes will not allow me to manually sync music to Iphone 4s
I had to change my computer's hard disk which is a mac, I updated itunes as I had done before with my other hard disk, but now my itunes will not allow me to manage anything in my iphone 4s. I cannot manually sync music to my iphone as I used to, not
-
Good Morning, i have a question: how i can to insert a dynamic flv in a asp page..(path is insert in a column of database)? When i try whit "insert flash video function>insert from dati source", an error occour: url can't insert because ther is not v
-
Auto Trace Not Previewing?
Hi- I'm trying to trace a video layer, but for some reason when I check the preview dialog box, the mask flickers on and off, but dont stay visible. Specs: Max OS X 10.7.5 3.06 GHz Intel Core i3 8GB 1067 MHz DDR3 AE CC Version 12.0.0.404 Thanks for a
-
I recently tried to change my user short name by selecting the folder, in the users folder, and changed the name in "Get Info" (under file menu). All seemed well until I logged out and back in again. I then found that my user, which I had renamed, wa
-
Hi, Two (hopefully) quick questions: 1) Basically, I have my controls on the main timeline. From here, I have a movieclip. I now want to spawn a Child within this movieclip, through actionscript, that is capable of being a button. How would I do this