一个需求是点击自写程序输出界面的一个按钮进入co11n货物移动的界面,其中就要求把生产订单号,产量,日期参数带上值。首先想到的是用
SET PARAMETER ID 'ANR' FIELD lw_cc_aufnr-aufnr.
call TRANSACTION 'CO11N' AND SKIP FIRST SCREEN .
但是,不幸发现产量没有PARAMETER ID,而且没有直接进入货物移动的界面,还要手工点击按钮或者再写code。最后的解决方法是,用bdc mode ‘E’:
"bdc程序
perform bdc1_dynpro using 'SAPLCORU_S' '0100'.
perform bdc1_field using 'BDC_OKCODE'
'/00'.
perform bdc1_field using 'BDC_CURSOR'
'AFRUD-AUFNR'.
perform bdc1_field using 'AFRUD-AUFNR'
lw_cc_aufnr-aufnr.
perform bdc1_dynpro using 'SAPLCORU_S' '0100'.
perform bdc1_field using 'BDC_OKCODE'
'/00'.
perform bdc1_field using 'AFRUD-AUFNR'
lw_cc_aufnr-aufnr.
perform bdc1_field using 'BDC_CURSOR'
'AFRUD-LMNGA'.
perform bdc1_field using 'AFRUD-LMNGA'
lw_cc_cl.
perform bdc1_dynpro using 'SAPLCORU_S' '0100'.
perform bdc1_field using 'BDC_OKCODE'
'/00'.
perform bdc1_field using 'AFRUD-AUFNR'
lw_cc_aufnr-aufnr.
perform bdc1_field using 'AFRUD-LMNGA'
lw_cc_cl.
perform bdc1_dynpro using 'SAPLCORU_S' '0100'.
perform bdc1_field using 'BDC_OKCODE'
'=MB03'.
perform bdc1_field using 'AFRUD-AUFNR'
lw_cc_aufnr-aufnr.
perform bdc1_field using 'AFRUD-LMNGA'
lw_cc_cl.
perform bdc1_field using 'BDC_CURSOR'
'AFRUD-BUDAT'.
perform bdc1_field using 'AFRUD-BUDAT'
lw_cc_budat.
perform bdc1_dynpro using 'SAPLCOWB' '0130'.
perform bdc1_field using 'BDC_CURSOR'
'COWB_COMP-CHARG(01)'.
CLEAR:gt_messtab[],gt_messtab.
CALL TRANSACTION 'CO11N' USING gt_bdcdata MODE 'E' .
SET PARAMETER ID 'ANR' FIELD lw_cc_aufnr-aufnr.
call TRANSACTION 'CO11N' AND SKIP FIRST SCREEN .
但是,不幸发现产量没有PARAMETER ID,而且没有直接进入货物移动的界面,还要手工点击按钮或者再写code。最后的解决方法是,用bdc mode ‘E’:
"bdc程序
perform bdc1_dynpro using 'SAPLCORU_S' '0100'.
perform bdc1_field using 'BDC_OKCODE'
'/00'.
perform bdc1_field using 'BDC_CURSOR'
'AFRUD-AUFNR'.
perform bdc1_field using 'AFRUD-AUFNR'
lw_cc_aufnr-aufnr.
perform bdc1_dynpro using 'SAPLCORU_S' '0100'.
perform bdc1_field using 'BDC_OKCODE'
'/00'.
perform bdc1_field using 'AFRUD-AUFNR'
lw_cc_aufnr-aufnr.
perform bdc1_field using 'BDC_CURSOR'
'AFRUD-LMNGA'.
perform bdc1_field using 'AFRUD-LMNGA'
lw_cc_cl.
perform bdc1_dynpro using 'SAPLCORU_S' '0100'.
perform bdc1_field using 'BDC_OKCODE'
'/00'.
perform bdc1_field using 'AFRUD-AUFNR'
lw_cc_aufnr-aufnr.
perform bdc1_field using 'AFRUD-LMNGA'
lw_cc_cl.
perform bdc1_dynpro using 'SAPLCORU_S' '0100'.
perform bdc1_field using 'BDC_OKCODE'
'=MB03'.
perform bdc1_field using 'AFRUD-AUFNR'
lw_cc_aufnr-aufnr.
perform bdc1_field using 'AFRUD-LMNGA'
lw_cc_cl.
perform bdc1_field using 'BDC_CURSOR'
'AFRUD-BUDAT'.
perform bdc1_field using 'AFRUD-BUDAT'
lw_cc_budat.
perform bdc1_dynpro using 'SAPLCOWB' '0130'.
perform bdc1_field using 'BDC_CURSOR'
'COWB_COMP-CHARG(01)'.
CLEAR:gt_messtab[],gt_messtab.
CALL TRANSACTION 'CO11N' USING gt_bdcdata MODE 'E' .
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/25465231/viewspace-714860/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/25465231/viewspace-714860/