技术开发 频道

ABAP/4 BADI 入门篇

    这三个方法在标准的程序中是怎么被调用的.

    以下是系统标准程序   

    *Define class load

    
class cl_exithandler definition load.

    
*Define the Sales Order Control Table instance

    data: lds_soctrl type
/kjeps/soctrl,

    ldf_screen_visible(
1) type C value space,

    ldf_pre_existing type c,

    exit type ref to
/KJEPS/IF_EX_BADI2,

    ldf_badi_name type exit_def value
'/KJEPS/BADI2'.

    
*Chck the BADI whether was implemented.

    
*检查BADI是否被用户给实现过了,传入BADI的定义名字和接口类名

    CALL METHOD CL_EXITHANDLER
=>GET_INSTANCE

    EXPORTING

    EXIT_NAME
= ldf_badi_name

    NULL_INSTANCE_ACCEPTED
= space

    IMPORTING

    ACT_IMP_EXISTING
= ldf_pre_existing

    CHANGING

    INSTANCE
= exit.

    
*IF the BADI has implemented, and then call corresponding method.

    
*如果这个BADI被用户实现了,下面的这个参数会等于’X’

    
*如果实现了,就调用客户实现的方法.

    
if ldf_pre_existing = gcf_on.

    CALL METHOD EXIT
->SET_SCREEN_COND_VBAP

    EXPORTING

    IN_VBAK
= vbak

    IN_VBAP
= vbap

    IN_TRTYP
= t180-trtyp

    IN_XVBAP
= xvbap[]

    IN_XVBEP
= xvbep[]

    IN_XVBKD
= xvbkd[]

    IN_XVBPA
= xvbpa[]

    CHANGING

    EX_SCREEN_VISIBLE
= ldf_screen_visible.

    endif.

    
if ldf_screen_visible = space.

    loop at screen.

    screen
-active = '0'.

    modify screen.

    endloop.

    endif.
0
相关文章