Skip to Content

1.     对于订单类的保存前检查,可以调用BADI:Order_Save,以下是具体代码范例:




          DATA:lr_message_service TYPE REF TO cl_bsp_wd_message_service.
          lr_message_service = cl_bsp_wd_message_service=>get_instance( ).

          CALL METHOD lr_message_service->add_message
               iv_msg_type   = ‘E’
               iv_msg_id     = ‘XXX’
               iv_msg_number = ‘000’.

           RAISE do_not_save.    “通过调用自带的exception才能阻止程序流继续运行



         DATA: lr_global_message TYPE REF TO cl_crm_genil_global_mess_cont.
         DATA core TYPE REF TO cl_crm_bol_core.

         core = cl_crm_bol_core=>get_instance( ).
         lr_global_message = core->get_global_message_cont( ).
         CHECK lr_global_message IS BOUND.
         lr_global_message->add_message( iv_msg_type   = ‘E’ iv_msg_id = ‘XXX’ iv_msg_number = ‘000’ iv_show_only_once = abap_true ).

2.     对于BP主数据的保存前检查,可以调用BADI:BUPA_FURTHER_CHECKS


         DATA: lw_return TYPE bapiret2.

         lw_returntype = ‘E’.
         lw_returnid = ‘ZFR_001’.
         lw_returnnumber = 016.
         lw_returnmessage_v1 = org_name1.
        APPEND lw_return TO et_return.                 “通过向方法自带的ET_RETURN中写入参数,可以阻止程序流继续运行

To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply