Chinaunix首页 | 论坛 | 博客
  • 博客访问: 690975
  • 博文数量: 145
  • 博客积分: 3446
  • 博客等级: 中校
  • 技术积分: 1567
  • 用 户 组: 普通用户
  • 注册时间: 2006-08-30 13:58
文章分类

全部博文(145)

文章存档

2021年(1)

2020年(1)

2019年(1)

2018年(6)

2017年(1)

2016年(10)

2015年(12)

2014年(10)

2013年(15)

2012年(33)

2011年(21)

2010年(9)

2009年(18)

2008年(2)

2006年(5)

我的朋友

分类: 项目管理

2012-03-14 10:15:36

For BP updates at create/change save time, the BUPA_*_UPDATE BADIs need to be used. The interface only provides the GUID of the not yet created BP or the GUID of the changed BP, not a bunch of parameters that you can change before save. However, you can call the BUPA_*_CALLBACK series of function modules to get the info you need about the BP, and use a field symbol to directly access the data in the memory stack i.e., (SAPLBUD0)MEM_BUT000[] and change the values. I am using this technique to add an authorization group to certain BP type at create save time. 


BADI:PARTNER_UPDATE 综合了BUPA_*_UPDATE BADIs ,并且使用FM:BUPA_*_CALLBACK获得相关数据
 
 
 
 

I figured out another way to do this.

  FIELD-SYMBOLS TYPE ANY TABLE.  
DATA : ws_bus000_i TYPE bus000___i.  
FIELD-SYMBOLS TYPE bus000___i.  
IF sy-tcode = 'BP'.
     ASSIGN ('(SAPLBUD0)MEM_BUT000[]') TO .
     IF IS ASSIGNED.
       LOOP AT  ASSIGNING .
         IF IS ASSIGNED.
           IF -partner_guid = ws_but000-partner_guid.
             -bu_sort1 = 'BP'.
           ENDIF.
         ENDIF.
       ENDLOOP.
     ENDIF.
     UNASSIGN : , .
   ELSEIF sy-tcode IS INITIAL.
     ASSIGN ('(SAPLBUD_MEM)gt_but000_mem[]') TO .
     IF IS ASSIGNED.
       LOOP AT  ASSIGNING .
         IF IS ASSIGNED.
           IF -partner_guid = ws_but000-partner_guid.
             -bu_sort1 = 'WEB UI'.
           ENDIF.
         ENDIF.
       ENDLOOP.
     ENDIF.
     UNASSIGN : , .
   ENDIF.

on debugging I could figure out the program containing the data in the memory.

Before the save I accessed this program and updated the parameter as required.

Also For transaction BP this program is not available but there is another program so there is an if else based on the sy-tcode.

I need to check for other BP transactions as well but as of now this seems good.

 

 

IF_EX_PARTNER_UPDATE~CHANGE_BEFORE_UPDATE:

 

  SPAN { font-family: "Arial monospaced for SAP"; font-size: 10pt; color: #000000; background: #CCE8CF; } .L0S31 { font-style: italic; color: #808080; } .L0S33 { color: #4DA619; } .L0S52 { color: #0000FF; } METHOD if_ex_partner_update~change_before_update.

  DATA lt_but0is_o TYPE TABLE OF but0is .
  DATA lt_but0is_n TYPE TABLE OF but0is .
  DATA ls_but0is TYPE  but0is .

  DATA lt_but000_o TYPE TABLE OF but000 .
  DATA lt_but000_n TYPE TABLE OF but000 .
  DATA ls_but000 TYPE  but000 .

  DATA lt_but020_o TYPE TABLE OF but020 .
  DATA lt_but020_n TYPE TABLE OF but020 .
  DATA ls_but020 TYPE  but020 .


    DATA ls_address TYPE bapibus1006_address .
**************************************************************************************************************

  IF sy-tcode = 'BP'.

    CALL FUNCTION 'BUPA_ISNUMBER_CALLBACK'
      TABLES
        et_but0is_old = lt_but0is_o
        et_but0is_new = lt_but0is_n.

    CALL FUNCTION 'BUPA_GENERAL_CALLBACK'
      TABLES
        et_but000_old = lt_but000_o
        et_but000_new = lt_but000_n.

    CALL FUNCTION 'BUPA_ADDR_CALLBACK'
      TABLES
        et_but020_old = lt_but020_o
        et_but020_new = lt_but020_n.

    IF lt_but0is_n IS NOT INITIAL.
      LOOP AT lt_but0is_n INTO ls_but0is.
      ENDLOOP.
    ENDIF.

    IF lt_but000_n IS NOT INITIAL.
      LOOP AT lt_but000_n INTO ls_but000.
      ENDLOOP.
    ENDIF.

    IF lt_but020_n IS NOT INITIAL.
      LOOP AT lt_but020_n INTO ls_but020.
      ENDLOOP.
    ENDIF.

    CALL FUNCTION 'BUPA_ADDRESS_GET_DETAIL'
      EXPORTING
        iv_partner = ls_but000-partner
        iv_valdt   = sy-datlo
      IMPORTING
        es_address = ls_address.


  ENDIF.



ENDMETHOD.

 

 

 

阅读(2992) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~