使用Call Transaction来实现BDC(转)

data:

ls_bdc like bdcdata,

lt_bdc like standard table of bdcdata.


data:

w_dis_mode type char1 value 'A',

w_upd_mode type char1 value 'S',

w_session LIKE APQI-GROUPID value 'SESSION1-54' .


start-of-selection.

*1. filling BDC table

perform fill_bdc_tab.


*2. output the data

ULINE /5(65).

WRITE:/5 'Program',

15 'Screen',

25 'New Screen',

40 'Field Name',

55 'Field Value'.

LOOP AT lt_bdc into ls_bdc.

WRITE: /5 ls_bdc-PROGRAM,

15 ls_bdc-DYNPRO,

30 ls_bdc-DYNBEGIN,

40 ls_bdc-FNAM,

55 ls_bdc-FVAL.

ENDLOOP.


*3. call transaction to implement BDC

ULINE /5(65).

WRITE: / 'call transaction to implement BDC'.

call transaction 'FK01'

using lt_bdc

mode w_dis_mode

update w_upd_mode.


IF SY-SUBRC = 0.

WRITE: / 'Call Transaction: updated successfully!'.

ELSE.

WRITE: / 'Call Transaction: updated failed!'.

ENDIF.


*&———————————————————————*

*& Form fill_bdc_tab

*&———————————————————————*

* Fill BDC data

*———————————————————————-*

FORM fill_bdc_tab .


* clear bdc

refresh:lt_bdc.


* fill BDC

perform populate_bdc_tab using:

'1' 'SAPMF02K' '0105', "initial create vendor screen

' ' 'BDC_CURSOR' 'RF02K-KTOKK',

' ' 'RF02K-LIFNR' 'TEST2',

' ' 'RF02K-BUKRS' '0001', "Company code

' ' 'RF02K-KTOKK' 'ZTMM', "Account group

' ' 'BDC_OKCODE' '/00',


'1' 'SAPMF02K' '0110',

' ' 'BDC_CURSOR' 'LFA1-LAND1',

' ' 'LFA1-NAME1' 'tang',

' ' 'LFA1-SORTL' 'can',

' ' 'LFA1-LAND1' 'CN',

' ' 'LFA1-ANRED' 'Mr.Tang',

' ' 'LFA1-SPRAS' 'EN',

' ' 'BDC_OKCODE' '/00',


'1' 'SAPMF02K' '0120',

' ' 'BDC_OKCODE' '=UPDA',

' ' 'BDC_CURSOR' 'LFA1-KUNNR',

' ' 'BDC_SUBSCR' 'SAPMF02K 1099ARI-ST',

' ' 'BDC_SUBSCR' 'SAPMF02K 1099ARI-01',

' ' 'BDC_SUBSCR' 'SAPMF02K 1099ARI-02',

' ' 'BDC_SUBSCR' 'SAPMF02K 1099ARI-03',

' ' 'BDC_SUBSCR' 'SAPMF02K 1099ARI-04',

' ' 'BDC_SUBSCR' 'SAPMF02K 1099ARI-05',

' ' 'BDC_SUBSCR' 'SAPMF02K 1099ARI-06',


'1' 'SAPMF02K' '0210',

' ' 'BDC_CURSOR' 'LFB1-AKONT',

' ' 'LFB1-AKONT' '197100',

' ' 'BDC_OKCODE' '=UPDA'.


ENDFORM. "fill_bdc_tab
" fill_bdc_tab

*&———————————————————————*

*& Form populate_bdc_tab

*&———————————————————————*

* fill data to bdc

*———————————————————————-*

* –>P_0024 text

* –>P_0025 text

* –>P_0026 text

*———————————————————————-*

FORM populate_bdc_tab USING FLAG type char1

VAR1 type any

VAR2 type any.


CLEAR ls_bdc.

if flag = '1'.

ls_bdc-program = var1.

ls_bdc-dynpro = var2.

ls_bdc-dynbegin = 'X'.

else.

ls_bdc-fnam = var1.

ls_bdc-fval = var2.

endif.


APPEND ls_bdc to lt_bdc.


ENDFORM. "fill_bdc_tab
"populate_bdc_tab
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值