BDC录屏简易库
(2011-11-17 13:16)
- TYPE-POOL zbdc .
-
*&&---------------------------------------------------------------*
-
*&& Description:Library for using bdc
-
*&& Author:felix
-
*&& Version:1.0
-
*&& QQ:76985807
-
*&& Email:abaptiner@foxmail.com
-
*&& note:open source,anyone can use and modify it.
-
*&&---------------------------------------------------------------*
-
CONSTANTS:zbdc_empty_tag TYPE c VALUE '~'.
-
-
*&&---------------------------------------------------------------*
-
*&& initialize variants
-
*&&---------------------------------------------------------------*
-
*&& Note:You can use this macro to define all bdc variants
-
*&& simply just like example below.
-
*&& Example:
-
*&& zbdc_init.
-
*&&---------------------------------------------------------------*
-
DEFINE zbdc_init.
-
data:wa_zbdc_line type bdcdata.
-
data:lt_bdc_tab type standard table of bdcdata.
-
data:lt_bdc_option type standard table of ctu_params,
-
ls_bdc_option type ctu_params.
-
data:lt_bdc_message type standard table of bdcmsgcoll.
-
END-OF-DEFINITION.
-
*&&---------------------------------------------------------------*
-
*&& Append a bdc field or screen line which copy from shdb
-
*&&---------------------------------------------------------------*
-
*&& Note:With this macro,you can copy bdc records to excel and
-
*&& edit.Replace empty fields with ~.
-
*&& Example:
-
*&& zbdc_raw_line:
-
*&& SAPMF02D 0101 X
-
*&& ~ ~ ~ BDC_CURSOR RF02D-D0324
-
*&& ~ ~ ~ BDC_OKCODE /00
-
*&& ~ ~ ~ RF02D-KUNNR 1010003.
-
*&&---------------------------------------------------------------*
-
DEFINE zbdc_raw_line.
-
clear wa_zbdc_line.
-
if '&1' <> zbdc_empty_tag.
-
wa_zbdc_line-program = '&1'.
-
else.
-
wa_zbdc_line-program = ''.
-
endif.
-
if '&2' <> zbdc_empty_tag.
-
wa_zbdc_line-dynpro = '&2'.
-
else.
-
wa_zbdc_line-dynpro = ''.
-
endif.
-
if '&3' <> zbdc_empty_tag.
-
wa_zbdc_line-dynbegin = '&3'.
-
else.
-
wa_zbdc_line-dynbegin = ''.
-
endif.
-
if '&4' <> zbdc_empty_tag.
-
wa_zbdc_line-fnam = '&4'.
-
else.
-
wa_zbdc_line-fnam = ''.
-
endif.
-
if '&5' <> zbdc_empty_tag.
-
wa_zbdc_line-fval = '&5'.
-
else.
-
wa_zbdc_line-fval = ''.
-
endif.
-
append wa_zbdc_line to lt_bdc_tab.
-
END-OF-DEFINITION.
-
*&& append bdc screen
-
DEFINE zbdc_screen.
-
clear wa_zbdc_line.
-
wa_zbdc_line-program = &1.
-
wa_zbdc_line-dynpro = &2.
-
wa_zbdc_line-dynbegin = &3.
-
append wa_zbdc_line to lt_bdc_tab.
-
END-OF-DEFINITION.
-
*&& append bdc field
-
DEFINE zbdc_field.
-
clear wa_zbdc_line.
-
wa_zbdc_line-fnam = &1.
-
wa_zbdc_line-fval = &2.
-
append wa_zbdc_line to lt_bdc_tab.
-
END-OF-DEFINITION.
-
*&& call transaction using default mode 'E'
-
DEFINE zbdc_call_trans.
-
clear ls_bdc_option.
-
ls_bdc_option-dismode = 'E'.
-
ls_bdc_option-updmode = 'S'.
-
ls_bdc_option-NOBINPT = ''.
-
call transaction &1
-
using lt_bdc_tab
-
options from ls_bdc_option
-
messages into lt_bdc_message.
-
END-OF-DEFINITION.
-
*&& call transaction using mode 'E'
-
DEFINE zbdc_call_trans_e.
-
zbdc_call_trans.
-
END-OF-DEFINITION.
-
*&& call transaction using mode 'A'
-
DEFINE zbdc_call_trans_a.
-
clear ls_bdc_option.
-
ls_bdc_option-dismode = 'A'.
-
ls_bdc_option-updmode = 'S'.
-
call transaction &1
-
using lt_bdc_tab
-
options from ls_bdc_option
-
messages into lt_bdc_message.
-
END-OF-DEFINITION.
-
*&& call transaction using mode 'N'
-
DEFINE zbdc_call_trans_n.
-
clear ls_bdc_option.
-
ls_bdc_option-dismode = 'N'.
-
ls_bdc_option-updmode = 'S'.
-
call transaction &1
-
using lt_bdc_tab
-
options from ls_bdc_option
-
messages into lt_bdc_message.
-
END-OF-DEFINITION.
-
*&& get bdc message
-
DEFINE zbdc_get_message.
-
&1 = lt_bdc_message.
- END-OF-DEFINITION.


