简单说一下这个DBC,之前也一直在用,每次找记录都很麻烦,所以今天干脆就记下来吧
T-CODE:SHDB
输入个NAME,T-CODE.然后执行。。。最后用保存或者返回来结束录屏。
然后选择记录,创建程序,放到本地,这个时候,记录的所有东西都在程序里了。。。下面就是处理部分了
1.跳转类的:
开头定义的地方加上两个变量
DATA: BDCDATA LIKE BDCDATA OCCURS 0 WITH HEADER LINE. DATA: MESSTAB LIKE BDCMSGCOLL OCCURS 0 WITH HEADER LINE. DATA: GS_CTU_PARAMS TYPE CTU_PARAMS.
BDCDATA是存这些录屏过程中的变量及常量等
GS_ctu_PARAMS是调事务代码时带的一些参数,是否前台执行,报错停止等等。。。。
然后从程序中选一些dynpro 和field的BDC行。。。
有些不需要的字段或者屏幕,可以直接删除对应代码
CLEAR bdcdata[]. gs_ctu_params-updmode = ‘S‘. gs_ctu_params-dismode = ‘E‘. gs_ctu_params-defsize = ‘‘."设置窗口非默认大小 "调用BDC执行 T-code COOIS 显示订单抬头 PERFORM bdc_dynpro USING ‘PPIO_ENTRY‘ ‘1000‘. PERFORM bdc_field USING ‘BDC_OKCODE‘ ‘=ONLI‘. PERFORM bdc_field USING ‘PPIO_ENTRY_SC1100-PPIO_LISTTYP‘ ‘PPIOM000‘. PERFORM bdc_field USING ‘PPIO_ENTRY_SC1100-ALV_VARIANT‘ ‘000000000001‘. PERFORM bdc_field USING ‘BDC_CURSOR‘ ‘S_WERKS-LOW‘. * perform bdc_field using ‘S_AUFNR-LOW‘ * GS_AFKO-AUFNR. PERFORM bdc_field USING ‘S_AUART-LOW‘ ‘DL01‘. PERFORM bdc_field USING ‘S_ECKEN-LOW‘ gw_zstybcp-gstrp. * GS_AFKO-GSTRP. PERFORM bdc_field USING ‘S_WERKS-LOW‘ gw_zstybcp-werks. * GS_AFKO-WERKS. PERFORM bdc_field USING ‘S_COMPO-LOW‘ gw_zstybcp-matnr. * GS_AFKO-MATNR. PERFORM bdc_dynpro USING ‘SAPLCOISOUTPUT‘ ‘0100‘. CALL TRANSACTION ‘COOIS‘ USING bdcdata OPTIONS FROM gs_ctu_params.
至于上面的s和E是什么意思,你运行一下刚生成的程序,你就看到了。。。
2.执行类的录屏
这类的录屏在有些没有标准函数或者太简单,或者太复杂的函数处理的时候偷懒的做法。。。能简单就简单嘛。和上面同样的方法生成程序。然后选择需要的代码段。。。不需要的可以注释,或者删除
CLEAR BDCDATA[]. PERFORM BDC_DYNPRO USING ‘SAPMM06I‘ ‘0100‘. PERFORM BDC_FIELD USING ‘BDC_CURSOR‘ ‘EINE-WERKS‘. PERFORM BDC_FIELD USING ‘BDC_OKCODE‘ ‘/00‘. PERFORM BDC_FIELD USING ‘EINA-LIFNR‘ GW_EXCEL-LIFNR. PERFORM BDC_FIELD USING ‘EINA-MATNR‘ GW_EXCEL-MATNR. PERFORM BDC_FIELD USING ‘EINE-EKORG‘ GW_EXCEL-EKORG. PERFORM BDC_FIELD USING ‘EINE-WERKS‘ GW_EXCEL-WERKS. PERFORM BDC_FIELD USING ‘RM06I-NORMB‘ ‘X‘. PERFORM BDC_DYNPRO USING ‘SAPMM06I‘ ‘0101‘. PERFORM BDC_FIELD USING ‘BDC_OKCODE‘ ‘=EINE‘. * PERFORM BDC_FIELD USING ‘EINA-MEINS‘ * RECORD-MEINS_006. * PERFORM BDC_FIELD USING ‘EINA-UMREZ‘ * RECORD-UMREZ_007. * PERFORM BDC_FIELD USING ‘EINA-UMREN‘ * RECORD-UMREN_008. PERFORM BDC_DYNPRO USING ‘SAPMM06I‘ ‘0102‘. PERFORM BDC_FIELD USING ‘BDC_CURSOR‘ ‘EINE-MWSKZ‘. PERFORM BDC_FIELD USING ‘BDC_OKCODE‘ ‘/00‘. * PERFORM BDC_FIELD USING ‘EINE-APLFZ‘ * RECORD-APLFZ_009. * PERFORM BDC_FIELD USING ‘EINE-EKGRP‘ * RECORD-EKGRP_010. * PERFORM BDC_FIELD USING ‘EINE-NORBM‘ * RECORD-NORBM_011. * PERFORM BDC_FIELD USING ‘EINE-WEBRE‘ * RECORD-WEBRE_012. PERFORM BDC_FIELD USING ‘EINE-MWSKZ‘ GW_EXCEL-MWSKZ. * PERFORM BDC_FIELD USING ‘EINE-IPRKZ‘ * RECORD-IPRKZ_014. PERFORM BDC_DYNPRO USING ‘SAPMM06I‘ ‘0105‘. PERFORM BDC_FIELD USING ‘BDC_CURSOR‘ ‘EINE-ANGNR‘. PERFORM BDC_FIELD USING ‘BDC_OKCODE‘ ‘=KO‘. PERFORM BDC_DYNPRO USING ‘SAPLV14A‘ ‘0102‘. PERFORM BDC_FIELD USING ‘BDC_CURSOR‘ ‘VAKE-DATAB(01)‘. PERFORM BDC_FIELD USING ‘BDC_OKCODE‘ ‘=NEWD‘. PERFORM BDC_DYNPRO USING ‘SAPMV13A‘ ‘0201‘. PERFORM BDC_FIELD USING ‘BDC_CURSOR‘ ‘KONP-KBETR(01)‘. PERFORM BDC_FIELD USING ‘BDC_OKCODE‘ ‘=SICH‘. PERFORM BDC_FIELD USING ‘RV13A-DATAB‘ GW_EXCEL-LIFAB. PERFORM BDC_FIELD USING ‘RV13A-DATBI‘ GW_EXCEL-LIFBI. PERFORM BDC_FIELD USING ‘KONP-KBETR(01)‘ GW_EXCEL-NETPR. PERFORM BDC_FIELD USING ‘KONP-KPEIN(01)‘ GW_EXCEL-KPEIN. * PERFORM BDC_TRANSACTION USING ‘ME12‘. CALL TRANSACTION ‘ME12‘ USING BDCDATA MODE ‘N‘ UPDATE ‘S‘ MESSAGES INTO MESSTAB.
这段是做的采购信息记录,修改价格,税码和单位数量的。。。
这种最后CALL TRANSACTION和上面的那种是不同的方式,这种可以接收返回消息
然后处理返回消息,判断是否成功等。。。
好了,就说到这,有不懂得,自己研究研究。。。
时间: 2024-11-06 07:07:28